]> granicus.if.org Git - shadow/commitdiff
* configure.in, libmisc/shell.c, libmisc/setupenv.c, src/newgrp.c,
authornekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Wed, 22 Jul 2009 13:30:06 +0000 (13:30 +0000)
committernekral-guest <nekral-guest@5a98b0ae-9ef6-0310-add3-de5d479b70d7>
Wed, 22 Jul 2009 13:30:06 +0000 (13:30 +0000)
src/su.c: Let the system shell be configurable.

ChangeLog
configure.in
libmisc/setupenv.c
libmisc/shell.c
src/newgrp.c
src/su.c

index aafef32295afaf881c931e307d5be820c5265c0b..caa4f095ece5fb6035ac5c2d4999d45469bb4d00 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-07-22  Nicolas François  <nicolas.francois@centraliens.net>
+
+       * configure.in, libmisc/shell.c, libmisc/setupenv.c, src/newgrp.c,
+       src/su.c: Let the system shell be configurable.
+
 2009-07-20  Nicolas François  <nicolas.francois@centraliens.net>
 
        * NEWS, src/su.c, libmisc/shell.c: Added support for shells being a
index 0be585b7d3ecafc894b1b550620d56d3087aa14b..861356b3061cb2bcb0e26c3b9c7508796d575f9f 100644 (file)
@@ -491,6 +491,8 @@ if test "$enable_utmpx" = "yes"; then
                  [Define if utmpx should be used])
 fi
 
+AC_DEFINE_UNQUOTED(SHELL, [$SHELL], [The default shell.])
+
 AM_GNU_GETTEXT_VERSION(0.16)
 AM_GNU_GETTEXT([external], [need-ngettext])
 AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
index 693881369e2d0e13f29e86fe8321d79da2be4e2b..7d6f7dea2421b3eeca8f09145390050c4c1845d4 100644 (file)
@@ -242,7 +242,7 @@ void setup_env (struct passwd *info)
         */
 
        if ((NULL == info->pw_shell) || ('\0' == *info->pw_shell)) {
-               static char temp_pw_shell[] = "/bin/sh";
+               static char temp_pw_shell[] = SHELL;
 
                info->pw_shell = temp_pw_shell;
        }
index 2dd3bb25aba6dbaf853882d85b31e99b84344a2f..4e70505ae0ab2a46484acdc8d070759888443208 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 ("/bin/sh", "sh", file, (char *)0, envp);
+               execle (SHELL, "sh", file, (char *)0, envp);
                err = errno;
        }
 
index e4ea4115eba2bcef1c9a163398acbb27067a0bca..3a03a65c5ad047122b8b8385114612089bc0ba19 100644 (file)
@@ -722,7 +722,7 @@ int main (int argc, char **argv)
         */
        if (cflag) {
                closelog ();
-               execl ("/bin/sh", "sh", "-c", command, (char *) 0);
+               execl (SHELL, "sh", "-c", command, (char *) 0);
 #ifdef WITH_AUDIT
                snprintf (audit_buf, sizeof(audit_buf),
                          "changing new-gid=%lu", (unsigned long) gid);
@@ -730,7 +730,7 @@ int main (int argc, char **argv)
                              audit_buf, NULL,
                              (unsigned int) getuid (), 0);
 #endif
-               perror ("/bin/sh");
+               perror (SHELL);
                exit ((errno == ENOENT) ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
        }
 
@@ -757,7 +757,7 @@ int main (int argc, char **argv)
        } else if ((NULL != pwd->pw_shell) && ('\0' != pwd->pw_shell[0])) {
                prog = pwd->pw_shell;
        } else {
-               prog = "/bin/sh";
+               prog = SHELL;
        }
 
        /*
index 3e87425e72eeb8f06ac328ba37f6d789260c6415..c6772a76fb636c6477a56de10db616a708b98c3a 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -203,7 +203,7 @@ void execve_shell (const char *shellstr, char *args[], char *const envp[])
                        n_args--;
                }
 
-               (void) execve ("/bin/sh", targs, envp);
+               (void) execve (SHELL, targs, envp);
        } else {
                errno = err;
        }
@@ -724,7 +724,7 @@ int main (int argc, char **argv)
         * Set the default shell.
         */
        if ((NULL == shellstr) || ('\0' == shellstr[0])) {
-               shellstr = "/bin/sh";
+               shellstr = SHELL;
        }
 
        (void) signal (SIGINT, SIG_IGN);