diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2017-07-26 15:40:55 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2017-07-26 15:40:55 -0300 |
commit | 543d65c6ab767a53844c28d9e887440dec90da1c (patch) | |
tree | 8f3dd30712aca174dd621f21e35e07a99164db70 /EnvScreen.c | |
parent | f205f7004c2530a499175ad240e0d83e484a0961 (diff) |
Security review: make privilege dropping-restoring optional.
This is/was necessary only on macOS, because you needed root in order
to read the process list. This was never necessary on Linux, and
it also raises security concerns, so now it needs to be enabled
explicitly at build time.
Diffstat (limited to 'EnvScreen.c')
-rw-r--r-- | EnvScreen.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/EnvScreen.c b/EnvScreen.c index 06f329c1..855023a4 100644 --- a/EnvScreen.c +++ b/EnvScreen.c @@ -48,10 +48,9 @@ void EnvScreen_scan(InfoScreen* this) { Panel_prune(panel); - uid_t euid = geteuid(); - (void) seteuid(getuid()); - char *env = Platform_getProcessEnv(this->process->pid); - (void) seteuid(euid); + CRT_dropPrivileges(); + char* env = Platform_getProcessEnv(this->process->pid); + CRT_restorePrivileges(); if (env) { for (char *p = env; *p; p = strrchr(p, 0)+1) InfoScreen_addLine(this, p); |