]> granicus.if.org Git - sudo/commitdiff
Use normal error path if unable to set sudoers gid.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 30 Mar 2012 16:30:36 +0000 (12:30 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 30 Mar 2012 16:30:36 +0000 (12:30 -0400)
--HG--
branch : 1.7

set_perms.c

index 355baad555b4483fa7ddc2df55b0bf7d54cc1db4..719b7b81dd39bba8d4b26b5afdae34b9deaca9a8 100644 (file)
@@ -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