mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-03 15:55:40 +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:
@@ -41,6 +41,9 @@
|
|||||||
void
|
void
|
||||||
audit_success(char *exec_args[])
|
audit_success(char *exec_args[])
|
||||||
{
|
{
|
||||||
|
if (exec_args == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
#ifdef HAVE_BSM_AUDIT
|
#ifdef HAVE_BSM_AUDIT
|
||||||
bsm_audit_success(exec_args);
|
bsm_audit_success(exec_args);
|
||||||
#endif
|
#endif
|
||||||
@@ -50,10 +53,13 @@ audit_success(char *exec_args[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
audit_failure(char **exec_args, char const *const fmt, ...)
|
audit_failure(char *exec_args[], char const *const fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
if (exec_args == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
#ifdef HAVE_BSM_AUDIT
|
#ifdef HAVE_BSM_AUDIT
|
||||||
bsm_audit_failure(exec_args, fmt, ap);
|
bsm_audit_failure(exec_args, fmt, ap);
|
||||||
|
@@ -1066,12 +1066,10 @@ set_runaspw(char *user)
|
|||||||
if ((runas_pw = sudo_getpwuid(atoi(user + 1))) == NULL)
|
if ((runas_pw = sudo_getpwuid(atoi(user + 1))) == NULL)
|
||||||
runas_pw = sudo_fakepwnam(user, runas_gr ? runas_gr->gr_gid : 0);
|
runas_pw = sudo_fakepwnam(user, runas_gr ? runas_gr->gr_gid : 0);
|
||||||
} else {
|
} else {
|
||||||
if ((runas_pw = sudo_getpwnam(user)) == NULL) {
|
if ((runas_pw = sudo_getpwnam(user)) == NULL)
|
||||||
audit_failure(NewArgv, _("unknown user: %s"), user);
|
|
||||||
log_error(NO_MAIL|MSG_ONLY, _("unknown user: %s"), user);
|
log_error(NO_MAIL|MSG_ONLY, _("unknown user: %s"), user);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get group entry for the group we are going to run commands as
|
* Get group entry for the group we are going to run commands as
|
||||||
|
Reference in New Issue
Block a user