From: Todd C. Miller <Todd.Miller@courtesan.com> Date: Fri, 6 Aug 2004 23:24:41 +0000 (+0000) Subject: Error out when targetpw is enabled and sudo is run with -u #uid but X-Git-Tag: SUDO_1_6_8~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=252093fa60f6f56563910a606743de4e9dc00063;p=sudo Error out when targetpw is enabled and sudo is run with -u #uid but #uid does not exist in the passwd database. We can't do target authentication when the target is not in passwd! --- diff --git a/sudo.c b/sudo.c index 13a5443e7..7c22afcc5 100644 --- 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);