From: Todd C. Miller Date: Tue, 25 Jun 1996 23:32:09 +0000 (+0000) Subject: now set uid to 1 instead of nobody for PERM_SUDOERS since nobody X-Git-Tag: SUDO_1_5_0~133 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0ac88016c43567cc3ec4b73495cfe425728c827b;p=sudo now set uid to 1 instead of nobody for PERM_SUDOERS since nobody is not always set to a valid uid. --- diff --git a/sudo.c b/sudo.c index 39ae5b632..4e5aa8a24 100644 --- a/sudo.c +++ b/sudo.c @@ -893,19 +893,17 @@ void set_perms(perm) /* * If SUDOERS_UID == 0 we need to use * a different uid in order to avoid - * NFS lossage. Sigh. + * NFS lossage. Using uid 1 is a bit + * bogus but should be safe. */ - if (SUDOERS_UID) { - if (seteuid(SUDOERS_UID)) { - perror("seteuid(SUDOERS_UID)"); + if (SUDOERS_UID == 0) { + if (seteuid(1)) { + perror("seteuid(1)"); exit(1); } } else { - if (!(pw_ent = getpwnam("nobody"))) - pw_ent->pw_uid = (uid_t) -2; - - if (seteuid(pw_ent->pw_uid)) { - perror("seteuid(nobody)"); + if (seteuid(SUDOERS_UID)) { + perror("seteuid(SUDOERS_UID)"); exit(1); } }