2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-22 01:49:11 +00:00

log_server_alert: struct timespec argument was not actually used

The struct timespec argument is used to initialize the command
start time, which is not used for an alert message.
This commit is contained in:
Todd C. Miller 2023-11-23 09:08:04 -05:00
parent 47a43c5404
commit 13dec64f3d
4 changed files with 10 additions and 8 deletions

View File

@ -456,7 +456,7 @@ sudoers_audit_error(const char *plugin_name, unsigned int plugin_type,
if (!eventlog_alert(&evlog, 0, &now, message, NULL))
ret = false;
if (!log_server_alert(ctx, &evlog, &now, message, NULL))
if (!log_server_alert(ctx, &evlog, message, NULL))
ret = false;
debug_return_int(ret);

View File

@ -1983,8 +1983,10 @@ client_closure_alloc(struct log_details *details, struct timespec *now,
closure->state = RECV_HELLO;
closure->initial_state = initial_state;
closure->start_time.tv_sec = now->tv_sec;
closure->start_time.tv_nsec = now->tv_nsec;
if (now != NULL) {
closure->start_time.tv_sec = now->tv_sec;
closure->start_time.tv_nsec = now->tv_nsec;
}
TAILQ_INIT(&closure->write_bufs);
TAILQ_INIT(&closure->free_bufs);

View File

@ -175,7 +175,7 @@ done:
bool
log_server_alert(const struct sudoers_context *ctx, struct eventlog *evlog,
struct timespec *now, const char *message, const char *errstr)
const char *message, const char *errstr)
{
struct log_details details;
char *emessage = NULL;
@ -213,7 +213,7 @@ log_server_alert(const struct sudoers_context *ctx, struct eventlog *evlog,
goto done;
/* Open connection to log server, send hello and alert messages. */
client_closure = log_server_open(&details, now, false,
client_closure = log_server_open(&details, NULL, false,
SEND_ALERT, emessage ? emessage : message);
if (client_closure != NULL) {
client_closure_free(client_closure);
@ -239,7 +239,7 @@ log_server_reject(const struct sudoers_context *ctx, struct eventlog *evlog,
bool
log_server_alert(const struct sudoers_context *ctx, struct eventlog *evlog,
struct timespec *now, const char *message, const char *errstr)
const char *message, const char *errstr)
{
return true;
}
@ -748,7 +748,7 @@ vlog_warning(const struct sudoers_context *ctx, unsigned int flags,
NULL, ctx->uuid_str);
if (!eventlog_alert(&evlog, evl_flags, &now, message, errstr))
ret = false;
if (!log_server_alert(ctx, &evlog, &now, message, errstr))
if (!log_server_alert(ctx, &evlog, message, errstr))
ret = false;
}

View File

@ -78,7 +78,7 @@ bool log_exit_status(const struct sudoers_context *ctx, int exit_status);
bool log_auth_failure(const struct sudoers_context *ctx, unsigned int status, unsigned int tries);
bool log_denial(const struct sudoers_context *ctx, unsigned int status, bool inform_user);
bool log_failure(const struct sudoers_context *ctx, unsigned int status, int flags);
bool log_server_alert(const struct sudoers_context *ctx, struct eventlog *evlog, struct timespec *now, const char *message, const char *errstr);
bool log_server_alert(const struct sudoers_context *ctx, struct eventlog *evlog, const char *message, const char *errstr);
bool log_server_reject(const struct sudoers_context *ctx, struct eventlog *evlog, const char *message);
bool log_warning(const struct sudoers_context *ctx, unsigned int flags, const char * restrict fmt, ...) sudo_printflike(3, 4);
bool log_warningx(const struct sudoers_context *ctx, unsigned int flags, const char * restrict fmt, ...) sudo_printflike(3, 4);