src/su.c: Let the system shell be configurable.
+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
[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")
*/
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;
}
* 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;
}
*/
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);
audit_buf, NULL,
(unsigned int) getuid (), 0);
#endif
- perror ("/bin/sh");
+ perror (SHELL);
exit ((errno == ENOENT) ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
}
} else if ((NULL != pwd->pw_shell) && ('\0' != pwd->pw_shell[0])) {
prog = pwd->pw_shell;
} else {
- prog = "/bin/sh";
+ prog = SHELL;
}
/*
n_args--;
}
- (void) execve ("/bin/sh", targs, envp);
+ (void) execve (SHELL, targs, envp);
} else {
errno = err;
}
* Set the default shell.
*/
if ((NULL == shellstr) || ('\0' == shellstr[0])) {
- shellstr = "/bin/sh";
+ shellstr = SHELL;
}
(void) signal (SIGINT, SIG_IGN);