mirror of
https://github.com/slicer69/doas
synced 2024-09-06 08:32:00 +00:00
Made sure when running as the effective user root (euid is zero) we actually become
uid 0 in order to avoid file system permission errors/restrictions.
This commit is contained in:
parent
47b4ab919a
commit
4b32171218
5
doas.c
5
doas.c
|
@ -526,6 +526,11 @@ main(int argc, char **argv)
|
|||
dup2(temp_stdout, 1);
|
||||
#endif
|
||||
|
||||
/* If we effectively root, set the UID to actually be root to avoid
|
||||
permission errors. */
|
||||
if ( geteuid() == ROOT_UID )
|
||||
setuid(ROOT_UID);
|
||||
|
||||
syslog(LOG_AUTHPRIV | LOG_INFO, "%s ran command %s as %s from %s",
|
||||
myname, cmdline, pw->pw_name, cwd);
|
||||
|
||||
|
|
Loading…
Reference in a new issue