aboutsummaryrefslogtreecommitdiff
path: root/loginutils
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
parent56244736ec7d0a3c338f542204aae83fb0200346 (diff)
downloadbusybox-w32-c9ca0a32745a43eaa6cb6b7b460718de8ccb84f2.tar.gz
busybox-w32-c9ca0a32745a43eaa6cb6b7b460718de8ccb84f2.tar.bz2
busybox-w32-c9ca0a32745a43eaa6cb6b7b460718de8ccb84f2.zip
mount: recognize "dirsync" (closes bug 835)
mount: sanitize environ if called by non-root *: adjust for slightly different sanitize routine
Diffstat (limited to 'loginutils')
-rw-r--r--loginutils/login.c9
-rw-r--r--loginutils/sulogin.c2
2 files changed, 4 insertions, 7 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)
254 254
255 short_tty = full_tty; 255 short_tty = full_tty;
256 username[0] = '\0'; 256 username[0] = '\0';
257 amroot = (getuid() == 0);
258 signal(SIGALRM, alarm_handler); 257 signal(SIGALRM, alarm_handler);
259 alarm(TIMEOUT); 258 alarm(TIMEOUT);
260 259
260 /* More of suid paranoia if called by non-root */
261 amroot = !sanitize_env_if_suid(); /* Clear dangerous stuff, set PATH */
262
261 /* Mandatory paranoia for suid applet: 263 /* Mandatory paranoia for suid applet:
262 * ensure that fd# 0,1,2 are opened (at least to /dev/null) 264 * ensure that fd# 0,1,2 are opened (at least to /dev/null)
263 * and any extra open fd's are closed. 265 * and any extra open fd's are closed.
264 * (The name of the function is misleading. Not daemonizing here.) */ 266 * (The name of the function is misleading. Not daemonizing here.) */
265 bb_daemonize_or_rexec(DAEMON_ONLY_SANITIZE | DAEMON_CLOSE_EXTRA_FDS, NULL); 267 bb_daemonize_or_rexec(DAEMON_ONLY_SANITIZE | DAEMON_CLOSE_EXTRA_FDS, NULL);
266 /* More of suid paranoia if called by non-root */
267 if (!amroot) {
268 /* Clear dangerous stuff, set PATH */
269 sanitize_env_for_suid();
270 }
271 268
272 opt = getopt32(argv, "f:h:p", &opt_user, &opt_host); 269 opt = getopt32(argv, "f:h:p", &opt_user, &opt_host);
273 if (opt & LOGIN_OPT_f) { 270 if (opt & LOGIN_OPT_f) {
diff --git a/loginutils/sulogin.c b/loginutils/sulogin.c
index faa93eaea..3a1a8e9f5 100644
--- a/loginutils/sulogin.c
+++ b/loginutils/sulogin.c
@@ -49,7 +49,7 @@ int sulogin_main(int argc, char **argv)
49 } 49 }
50 50
51 /* Clear dangerous stuff, set PATH */ 51 /* Clear dangerous stuff, set PATH */
52 sanitize_env_for_suid(); 52 sanitize_env_if_suid();
53 53
54// bb_askpass() already handles this 54// bb_askpass() already handles this
55// signal(SIGALRM, catchalarm); 55// signal(SIGALRM, catchalarm);