summaryrefslogtreecommitdiffhomepage
path: root/loginutils/login.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-02-18 11:08:33 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-02-18 11:08:33 +0000
commitc9ca0a32745a43eaa6cb6b7b460718de8ccb84f2 (patch)
tree2b4bdf035b3a3c0436ce823e137d969af4d3a06f /loginutils/login.c
parent56244736ec7d0a3c338f542204aae83fb0200346 (diff)
mount: recognize "dirsync" (closes bug 835)
mount: sanitize environ if called by non-root *: adjust for slightly different sanitize routine
Diffstat (limited to 'loginutils/login.c')
-rw-r--r--loginutils/login.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/loginutils/login.c b/loginutils/login.c
index 55cbfa7cd..a5b6369ff 100644
--- a/loginutils/login.c
+++ b/loginutils/login.c
@@ -254,20 +254,17 @@ int login_main(int argc, char **argv)
short_tty = full_tty;
username[0] = '\0';
- amroot = (getuid() == 0);
signal(SIGALRM, alarm_handler);
alarm(TIMEOUT);
+ /* More of suid paranoia if called by non-root */
+ amroot = !sanitize_env_if_suid(); /* Clear dangerous stuff, set PATH */
+
/* Mandatory paranoia for suid applet:
* ensure that fd# 0,1,2 are opened (at least to /dev/null)
* and any extra open fd's are closed.
* (The name of the function is misleading. Not daemonizing here.) */
bb_daemonize_or_rexec(DAEMON_ONLY_SANITIZE | DAEMON_CLOSE_EXTRA_FDS, NULL);
- /* More of suid paranoia if called by non-root */
- if (!amroot) {
- /* Clear dangerous stuff, set PATH */
- sanitize_env_for_suid();
- }
opt = getopt32(argv, "f:h:p", &opt_user, &opt_host);
if (opt & LOGIN_OPT_f) {