summaryrefslogtreecommitdiff
path: root/libbb/login.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-02-18 11:08:33 +0000
committerDenis Vlasenko2008-02-18 11:08:33 +0000
commitc9ca0a32745a43eaa6cb6b7b460718de8ccb84f2 (patch)
tree2b4bdf035b3a3c0436ce823e137d969af4d3a06f /libbb/login.c
parent56244736ec7d0a3c338f542204aae83fb0200346 (diff)
downloadbusybox-c9ca0a32745a43eaa6cb6b7b460718de8ccb84f2.zip
busybox-c9ca0a32745a43eaa6cb6b7b460718de8ccb84f2.tar.gz
mount: recognize "dirsync" (closes bug 835)
mount: sanitize environ if called by non-root *: adjust for slightly different sanitize routine
Diffstat (limited to 'libbb/login.c')
-rw-r--r--libbb/login.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libbb/login.c b/libbb/login.c
index 1af3165..d1f5d64 100644
--- a/libbb/login.c
+++ b/libbb/login.c
@@ -116,12 +116,19 @@ static const char forbid[] ALIGN1 =
"LD_NOWARN" "\0"
"LD_KEEPDIR" "\0";
-void sanitize_env_for_suid(void)
+int sanitize_env_if_suid(void)
{
- const char *p = forbid;
+ const char *p;
+
+ if (getuid() == geteuid())
+ return 0;
+
+ p = forbid;
do {
unsetenv(p);
p += strlen(p) + 1;
} while (*p);
putenv((char*)bb_PATH_root_path);
+
+ return 1; /* we indeed were run by different user! */
}