From: Todd C. Miller Date: Mon, 31 Oct 2016 19:36:35 +0000 (-0600) Subject: sudoers_debug_register() was not setting the active debug instance X-Git-Tag: SUDO_1_8_19^2~78 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a3a545e4168f7d4dbbe458535e7656993a9e1d8e;p=sudo sudoers_debug_register() was not setting the active debug instance to sudoers_debug_instance when called from the I/O log plugin. This is because it relied on sudo_debug_register to do that but sudoers_debug_parse_flags() doesn't set debug_files[] sudoers_debug_instance is already set (we can only init sudoers debug once). To work around this, just make sudoers_debug_instance the active debug instance in sudoers_debug_register() when it is already set. --- diff --git a/plugins/sudoers/sudoers_debug.c b/plugins/sudoers/sudoers_debug.c index 3fbae4710..9de8df2fc 100644 --- a/plugins/sudoers/sudoers_debug.c +++ b/plugins/sudoers/sudoers_debug.c @@ -111,6 +111,7 @@ oom: /* * Register the specified debug files and program with the * debug subsystem, freeing the debug list when done. + * Sets the active debug instance as a side effect. */ void sudoers_debug_register(const char *program, @@ -118,6 +119,11 @@ sudoers_debug_register(const char *program, { struct sudo_debug_file *debug_file, *debug_next; + /* Already initialized? */ + if (sudoers_debug_instance != SUDO_DEBUG_INSTANCE_INITIALIZER) { + sudo_debug_set_active_instance(sudoers_debug_instance); + } + /* Setup debugging if indicated. */ if (debug_files != NULL && !TAILQ_EMPTY(debug_files)) { if (program != NULL) {