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.
This commit is contained in:
Hisham Muhammad
2017-07-26 15:40:55 -03:00
parent f205f7004c
commit 543d65c6ab
7 changed files with 92 additions and 21 deletions

View File

@ -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);