Defer lookup of runas user until sudoers_main() for better logging.

The log message now includes user info and the command attempted.
This commit is contained in:
Todd C. Miller
2020-12-04 13:49:37 -07:00
parent 567e5167d1
commit fd39e2d7d6
2 changed files with 18 additions and 18 deletions

View File

@@ -657,7 +657,7 @@ sudoers_to_eventlog(struct eventlog *evlog, char * const argv[],
memset(evlog, 0, sizeof(*evlog));
/* TODO: iolog_path */
evlog->iolog_file = sudo_user.iolog_file;
evlog->command = safe_cmnd;
evlog->command = safe_cmnd ? safe_cmnd : (argv ? argv[0] : NULL);
evlog->cwd = user_cwd;
if (def_runchroot != NULL && strcmp(def_runchroot, "*") != 0) {
evlog->runchroot = def_runchroot;