su's arguments are now reordered. If needed, use -- to separate su's
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Wed, 26 Dec 2007 15:10:48 +0000 (15:10 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Wed, 26 Dec 2007 15:10:48 +0000 (15:10 +0000)
options from the shell's options.

ChangeLog
NEWS
src/su.c

index 9e2046e10da85ed5b5636e1885ad7b28412e7dff..fd1386164c9a1b2240767c3e8038fabbafa425d2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-12-26  Nicolas François  <nicolas.francois@centraliens.net>
+
+       Merge Debian's patch 480_getopt_args_reorder
+       * NEWS, src/su.c: su's arguments are now reordered.
+
 2007-12-26  Nicolas François  <nicolas.francois@centraliens.net>
 
        Merge RedHat's patch shadow-4.0.18.1-mtime.patch:
diff --git a/NEWS b/NEWS
index 4e4e539e7dfcf459a466f3120921fd3d34dd0ee6..e6a6870c424d617ec643af672fd5798bd45c0c46 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,9 @@ shadow-4.1.0 -> shadow-4.1.1                                          UNRELEASED
 - usermod
   * Keep the access and modification time of files when moving an user's home
     directory.
+- su
+  * su's arguments are now reordered. If needed, use -- to separate su's
+    options from the shell's options.
 
 shadow-4.0.18.2 -> shadow-4.1.0                                                09-12-2008
 
index 878920da4c6e4e6d26144970964ede92df06cac6..9917a2ccd89983ce4b1e7ac7e44fc4c2dc07a853 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -362,19 +362,9 @@ int main (int argc, char **argv)
                };
 
                while ((c =
-                       getopt_long (argc, argv, "-c:hlmps:", long_options,
+                       getopt_long (argc, argv, "c:hlmps:", long_options,
                                     &option_index)) != -1) {
                        switch (c) {
-                       case 1:
-                               /* this is not an su option */
-                               /* The next arguments are either '-', the
-                                * target name, or arguments to be passed
-                                * to the shell.
-                                */
-                               /* rewind the (not yet handled) option */
-                               optind--;
-                               goto end_su_options;
-                               break;  /* NOT REACHED */
                        case 'c':
                                command = optarg;
                                break;
@@ -399,7 +389,7 @@ int main (int argc, char **argv)
                                usage ();       /* NOT REACHED */
                        }
                }
-             end_su_options:
+
                if (optind < argc && !strcmp (argv[optind], "-")) {
                        fakelogin = 1;
                        optind++;