From: Todd C. Miller Date: Sat, 23 Apr 2011 10:13:48 +0000 (-0400) Subject: Be explicit when setting euid to 0 before call to setreuid(0, 0) X-Git-Tag: SUDO_1_8_2~174^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c35601cf3df8f77f07726d1da46c4fa59046dbc;p=sudo Be explicit when setting euid to 0 before call to setreuid(0, 0) --- diff --git a/plugins/sudoers/set_perms.c b/plugins/sudoers/set_perms.c index e8b9f633f..17c87b4a6 100644 --- a/plugins/sudoers/set_perms.c +++ b/plugins/sudoers/set_perms.c @@ -383,9 +383,7 @@ set_perms(int perm) * setreuid(0, 0) may fail on some systems * when the euid is not already 0. */ - state->ruid = -1; - state->euid = ROOT_UID; - if (setreuid(ID(ruid), ID(euid))) { + if (setreuid(-1, ROOT_UID)) { errstr = "setreuid(-1, ROOT_UID)"; goto bad; } @@ -394,6 +392,7 @@ set_perms(int perm) goto bad; } state->ruid = ROOT_UID; + state->euid = ROOT_UID; state->rgid = -1; state->egid = -1; state->groups = NULL;