* configure.in, libmisc/shell.c, libmisc/setupenv.c, src/newgrp.c,
src/su.c: Let the system shell be configurable.
This commit is contained in:
parent
4ad827768e
commit
db38a728d1
@ -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>
|
2009-07-20 Nicolas François <nicolas.francois@centraliens.net>
|
||||||
|
|
||||||
* NEWS, src/su.c, libmisc/shell.c: Added support for shells being a
|
* NEWS, src/su.c, libmisc/shell.c: Added support for shells being a
|
||||||
|
@ -491,6 +491,8 @@ if test "$enable_utmpx" = "yes"; then
|
|||||||
[Define if utmpx should be used])
|
[Define if utmpx should be used])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_DEFINE_UNQUOTED(SHELL, [$SHELL], [The default shell.])
|
||||||
|
|
||||||
AM_GNU_GETTEXT_VERSION(0.16)
|
AM_GNU_GETTEXT_VERSION(0.16)
|
||||||
AM_GNU_GETTEXT([external], [need-ngettext])
|
AM_GNU_GETTEXT([external], [need-ngettext])
|
||||||
AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
|
AM_CONDITIONAL(USE_NLS, test "x$USE_NLS" = "xyes")
|
||||||
|
@ -242,7 +242,7 @@ void setup_env (struct passwd *info)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if ((NULL == info->pw_shell) || ('\0' == *info->pw_shell)) {
|
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;
|
info->pw_shell = temp_pw_shell;
|
||||||
}
|
}
|
||||||
|
@ -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).
|
* Assume this is a shell script (with no shebang).
|
||||||
* Interpret it with /bin/sh
|
* Interpret it with /bin/sh
|
||||||
*/
|
*/
|
||||||
execle ("/bin/sh", "sh", file, (char *)0, envp);
|
execle (SHELL, "sh", file, (char *)0, envp);
|
||||||
err = errno;
|
err = errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -722,7 +722,7 @@ int main (int argc, char **argv)
|
|||||||
*/
|
*/
|
||||||
if (cflag) {
|
if (cflag) {
|
||||||
closelog ();
|
closelog ();
|
||||||
execl ("/bin/sh", "sh", "-c", command, (char *) 0);
|
execl (SHELL, "sh", "-c", command, (char *) 0);
|
||||||
#ifdef WITH_AUDIT
|
#ifdef WITH_AUDIT
|
||||||
snprintf (audit_buf, sizeof(audit_buf),
|
snprintf (audit_buf, sizeof(audit_buf),
|
||||||
"changing new-gid=%lu", (unsigned long) gid);
|
"changing new-gid=%lu", (unsigned long) gid);
|
||||||
@ -730,7 +730,7 @@ int main (int argc, char **argv)
|
|||||||
audit_buf, NULL,
|
audit_buf, NULL,
|
||||||
(unsigned int) getuid (), 0);
|
(unsigned int) getuid (), 0);
|
||||||
#endif
|
#endif
|
||||||
perror ("/bin/sh");
|
perror (SHELL);
|
||||||
exit ((errno == ENOENT) ? E_CMD_NOTFOUND : E_CMD_NOEXEC);
|
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])) {
|
} else if ((NULL != pwd->pw_shell) && ('\0' != pwd->pw_shell[0])) {
|
||||||
prog = pwd->pw_shell;
|
prog = pwd->pw_shell;
|
||||||
} else {
|
} else {
|
||||||
prog = "/bin/sh";
|
prog = SHELL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
4
src/su.c
4
src/su.c
@ -203,7 +203,7 @@ void execve_shell (const char *shellstr, char *args[], char *const envp[])
|
|||||||
n_args--;
|
n_args--;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) execve ("/bin/sh", targs, envp);
|
(void) execve (SHELL, targs, envp);
|
||||||
} else {
|
} else {
|
||||||
errno = err;
|
errno = err;
|
||||||
}
|
}
|
||||||
@ -724,7 +724,7 @@ int main (int argc, char **argv)
|
|||||||
* Set the default shell.
|
* Set the default shell.
|
||||||
*/
|
*/
|
||||||
if ((NULL == shellstr) || ('\0' == shellstr[0])) {
|
if ((NULL == shellstr) || ('\0' == shellstr[0])) {
|
||||||
shellstr = "/bin/sh";
|
shellstr = SHELL;
|
||||||
}
|
}
|
||||||
|
|
||||||
(void) signal (SIGINT, SIG_IGN);
|
(void) signal (SIGINT, SIG_IGN);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user