]> granicus.if.org Git - shadow/commitdiff
* libmisc/shell.c, src/su.c: Execute the scripts with "sh -"
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Wed, 22 Jul 2009 13:35:57 +0000 (13:35 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Wed, 22 Jul 2009 13:35:57 +0000 (13:35 +0000)
rather than "sh".

ChangeLog
libmisc/shell.c
src/su.c

index caa4f095ece5fb6035ac5c2d4999d45469bb4d00..0e59abd8b912bfb945d692376a48e22893360036 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-22  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * libmisc/shell.c, src/su.c: Execute the scripts with "sh -"
+       rather than "sh".
+
 2009-07-22  Nicolas François  <nicolas.francois@centraliens.net>
 
        * configure.in, libmisc/shell.c, libmisc/setupenv.c, src/newgrp.c,
index 4e70505ae0ab2a46484acdc8d070759888443208..e253ae3ff864ed71b4c32c983ca5221a9560247a 100644 (file)
@@ -85,7 +85,7 @@ int shell (const char *file, /*@null@*/const char *arg, char *const envp[])
                 * Assume this is a shell script (with no shebang).
                 * Interpret it with /bin/sh
                 */
-               execle (SHELL, "sh", file, (char *)0, envp);
+               execle (SHELL, "sh", "-", file, (char *)0, envp);
                err = errno;
        }
 
index c6772a76fb636c6477a56de10db616a708b98c3a..c4c25a1d52643441158c68ff0d15eabc501d5c96 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -194,12 +194,13 @@ void execve_shell (const char *shellstr, char *args[], char *const envp[])
                while (NULL != args[n_args]) {
                        n_args++;
                }
-               targs = (char **) xmalloc ((n_args + 2) * sizeof (args[0]));
+               targs = (char **) xmalloc ((n_args + 3) * sizeof (args[0]));
                targs[0] = "sh";
-               targs[1] = xstrdup (shellstr);
-               targs[n_args+1] = NULL;
+               targs[1] = "-";
+               targs[2] = xstrdup (shellstr);
+               targs[n_args+2] = NULL;
                while (1 != n_args) {
-                       targs[n_args] = args[n_args - 1];
+                       targs[n_args+1] = args[n_args - 1];
                        n_args--;
                }