diff --git a/plugins/sudoers/audit.c b/plugins/sudoers/audit.c index eb8fe1f7c..3cccdcc98 100644 --- a/plugins/sudoers/audit.c +++ b/plugins/sudoers/audit.c @@ -434,7 +434,6 @@ sudoers_audit_error(const char *plugin_name, unsigned int plugin_type, { const struct sudoers_context *ctx = sudoers_get_context(); struct eventlog evlog; - struct timespec now; int ret = true; debug_decl(sudoers_audit_error, SUDOERS_DEBUG_PLUGIN); @@ -447,13 +446,8 @@ sudoers_audit_error(const char *plugin_name, unsigned int plugin_type, ret = false; } - if (sudo_gettime_real(&now)) { - sudo_warn("%s", U_("unable to get time of day")); - debug_return_bool(false); - } - audit_to_eventlog(ctx, &evlog, command_info, ctx->runas.argv, NULL, NULL); - if (!eventlog_alert(&evlog, 0, &now, message, NULL)) + if (!eventlog_alert(&evlog, 0, &evlog.submit_time, message, NULL)) ret = false; if (!log_server_alert(ctx, &evlog, message, NULL)) diff --git a/plugins/sudoers/logging.c b/plugins/sudoers/logging.c index 5c144f960..31587b2a6 100644 --- a/plugins/sudoers/logging.c +++ b/plugins/sudoers/logging.c @@ -688,7 +688,6 @@ vlog_warning(const struct sudoers_context *ctx, unsigned int flags, int errnum, const char * restrict fmt, va_list ap) { struct eventlog evlog; - struct timespec now; const char *errstr = NULL; char *message; bool ret = true; @@ -733,10 +732,6 @@ vlog_warning(const struct sudoers_context *ctx, unsigned int flags, } if (ISSET(flags, SLOG_SEND_MAIL) || !ISSET(flags, SLOG_NO_LOG)) { - if (sudo_gettime_real(&now) == -1) { - sudo_warn("%s", U_("unable to get time of day")); - goto done; - } if (ISSET(flags, SLOG_RAW_MSG)) SET(evl_flags, EVLOG_RAW); if (ISSET(flags, SLOG_SEND_MAIL)) { @@ -746,7 +741,7 @@ vlog_warning(const struct sudoers_context *ctx, unsigned int flags, } sudoers_to_eventlog(ctx, &evlog, ctx->runas.cmnd, ctx->runas.argv, NULL, ctx->uuid_str); - if (!eventlog_alert(&evlog, evl_flags, &now, message, errstr)) + if (!eventlog_alert(&evlog, evl_flags, &evlog.submit_time, message, errstr)) ret = false; if (!log_server_alert(ctx, &evlog, message, errstr)) ret = false;