]> granicus.if.org Git - sudo/commitdiff
Make this work again on systems w/o seteuid().
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 10 Mar 2012 20:29:46 +0000 (15:29 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 10 Mar 2012 20:29:46 +0000 (15:29 -0500)
plugins/sudoers/set_perms.c

index 6b8780c89a8e88862e6053d987626aaeced77033..32255988afaee6d0d242c091352163f9c413c034 100644 (file)
@@ -1389,7 +1389,7 @@ set_perms(int perm)
     switch (perm) {
     case PERM_INITIAL:
        /* Stash initial state */
-       state->ruid = getuid();
+       state->ruid = geteuid() == ROOT_UID ? ROOT_UID : getuid();
        state->rgid = getgid();
        state->grlist = user_group_list;
        grlist_addref(state->grlist);
@@ -1438,7 +1438,10 @@ set_perms(int perm)
     case PERM_RUNAS:
     case PERM_TIMESTAMP:
        /* Unsupported since we can't set euid. */
-       perm_stack_depth--;
+       state->ruid = ostate->ruid;
+       state->rgid = ostate->rgid;
+       state->grlist = ostate->grlist;
+       grlist_addref(state->grlist);
        break;
     }