Skip to content

Commit bb111c0

Browse files
committed
log_server_accept: Just return if disabled flag set in closure
If the connection the the log server was interrupted but we are continuing anyway ("ignore_logfile_errors" set), we don't want to try to log additional commands if "log_subscmds" or "intercept" are enabled in sudoers.
1 parent 865f11c commit bb111c0

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

plugins/sudoers/audit.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,9 @@ log_server_accept(const struct sudoers_context *ctx, struct eventlog *evlog)
248248
bool ret = false;
249249
debug_decl(log_server_accept, SUDOERS_DEBUG_PLUGIN);
250250

251+
if (client_closure->disabled)
252+
debug_return_bool(false);
253+
251254
if (SLIST_EMPTY(&def_log_servers))
252255
debug_return_bool(true);
253256

@@ -301,8 +304,11 @@ log_server_exit(int status_type, int status)
301304
{
302305
debug_decl(log_server_exit, SUDOERS_DEBUG_PLUGIN);
303306

304-
/* Only send exit status to log server if I/O logging plugin did not. */
305-
if (client_closure != NULL) {
307+
/*
308+
* I/O log plugin clears client_closure on close so we don't log
309+
* the exit status twice.
310+
*/
311+
if (client_closure != NULL && !client_closure->disabled) {
306312
int exit_status = 0, error = 0;
307313

308314
if (status_type == SUDO_PLUGIN_WAIT_STATUS) {

0 commit comments

Comments
 (0)