[Pkg-shadow-devel] patch for su (needed by the switch to getopt in 4.0.14)

Nicolas François nicolas.francois at centraliens.net
Fri Dec 9 23:18:32 UTC 2005


Hello Tomasz,

Here is another patch, which set the fakelogin variable.

Note: These patches were not tested. I mostly wanted to get these issues
noticed.

Best Regards,
-- 
Nekral
-------------- next part --------------
--- src/su.c.orig	2005-12-09 23:53:49.000000000 +0100
+++ src/su.c	2005-12-09 23:58:47.000000000 +0100
@@ -311,6 +311,11 @@
 			{NULL, 0, NULL, '\0'}
 		};
 
+/* I don't really understand what the --login does.
+ * maybe --login=<login> should be added to the usage, and the loginname should be copied in name in the 'l' case below.
+ * or the options string should be just "hl", and the structure above:
+ * {"login", no_argument, NULL, 'l'},
+ */
 		while ((c =
 			getopt_long (argc, argv, "hl:", long_options,
 				     &option_index)) != -1) {
@@ -319,11 +324,16 @@
 				usage ();
 				break;
 			case 'l':
+				fakelogin = 1;
 				break;
 			default:
 				usage ();
 			}
 		}
+		if (optind < argc && !strcmp (argv[optind], "-")) {
+			fakelogin = 1;
+			optind++;
+		}
 	}
 
 	initenv ();


More information about the Pkg-shadow-devel mailing list