From: Todd C. Miller Date: Wed, 20 Feb 2013 20:35:26 +0000 (-0500) Subject: Make "sudo -l non_existent_command" warn that non_existent_command X-Git-Tag: SUDO_1_8_7~1^2~217 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=29becec0e75ed1524921645f8d6d0944b22c3062;p=sudo Make "sudo -l non_existent_command" warn that non_existent_command doesn't exist, not the "list" pseudo-command. --- diff --git a/plugins/sudoers/sudoers.c b/plugins/sudoers/sudoers.c index 0c70ecce4..d116db2e2 100644 --- a/plugins/sudoers/sudoers.c +++ b/plugins/sudoers/sudoers.c @@ -384,8 +384,13 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[], warningx(_("ignoring `%s' found in '.'\nUse `sudo ./%s' if this is the `%s' you wish to run."), user_cmnd, user_cmnd, user_cmnd); goto bad; } else if (cmnd_status == NOT_FOUND) { - audit_failure(NewArgv, N_("%s: command not found"), user_cmnd); - warningx(_("%s: command not found"), user_cmnd); + if (ISSET(sudo_mode, MODE_CHECK)) { + audit_failure(NewArgv, N_("%s: command not found"), NewArgv[0]); + warningx(_("%s: command not found"), NewArgv[0]); + } else { + audit_failure(NewArgv, N_("%s: command not found"), user_cmnd); + warningx(_("%s: command not found"), user_cmnd); + } goto bad; }