sudo_debug_deregister() directly.
continue;
}
}
- sudoers_debug_register(&debug_files, plugin_path);
+ sudoers_debug_register(plugin_path, &debug_files);
/*
* Pull iolog settings out of command_info.
fclose(io_log_files[i].fd.f);
}
- sudo_debug_exit(__func__, __FILE__, __LINE__, sudo_debug_subsys);
- if (sudoers_debug_instance != SUDO_DEBUG_INSTANCE_INITIALIZER) {
- sudo_debug_deregister(sudoers_debug_instance);
- sudoers_debug_instance = SUDO_DEBUG_INSTANCE_INITIALIZER;
- }
+ sudoers_debug_deregister();
return;
}
continue;
}
}
- sudoers_debug_register(&debug_files, plugin_path);
+ sudoers_debug_register(plugin_path, &debug_files);
/* Call the sudoers init function. */
info.settings = settings;
sudo_efree(user_gids);
user_gids = NULL;
- sudo_debug_exit(__func__, __FILE__, __LINE__, sudo_debug_subsys);
- if (sudoers_debug_instance != SUDO_DEBUG_INSTANCE_INITIALIZER) {
- sudo_debug_deregister(sudoers_debug_instance);
- sudoers_debug_instance = SUDO_DEBUG_INSTANCE_INITIALIZER;
- }
+ sudoers_debug_deregister();
return;
}
/* sudoers_debug.c */
void sudoers_debug_parse_flags(struct sudo_conf_debug_file_list *debug_files, const char *entry);
-void sudoers_debug_register(struct sudo_conf_debug_file_list *debug_files, const char *plugin_path);
+void sudoers_debug_register(const char *plugin_path, struct sudo_conf_debug_file_list *debug_files);
+void sudoers_debug_deregister(void);
extern int sudoers_debug_instance;
/* policy.c */
* debug subsystem, freeing the debug list when done.
*/
void
-sudoers_debug_register(struct sudo_conf_debug_file_list *debug_files,
- const char *program)
+sudoers_debug_register(const char *program,
+ struct sudo_conf_debug_file_list *debug_files)
{
struct sudo_debug_file *debug_file, *debug_next;
}
}
}
+
+/*
+ * Deregister sudoers_debug_instance if it is registered.
+ */
+void
+sudoers_debug_deregister(void)
+{
+ debug_decl(sudoers_debug_deregister, SUDOERS_DEBUG_PLUGIN, sudoers_debug_instance)
+ if (sudoers_debug_instance != SUDO_DEBUG_INSTANCE_INITIALIZER) {
+ sudo_debug_exit(__func__, __FILE__, __LINE__, sudo_debug_subsys);
+ sudo_debug_deregister(sudoers_debug_instance);
+ sudoers_debug_instance = SUDO_DEBUG_INSTANCE_INITIALIZER;
+ }
+}
/* Initialize the debug subsystem. */
sudo_conf_read(NULL, SUDO_CONF_DEBUG);
- sudoers_debug_register(sudo_conf_debug_files(getprogname()), getprogname());
+ sudoers_debug_register(getprogname(), sudo_conf_debug_files(getprogname()));
dflag = 0;
grfile = pwfile = NULL;
/* Initialize the debug subsystem. */
sudo_conf_read(NULL, SUDO_CONF_DEBUG);
- sudoers_debug_register(sudo_conf_debug_files(getprogname()), getprogname());
+ sudoers_debug_register(getprogname(), sudo_conf_debug_files(getprogname()));
/*
* Arg handling.