]> granicus.if.org Git - sudo/commitdiff
Make "sudo -l non_existent_command" warn that non_existent_command
authorTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 20 Feb 2013 20:35:26 +0000 (15:35 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Wed, 20 Feb 2013 20:35:26 +0000 (15:35 -0500)
doesn't exist, not the "list" pseudo-command.

plugins/sudoers/sudoers.c

index 0c70ecce491e8b39d261e5e23451d1d2af8b162e..d116db2e27cd2b75257822deeee54c8bf0e35477 100644 (file)
@@ -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;
     }