From: Todd C. Miller Date: Fri, 30 Mar 2012 16:30:36 +0000 (-0400) Subject: Use normal error path if unable to set sudoers gid. X-Git-Tag: SUDO_1_7_9p1~26 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8d042a63c598e3df96e59f3701c39d4e9e97fea1;p=sudo Use normal error path if unable to set sudoers gid. --HG-- branch : 1.7 --- diff --git a/set_perms.c b/set_perms.c index 355baad55..719b7b81d 100644 --- a/set_perms.c +++ b/set_perms.c @@ -141,8 +141,10 @@ set_perms(perm) case PERM_SUDOERS: /* assume euid == ROOT_UID, ruid == user */ - if (setresgid(-1, SUDOERS_GID, -1)) - error(1, "unable to change to sudoers gid"); + if (setresgid(-1, SUDOERS_GID, -1)) { + errstr = "unable to change to sudoers gid"; + goto bad; + } /* * If SUDOERS_UID == ROOT_UID and SUDOERS_MODE @@ -258,8 +260,10 @@ set_perms(perm) case PERM_SUDOERS: /* assume euid == ROOT_UID, ruid == user */ - if (setregid(-1, SUDOERS_GID)) - error(1, "unable to change to sudoers gid"); + if (setregid(-1, SUDOERS_GID)) { + errstr = "unable to change to sudoers gid"; + goto bad; + } /* * If SUDOERS_UID == ROOT_UID and SUDOERS_MODE @@ -377,8 +381,10 @@ set_perms(perm) break; case PERM_SUDOERS: - if (setegid(SUDOERS_GID)) - error(1, "unable to change to sudoers gid"); + if (setegid(SUDOERS_GID)) { + errstr = "unable to change to sudoers gid"; + goto bad; + } /* * If SUDOERS_UID == ROOT_UID and SUDOERS_MODE