Rename PERM_RUNAS -> PERM_FULL_RUNAS and add a PERM_RUNAS that just
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 16 Jan 2004 23:05:47 +0000 (23:05 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 16 Jan 2004 23:05:47 +0000 (23:05 +0000)
changes the euid.

set_perms.c
sudo.h

index 0b4e9455c49e28fdafd8c10c1d2bb0a1d75ac982..8126fedcf84381bc7f34b924a9c6306189e2ac11 100644 (file)
@@ -119,6 +119,11 @@ set_perms_posix(perm)
                                break;
                                
        case PERM_RUNAS:
+                               if (seteuid(runas_pw->pw_uid))
+                                   fatal("unable to change to runas uid", 1);
+                               break;
+
+       case PERM_FULL_RUNAS:
                                /* headed for exec(), assume euid == 0 */
                                runas_setup();
                                if (def_stay_setuid)
@@ -192,6 +197,11 @@ set_perms_suid(perm)
                                break;
                                
        case PERM_RUNAS:
+                               if (seteuid(runas_pw->pw_uid))
+                                   fatal("unable to change to runas uid", 1);
+                               break;
+
+       case PERM_FULL_RUNAS:
                                /* headed for exec(), assume euid == 0 */
                                runas_setup();
                                error = setresuid(def_stay_setuid ?
@@ -264,6 +274,11 @@ set_perms_suid(perm)
                                break;
                                
        case PERM_RUNAS:
+                               if (seteuid(runas_pw->pw_uid))
+                                   fatal("unable to change to runas uid", 1);
+                               break;
+
+       case PERM_FULL_RUNAS:
                                /* headed for exec(), assume euid == 0 */
                                runas_setup();
                                error = setreuid(def_stay_setuid ?
@@ -333,6 +348,11 @@ set_perms_nosuid(perm)
                                break;
                                
        case PERM_RUNAS:
+                               if (seteuid(runas_pw->pw_uid))
+                                   fatal("unable to change to runas uid", 1);
+                               break;
+
+       case PERM_FULL_RUNAS:
                                /* headed for exec(), assume euid == 0 */
                                runas_setup();
                                if (setuid(runas_pw->pw_uid))
diff --git a/sudo.h b/sudo.h
index cc919d79b73db17c3f0dcbb3be612961612e7e2c..ce23bfb8c0762478027232738ef5aec7e0e4b0e7 100644 (file)
--- a/sudo.h
+++ b/sudo.h
@@ -122,7 +122,8 @@ struct sudo_user {
 #define PERM_FULL_USER           0x03
 #define PERM_SUDOERS             0x04
 #define PERM_RUNAS               0x05
-#define PERM_TIMESTAMP           0x06
+#define PERM_FULL_RUNAS          0x06
+#define PERM_TIMESTAMP           0x07
 
 /*
  * Shortcuts for sudo_user contents.