2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 06:15:37 +00:00

Don't try to audit failure if the runas user does not exist. We don't

have the user's command at this point so there is nothing to audit.
Add a NULL check in audit_success() and audit_failure() just to be
on the safe side.
This commit is contained in:
Todd C. Miller
2011-07-27 12:11:33 -04:00
parent 8ebf7a95cf
commit 35d26ae34f
2 changed files with 8 additions and 4 deletions

View File

@@ -1066,10 +1066,8 @@ set_runaspw(char *user)
if ((runas_pw = sudo_getpwuid(atoi(user + 1))) == NULL)
runas_pw = sudo_fakepwnam(user, runas_gr ? runas_gr->gr_gid : 0);
} else {
if ((runas_pw = sudo_getpwnam(user)) == NULL) {
audit_failure(NewArgv, _("unknown user: %s"), user);
if ((runas_pw = sudo_getpwnam(user)) == NULL)
log_error(NO_MAIL|MSG_ONLY, _("unknown user: %s"), user);
}
}
}