]> granicus.if.org Git - sudo/commitdiff
Error out when targetpw is enabled and sudo is run with -u #uid but
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 6 Aug 2004 23:24:41 +0000 (23:24 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 6 Aug 2004 23:24:41 +0000 (23:24 +0000)
#uid does not exist in the passwd database.  We can't do target
authentication when the target is not in passwd!

sudo.c

diff --git a/sudo.c b/sudo.c
index 13a5443e7b17d1e0d5185d93c6cb924fc5de25da..7c22afcc5edffba14beb7b996ab966c9d1796f25 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -1072,9 +1072,12 @@ get_authpw()
        else if ((pw = sudo_getpwnam(def_runas_default)) == NULL)
            log_error(0, "user %s does not exist in the passwd file!",
                def_runas_default);
-    } else if (def_targetpw)
+    } else if (def_targetpw) {
+       if (runas_pw->pw_name == NULL)
+           log_error(0, "user %lu does not exist in the passwd file!",
+               runas_pw->pw_uid);
        pw = runas_pw;
-    else
+    else
        pw = sudo_user.pw;
 
     return(pw);