mirror of https://github.com/MISP/MISP
chg: try to get user via posix method first
parent
30bb52d705
commit
69a69e6e10
|
@ -55,7 +55,7 @@ class StartWorkerShell extends AppShell
|
|||
[
|
||||
'pid' => getmypid(),
|
||||
'queue' => $this->args[0],
|
||||
'user' => trim(shell_exec('whoami'))
|
||||
'user' => $this->whoami()
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -97,4 +97,13 @@ class StartWorkerShell extends AppShell
|
|||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
private function whoami(): string
|
||||
{
|
||||
if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
|
||||
return posix_getpwuid(posix_geteuid())['name'];
|
||||
} else {
|
||||
return trim(shell_exec('whoami'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue