Use run_argv and run_envp passed into the audit plugin for event logging.

Previously we used NewArgv[] and env_get() but now that logging is
performed via an audit plugin we should use the values passed in.
This commit is contained in:
Todd C. Miller
2021-08-09 15:50:25 -06:00
parent 5e3ce532fe
commit 1ae9954c63
3 changed files with 4 additions and 4 deletions

View File

@@ -335,7 +335,7 @@ sudoers_audit_accept(const char *plugin_name, unsigned int plugin_type,
if (audit_success(run_argv) != 0 && !def_ignore_audit_errors) if (audit_success(run_argv) != 0 && !def_ignore_audit_errors)
ret = false; ret = false;
if (!log_allowed() && !def_ignore_logfile_errors) if (!log_allowed(run_argv, run_envp) && !def_ignore_logfile_errors)
ret = false; ret = false;
if (!log_server_accept(command_info, run_argv, run_envp)) { if (!log_server_accept(command_info, run_argv, run_envp)) {

View File

@@ -463,7 +463,7 @@ log_auth_failure(int status, unsigned int tries)
* Log and potentially mail the allowed command. * Log and potentially mail the allowed command.
*/ */
bool bool
log_allowed(void) log_allowed(char *const argv[], char *const envp[])
{ {
struct eventlog evlog; struct eventlog evlog;
int oldlocale; int oldlocale;
@@ -478,7 +478,7 @@ log_allowed(void)
/* Log and mail messages should be in the sudoers locale. */ /* Log and mail messages should be in the sudoers locale. */
sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, &oldlocale); sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, &oldlocale);
sudoers_to_eventlog(&evlog, NewArgv, env_get()); sudoers_to_eventlog(&evlog, argv, envp);
if (mailit) { if (mailit) {
SET(evl_flags, EVLOG_MAIL); SET(evl_flags, EVLOG_MAIL);
if (!def_log_allowed) if (!def_log_allowed)

View File

@@ -56,7 +56,7 @@ bool sudoers_setlocale(int locale_type, int *prev_locale);
int sudoers_getlocale(void); int sudoers_getlocale(void);
int audit_failure(char *const argv[], char const *const fmt, ...) __printflike(2, 3); int audit_failure(char *const argv[], char const *const fmt, ...) __printflike(2, 3);
int vaudit_failure(char *const argv[], char const *const fmt, va_list ap) __printflike(2, 0); int vaudit_failure(char *const argv[], char const *const fmt, va_list ap) __printflike(2, 0);
bool log_allowed(void); bool log_allowed(char *const argv[], char *const envp[]);
bool log_exit_status(int exit_status); bool log_exit_status(int exit_status);
bool log_auth_failure(int status, unsigned int tries); bool log_auth_failure(int status, unsigned int tries);
bool log_denial(int status, bool inform_user); bool log_denial(int status, bool inform_user);