[Pkg-shadow-commits] r778 - trunk/debian/patches

Nicolas FRANCOIS nekral-guest at costa.debian.org
Sun Jan 8 17:27:31 UTC 2006


Author: nekral-guest
Date: 2006-01-08 17:27:31 +0000 (Sun, 08 Jan 2006)
New Revision: 778

Added:
   trunk/debian/patches/480_getopt_args_reorder
Modified:
   trunk/debian/patches/series
Log:
Allow su's options to be specified after - or the username:
let getopt reorder the su arguments


Added: trunk/debian/patches/480_getopt_args_reorder
===================================================================
--- trunk/debian/patches/480_getopt_args_reorder	2006-01-07 21:56:07 UTC (rev 777)
+++ trunk/debian/patches/480_getopt_args_reorder	2006-01-08 17:27:31 UTC (rev 778)
@@ -0,0 +1,54 @@
+Goal: Allow SU options to be passed after - or the username
+
+Fixes: #331438 or #346445 in popularity-contest
+
+Note: The man page is clear about su usage:
+su [options] [-] [username [args]]
+but too many package are using this feature
+
+GNU su should also allow that.
+
+The only drawback I can see is (for upstream) that "su -x" (whish should
+start a shell in debug mode) won't work (su -- -x) will have to be used
+instead.
+This was a problem when -c was not an su option, but it is no more the
+case (a -- would have to be added for all the su -c "command"
+invocations).
+
+Index: shadow-4.0.14/src/su.c
+===================================================================
+--- shadow-4.0.14.orig/src/su.c	2006-01-08 15:40:36.000000000 +0100
++++ shadow-4.0.14/src/su.c	2006-01-08 16:03:07.000000000 +0100
+@@ -357,19 +357,9 @@
+ 		};
+ 
+ 		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;
+@@ -391,10 +381,9 @@
+ 				shellstr = optarg;
+ 				break;
+ 			default:
+-				usage ();	/* NOT REACHED */
++				usage ();
+ 			}
+ 		}
+-	      end_su_options:
+ 		if (optind < argc && !strcmp (argv[optind], "-")) {
+ 			fakelogin = 1;
+ 			optind++;

Modified: trunk/debian/patches/series
===================================================================
--- trunk/debian/patches/series	2006-01-07 21:56:07 UTC (rev 777)
+++ trunk/debian/patches/series	2006-01-08 17:27:31 UTC (rev 778)
@@ -43,6 +43,7 @@
 423_su_arguments_are_concatenated
 478_nologin.8.xml
 479_chowntty_debug
+480_getopt_args_reorder
 # 999-2 is about using cdbs. It does not patch upstream files
 # so shouldn't be here, but we keep it for the future
 # 999-2_build_using_cdbs




More information about the Pkg-shadow-commits mailing list