55 lines
1.5 KiB
Plaintext
55 lines
1.5 KiB
Plaintext
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" (which 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.1.0/src/su.c
|
|
===================================================================
|
|
--- shadow-4.1.0.orig/src/su.c
|
|
+++ shadow-4.1.0/src/su.c
|
|
@@ -379,19 +379,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;
|
|
@@ -413,10 +403,9 @@
|
|
shellstr = optarg;
|
|
break;
|
|
default:
|
|
- usage (); /* NOT REACHED */
|
|
+ usage ();
|
|
}
|
|
}
|
|
- end_su_options:
|
|
if (optind < argc && !strcmp (argv[optind], "-")) {
|
|
fakelogin = 1;
|
|
optind++;
|