From 0ac88016c43567cc3ec4b73495cfe425728c827b Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 25 Jun 1996 23:32:09 +0000 Subject: [PATCH] now set uid to 1 instead of nobody for PERM_SUDOERS since nobody is not always set to a valid uid. --- sudo.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) 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); } } -- 2.40.0