]> granicus.if.org Git - sudo/commitdiff
If find_path() fails as root, try again as the invoking user (useful
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 15 Dec 2001 00:38:06 +0000 (00:38 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 15 Dec 2001 00:38:06 +0000 (00:38 +0000)
for NFS).  Idea from Chip Capelik.

sudo.c

diff --git a/sudo.c b/sudo.c
index b99b780ee95444cc4cc84528c8a4685b13aa4043..376899f52e357eef7e5e9b78bb4b7321fc9d12dd 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -545,6 +545,12 @@ init_vars(sudo_mode)
     /* Resolve the path and return. */
     if ((sudo_mode & MODE_RUN)) {
        rval = find_path(NewArgv[0], &user_cmnd, user_path);
+       if (rval != FOUND) {
+           /* Failed as root, try as invoking user. */
+           set_perms(PERM_USER, sudo_mode);
+           rval = find_path(NewArgv[0], &user_cmnd, user_path);
+           set_perms(PERM_ROOT, sudo_mode);
+       }
 
        /* set user_args */
        if (NewArgc > 1) {