Store the source of the matching rule and store in the event log.

The JSON logs will store the matching rule source.
This commit is contained in:
Todd C. Miller
2023-08-08 09:57:09 -06:00
parent 0b03511b85
commit e178b85821
6 changed files with 57 additions and 2 deletions

View File

@@ -668,7 +668,7 @@ sudoers_policy_store_result(bool accepted, char *argv[], char *envp[],
}
/* Increase the length of command_info as needed, it is *not* checked. */
command_info = calloc(73, sizeof(char *));
command_info = calloc(74, sizeof(char *));
if (command_info == NULL)
goto oom;
@@ -1002,6 +1002,11 @@ sudoers_policy_store_result(bool accepted, char *argv[], char *envp[],
if ((command_info[info_len++] = sudo_new_key_val("rlimit_stack", def_rlimit_stack)) == NULL)
goto oom;
}
if (sudo_user.source != NULL) {
command_info[info_len] = sudo_new_key_val("source", sudo_user.source);
if (command_info[info_len++] == NULL)
goto oom;
}
#ifdef HAVE_LOGIN_CAP_H
if (def_use_loginclass) {
if ((command_info[info_len++] = sudo_new_key_val("login_class", login_class)) == NULL)