Add support for multiple Debug lines per program. Callers may

register arbitrary debug facilities or use built-in defaults.  We
now use separate Debug statements for plugins and programs.
This commit is contained in:
Todd C. Miller
2014-10-22 13:23:05 -06:00
parent a7e724b75d
commit 866cfc4fc3
100 changed files with 1509 additions and 949 deletions

View File

@@ -173,7 +173,7 @@ register_hook_internal(struct sudo_hook_list *head,
int (*hook_fn)(), void *closure)
{
struct sudo_hook_entry *hook;
debug_decl(register_hook_internal, SUDO_DEBUG_HOOKS)
debug_decl(register_hook_internal, SUDO_DEBUG_HOOKS, sudo_debug_instance)
hook = sudo_ecalloc(1, sizeof(*hook));
hook->u.generic_fn = hook_fn;
@@ -188,7 +188,7 @@ int
register_hook(struct sudo_hook *hook)
{
int rval = 0;
debug_decl(register_hook, SUDO_DEBUG_HOOKS)
debug_decl(register_hook, SUDO_DEBUG_HOOKS, sudo_debug_instance)
if (SUDO_HOOK_VERSION_GET_MAJOR(hook->hook_version) != SUDO_HOOK_VERSION_MAJOR) {
/* Major versions must match. */
@@ -227,7 +227,7 @@ deregister_hook_internal(struct sudo_hook_list *head,
int (*hook_fn)(), void *closure)
{
struct sudo_hook_entry *hook, *prev = NULL;
debug_decl(deregister_hook_internal, SUDO_DEBUG_HOOKS)
debug_decl(deregister_hook_internal, SUDO_DEBUG_HOOKS, sudo_debug_instance)
SLIST_FOREACH(hook, head, entries) {
if (hook->u.generic_fn == hook_fn && hook->closure == closure) {
@@ -250,7 +250,7 @@ int
deregister_hook(struct sudo_hook *hook)
{
int rval = 0;
debug_decl(deregister_hook, SUDO_DEBUG_HOOKS)
debug_decl(deregister_hook, SUDO_DEBUG_HOOKS, sudo_debug_instance)
if (SUDO_HOOK_VERSION_GET_MAJOR(hook->hook_version) != SUDO_HOOK_VERSION_MAJOR) {
/* Major versions must match. */