From c20c3b56318d0530f369c9f52d95705af4232fcd Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 31 May 2022 20:03:17 -0600 Subject: [PATCH] Only display "unable to connect to log server" warning once. Previously, in intercept mode, if the log server is unreachable the message would be printed for each sub-command. --- plugins/sudoers/log_client.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/sudoers/log_client.c b/plugins/sudoers/log_client.c index be47a5c07..cb8803fcd 100644 --- a/plugins/sudoers/log_client.c +++ b/plugins/sudoers/log_client.c @@ -2011,6 +2011,7 @@ log_server_open(struct log_details *details, struct timespec *now, struct sudo_plugin_event * (*event_alloc)(void)) { struct client_closure *closure; + static bool warned = false; debug_decl(log_server_open, SUDOERS_DEBUG_UTIL); closure = client_closure_alloc(details, now, log_io, initial_state, @@ -2021,7 +2022,10 @@ log_server_open(struct log_details *details, struct timespec *now, /* Connect to log first available log server. */ if (!log_server_connect(closure)) { /* TODO: support offline logs if server unreachable */ - sudo_warnx("%s", U_("unable to connect to log server")); + if (!warned) { + sudo_warnx("%s", U_("unable to connect to log server")); + warned = true; + } goto bad; }