[Pkg-shadow-commits] r705 - trunk/debian/patches
Nicolas FRANCOIS
nekral-guest at costa.debian.org
Wed Dec 14 22:16:18 UTC 2005
Author: nekral-guest
Date: 2005-12-14 22:16:18 +0000 (Wed, 14 Dec 2005)
New Revision: 705
Added:
trunk/debian/patches/437_su_-c_option
Modified:
trunk/debian/patches/423_su_arguments_are_concatenated
trunk/debian/patches/series
Log:
Simplify the 437_* patches.
Modified: trunk/debian/patches/423_su_arguments_are_concatenated
===================================================================
--- trunk/debian/patches/423_su_arguments_are_concatenated 2005-12-14 22:13:48 UTC (rev 704)
+++ trunk/debian/patches/423_su_arguments_are_concatenated 2005-12-14 22:16:18 UTC (rev 705)
@@ -1,6 +1,5 @@
-Goal: document in the source and man pages why the arguments are
- concatenated and why they are always provided to the shell with the
- -c option of that shell.
+Goal: Concatenate the non-su arguments and provide them to the shell with
+ the -c option
Fixes: #317264
see also #276419
@@ -9,64 +8,43 @@
Note: the fix of the man page is still missing.
(to be taken from the trunk)
-Index: shadow-4.0.13/src/su.c
+Index: shadow-4.0.14/src/su.c
===================================================================
---- shadow-4.0.13.orig/src/su.c 2005-10-04 08:07:27.298768690 +0200
-+++ shadow-4.0.13/src/su.c 2005-10-04 08:07:34.443312955 +0200
-@@ -213,6 +213,8 @@
- int status;
- int ret;
- int argno = 0;
-+ unsigned int cmd_len = 0;
-+ char *cmd = NULL;
-
- /* There is at most 4 arguments (arg0, '-c', <command>, NULL) + the
- * number of arguments in the additional_args array. */
-@@ -238,6 +240,16 @@
- if (command) {
- args[argno++] = "-c";
- args[argno++] = command;
-+ } else if (additional_args) {
-+ /* even if -c was not specified, there are some additional arguments
-+ * and they will be passed to the shell in the command provided
-+ * with the -c shell option.
-+ * This differ from others su implementations (FreeBSD, SUN).
-+ *
-+ * If you want to supply arguments to the shell, you will need to
-+ * put the shell with its arguments in the command.
+--- shadow-4.0.14.orig/src/su.c 2005-12-14 22:42:12.000000000 +0100
++++ shadow-4.0.14/src/su.c 2005-12-14 22:42:18.000000000 +0100
+@@ -876,6 +876,35 @@
+ argv[0] = "-c";
+ argv[1] = command;
+ }
++ /* On Debian, the arguments are concatenated and the
++ * resulted string is always given to the shell with its
++ * -c option.
+ */
-+ args[argno++] = "-c";
- }
-
- if (additional_args) {
-@@ -248,6 +260,30 @@
-
- args[argno] = NULL;
-
-+ /* Arguments are concatenated because the shell requires the command to
-+ * be specified in one argument (which must follow -c).
-+ * This differ from others su implementations (FreeBSD, SUN).
-+ *
-+ * If you need to supply separated arguments to the shell, then put
-+ * the shell and its arguments in the command line.
-+ */
-+ if (args[1]) {
-+ const char **parg;
-+ cmd_len = 1; /* final \0 */
-+ for (parg = &args[2]; *parg; parg++) {
-+ cmd_len += strlen(*parg) + 1;
++ {
++ const char **parg;
++ unsigned int cmd_len = 0;
++ char *cmd = NULL;
++ if (! command) {
++ argv--;
++ argv[0] = "-c";
++ }
++ /* Now argv[0] is always -c, and other arguments
++ * can be concatenated
++ */
++ cmd_len = 1; /* finale '\0' */
++ for (parg = &argv[1]; *parg; parg++) {
++ cmd_len += strlen (*parg) + 1;
++ }
++ cmd = (char *) xmalloc (sizeof (char) * cmd_len);
++ cmd[0] = '\0';
++ for (parg = &argv[1]; *parg; parg++) {
++ strcat (cmd, " ");
++ strcat (cmd, *parg);
++ }
++ cmd[cmd_len - 1] = '\0';
++ argv[1] = &cmd[1]; /* do not take first space */
++ argv[2] = NULL;
+ }
-+ cmd = (char *) xmalloc(sizeof(char) * cmd_len);
-+ cmd[0] = '\0';
-+ for (parg = &args[2]; *parg; parg++) {
-+ strcat (cmd, " ");
-+ strcat (cmd, *parg);
-+ }
-+ cmd[cmd_len-1] = '\0';
-+ args[2] = &cmd[1]; /* do not take first space */
-+ args[3] = NULL;
-+ }
-+
- #ifndef USE_PAM
- (void) execv (shellstr, args);
- fprintf (stderr, _("No shell\n"));
+ /*
+ * Use the shell and create an argv
+ * with the rest of the command line included.
Added: trunk/debian/patches/437_su_-c_option
===================================================================
--- trunk/debian/patches/437_su_-c_option 2005-12-14 22:13:48 UTC (rev 704)
+++ trunk/debian/patches/437_su_-c_option 2005-12-14 22:16:18 UTC (rev 705)
@@ -0,0 +1,69 @@
+Index: shadow-4.0.14/src/su.c
+===================================================================
+--- shadow-4.0.14.orig/src/su.c 2005-12-14 22:34:06.000000000 +0100
++++ shadow-4.0.14/src/su.c 2005-12-14 22:42:12.000000000 +0100
+@@ -274,6 +274,7 @@
+ fprintf (stderr, _("Usage: su [options] [login]\n"
+ "\n"
+ "Options:\n"
++ " -c, --command COMMAND execute COMMAND in the shell\n"
+ " -h, --help display this help message and exit\n"
+ " -, -l, --login make the shell a login shell\n"
+ " -m, -p,\n"
+@@ -304,7 +305,7 @@
+ uid_t my_uid;
+ struct passwd *pw = 0;
+ char **envp = environ;
+- char *shellstr = 0;
++ char *command = 0, *shellstr = 0;
+ char *tmp_name;
+
+ #ifdef USE_PAM
+@@ -347,6 +348,7 @@
+ int option_index = 0;
+ int c;
+ static struct option long_options[] = {
++ {"command", required_argument, NULL, 'c'},
+ {"help", no_argument, NULL, 'h'},
+ {"login", no_argument, NULL, 'l'},
+ {"preserve-environment", no_argument, NULL, 'p'},
+@@ -355,7 +357,7 @@
+ };
+
+ while ((c =
+- getopt_long (argc, argv, "-hlmps:", long_options,
++ getopt_long (argc, argv, "-chlmps:", long_options,
+ &option_index)) != -1) {
+ switch (c) {
+ case 1:
+@@ -368,6 +370,9 @@
+ optind--;
+ goto end_su_options;
+ break; /* NOT REACHED */
++ case 'c':
++ command = optarg;
++ break;
+ case 'h':
+ usage ();
+ break;
+@@ -445,6 +450,8 @@
+ }
+
+ doshell = argc == optind; /* any arguments remaining? */
++ if (command)
++ doshell = 0;
+
+ /*
+ * Get the user's real name. The current UID is used to determine
+@@ -864,6 +871,11 @@
+ if (!doshell) {
+ /* Position argv to the remaining arguments */
+ argv += optind;
++ if (command) {
++ argv -= 2;
++ argv[0] = "-c";
++ argv[1] = command;
++ }
+ /*
+ * Use the shell and create an argv
+ * with the rest of the command line included.
Modified: trunk/debian/patches/series
===================================================================
--- trunk/debian/patches/series 2005-12-14 22:13:48 UTC (rev 704)
+++ trunk/debian/patches/series 2005-12-14 22:16:18 UTC (rev 705)
@@ -4,13 +4,6 @@
005_manpages.dpatch
503_shadowconfig.8
431_su_uid_0_not_root
-#437_su_add_GNU_options_1
-#437_su_add_GNU_options_2
-#437_su_add_GNU_options_3
-#437_su_add_GNU_options_4
-#437_su_add_GNU_options_5
-#437_su_add_GNU_options_6
-#437_su_add_GNU_options_7
008_su_no_sanitize_env
008_su_get_PAM_username
439_su_PAM_session
@@ -30,10 +23,6 @@
405_subsystem_remove_*_in_shell.dpatch
406_good_name.dpatch
407_32char_grnames.dpatch
-# NOTE: you must use only one of these 423
-# See bug #317264, #276419
-# 423_su_pass_args_without_concatenation # upstream don't suffer from this
-423_su_arguments_are_concatenated
426_grpck_group-gshadow_members_consistency
542_useradd-O_option
451_login_PATH
@@ -60,6 +49,8 @@
473_su_fix_comments
474_useradd_fix_comments
475_su_use_amroot_instead_of_getuid
+437_su_-c_option
+423_su_arguments_are_concatenated
# 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