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.
This commit is contained in:
Todd C. Miller
2016-10-31 13:36:35 -06:00
parent e8af335eb8
commit a3a545e416

View File

@@ -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) {