Fix "sudo -l command args", broken in sudo 1.9.13.

The value of user_args should not contain the command to be run in
"sudo -l command args", only the arguments of the command being checked.
This restores the pre-1.9.13 behavior.  GitHub issue #249
This commit is contained in:
Todd C. Miller
2023-03-03 11:12:18 -07:00
parent b013711e48
commit d9e9307d98
3 changed files with 13 additions and 6 deletions

View File

@@ -322,9 +322,9 @@ log_denial(int status, bool inform_user)
"sudo on %s.\n"), user_name, user_srunhost);
} else {
sudo_printf(SUDO_CONV_ERROR_MSG, _("Sorry, user %s is not allowed "
"to execute '%s%s%s' as %s%s%s on %s.\n"),
user_name, user_cmnd, user_args ? " " : "",
user_args ? user_args : "",
"to execute '%s%s%s%s' as %s%s%s on %s.\n"),
user_name, user_cmnd, list_cmnd ? list_cmnd : "",
user_args ? " " : "", user_args ? user_args : "",
list_pw ? list_pw->pw_name : runas_pw ?
runas_pw->pw_name : user_name, runas_gr ? ":" : "",
runas_gr ? runas_gr->gr_name : "", user_host);