Add runas_user and runas_group (if set) to command_info for audit plugin.
Otherwise, the audit plugin has to look up the runas name and group by user or group ID.
This commit is contained in:
@@ -564,7 +564,7 @@ sudoers_policy_exec_setup(char *argv[], char *envp[], mode_t cmnd_umask,
|
|||||||
debug_return_bool(true); /* nothing to do */
|
debug_return_bool(true); /* nothing to do */
|
||||||
|
|
||||||
/* Increase the length of command_info as needed, it is *not* checked. */
|
/* Increase the length of command_info as needed, it is *not* checked. */
|
||||||
command_info = calloc(50, sizeof(char *));
|
command_info = calloc(52, sizeof(char *));
|
||||||
if (command_info == NULL)
|
if (command_info == NULL)
|
||||||
goto oom;
|
goto oom;
|
||||||
|
|
||||||
@@ -620,6 +620,12 @@ sudoers_policy_exec_setup(char *argv[], char *envp[], mode_t cmnd_umask,
|
|||||||
if ((command_info[info_len++] = sudo_new_key_val("cwd", runas_pw->pw_dir)) == NULL)
|
if ((command_info[info_len++] = sudo_new_key_val("cwd", runas_pw->pw_dir)) == NULL)
|
||||||
goto oom;
|
goto oom;
|
||||||
}
|
}
|
||||||
|
if ((command_info[info_len++] = sudo_new_key_val("runas_user", runas_pw->pw_name)) == NULL)
|
||||||
|
goto oom;
|
||||||
|
if (runas_gr != NULL) {
|
||||||
|
if ((command_info[info_len++] = sudo_new_key_val("runas_group", runas_gr->gr_name)) == NULL)
|
||||||
|
goto oom;
|
||||||
|
}
|
||||||
if (def_stay_setuid) {
|
if (def_stay_setuid) {
|
||||||
if (asprintf(&command_info[info_len++], "runas_uid=%u",
|
if (asprintf(&command_info[info_len++], "runas_uid=%u",
|
||||||
(unsigned int)user_uid) == -1)
|
(unsigned int)user_uid) == -1)
|
||||||
|
Reference in New Issue
Block a user