Change euid to runas user before calling find_path(). Unfortunately,
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 17 Jan 2004 21:34:05 +0000 (21:34 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 17 Jan 2004 21:34:05 +0000 (21:34 +0000)
though runas_user can be modified in sudoers we haven't parsed sudoers yet.

sudo.c

diff --git a/sudo.c b/sudo.c
index 51c66a636f0fcda07db348713ee0d66acf37c208..ee762a1a4aca8eed816decd9fd50f5fdb9af7d84 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -572,8 +572,10 @@ init_vars(sudo_mode)
 
     /* Resolve the path and return. */
     if ((sudo_mode & MODE_RUN)) {
-       /* XXX - should call this as runas user, not root. */
+       /* XXX - default_runas may be modified during parsing of sudoers */
+       set_perms(PERM_RUNAS);
        rval = find_path(NewArgv[0], &user_cmnd, user_path);
+       set_perms(PERM_ROOT);
        if (rval != FOUND) {
            /* Failed as root, try as invoking user. */
            set_perms(PERM_USER);