Goal: Do not concatenate the additional arguments, and support an
      environment variable to revert to the old Debian's su behavior.

This patch needs the su_arguments_are_concatenated patch.

This patch, and su_arguments_are_concatenated should be dropped after
Etch.

Status wrt upstream: This patch is Debian specific.

Index: shadow-4.0.18.1/src/su.c
===================================================================
--- shadow-4.0.18.1.orig/src/su.c	2006-09-17 12:25:20.079551891 +0200
+++ shadow-4.0.18.1/src/su.c	2006-09-17 12:25:20.687556724 +0200
@@ -76,6 +76,19 @@
 /* If nonzero, change some environment vars to indicate the user su'd to. */
 static int change_environment;
 
+/*
+ * If nonzero, keep the old Debian behavior:
+ *   * concatenate all the arguments and provide them to the -c option of
+ *     the shell
+ *   * If there are some additional arguments, but no -c, add a -c
+ *     argument anyway
+ * Drawbacks:
+ *   * you can't provide options to the shell (other than -c)
+ *   * you can't rely on the argument count
+ * See http://bugs.debian.org/276419
+ */
+static int old_debian_behavior;
+
 #ifdef USE_PAM
 static pam_handle_t *pamh = NULL;
 static int caught = 0;
@@ -323,6 +336,8 @@
 #endif
 #endif				/* !USE_PAM */
 
+	old_debian_behavior = (getenv("SU_NO_SHELL_ARGS") != NULL);
+
 	/* sanitize_env (); */
 
 	setlocale (LC_ALL, "");
@@ -883,7 +898,7 @@
 		 * resulted string is always given to the shell with its
 		 * -c option.
 		 */
-		{
+		if (old_debian_behavior) {
 			char **parg;
 			unsigned int cmd_len = 0;
 			char *cmd = NULL;
