diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-18 11:08:33 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-02-18 11:08:33 +0000 |
commit | c9ca0a32745a43eaa6cb6b7b460718de8ccb84f2 (patch) | |
tree | 2b4bdf035b3a3c0436ce823e137d969af4d3a06f /libbb | |
parent | 56244736ec7d0a3c338f542204aae83fb0200346 (diff) | |
download | busybox-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 'libbb')
-rw-r--r-- | libbb/login.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libbb/login.c b/libbb/login.c index 1af3165b9..d1f5d6498 100644 --- a/libbb/login.c +++ b/libbb/login.c | |||
@@ -116,12 +116,19 @@ static const char forbid[] ALIGN1 = | |||
116 | "LD_NOWARN" "\0" | 116 | "LD_NOWARN" "\0" |
117 | "LD_KEEPDIR" "\0"; | 117 | "LD_KEEPDIR" "\0"; |
118 | 118 | ||
119 | void sanitize_env_for_suid(void) | 119 | int sanitize_env_if_suid(void) |
120 | { | 120 | { |
121 | const char *p = forbid; | 121 | const char *p; |
122 | |||
123 | if (getuid() == geteuid()) | ||
124 | return 0; | ||
125 | |||
126 | p = forbid; | ||
122 | do { | 127 | do { |
123 | unsetenv(p); | 128 | unsetenv(p); |
124 | p += strlen(p) + 1; | 129 | p += strlen(p) + 1; |
125 | } while (*p); | 130 | } while (*p); |
126 | putenv((char*)bb_PATH_root_path); | 131 | putenv((char*)bb_PATH_root_path); |
132 | |||
133 | return 1; /* we indeed were run by different user! */ | ||
127 | } | 134 | } |