summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-03-12 15:52:06 +0100
committerLennart Poettering <lennart@poettering.net>2019-03-12 16:10:55 +0100
commitb2a3953f817d8db15393e30d1f46e4fa85fcf23a (patch)
tree98900e5bce49ed243b8af16bc936505caba146e4 /src
parentexecute: no need to synthesize $HOME for uid==0 again, get_home_dir() already... (diff)
downloadsystemd-b2a3953f817d8db15393e30d1f46e4fa85fcf23a.tar.xz
systemd-b2a3953f817d8db15393e30d1f46e4fa85fcf23a.zip
user-util: extra paranoia, make sure $SHELL can't be fucked with in suid programs
It's better to be safe than sorry, let's not allow overriding of the user shell in suid binaries. Similar for $USER.
Diffstat (limited to 'src')
-rw-r--r--src/basic/user-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/basic/user-util.c b/src/basic/user-util.c
index 5f1bd5f5a2..a479590e47 100644
--- a/src/basic/user-util.c
+++ b/src/basic/user-util.c
@@ -80,7 +80,7 @@ char* getlogname_malloc(void) {
char *getusername_malloc(void) {
const char *e;
- e = getenv("USER");
+ e = secure_getenv("USER");
if (e)
return strdup(e);
@@ -514,7 +514,7 @@ int get_shell(char **_s) {
assert(_s);
/* Take the user specified one */
- e = getenv("SHELL");
+ e = secure_getenv("SHELL");
if (e && path_is_valid(e) && path_is_absolute(e)) {
s = strdup(e);
if (!s)