]> granicus.if.org Git - sudo/commitdiff
Use setresuid() and setreuid() for PERM_RUNAS when appropriate instead
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 6 Feb 2004 19:52:17 +0000 (19:52 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 6 Feb 2004 19:52:17 +0000 (19:52 +0000)
of seteuid() which may not exist.

set_perms.c

index 590e01822dd7dd043ae40ab9037872e9ba96365b..8d9e47b00185187913e15aacf80f02e4a17adb9c 100644 (file)
@@ -197,7 +197,7 @@ set_perms_suid(perm)
                                break;
                                
        case PERM_RUNAS:
-                               if (seteuid(runas_pw->pw_uid))
+                               if (setresuid(-1, runas_pw->pw_uid, -1))
                                    fatal("unable to change to runas uid", 1);
                                break;
 
@@ -274,7 +274,7 @@ set_perms_suid(perm)
                                break;
                                
        case PERM_RUNAS:
-                               if (seteuid(runas_pw->pw_uid))
+                               if (setreuid(-1, runas_pw->pw_uid))
                                    fatal("unable to change to runas uid", 1);
                                break;