From 0487ef0a70a9758da31cff0832ee8decbeb92e82 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 17 Sep 2010 15:23:19 +1000 Subject: libcli/security Add debug class to security_token_debug() et al This will allow it to replace functions in source3 that use debug classes. Andrew Bartlett --- libcli/security/privileges.c | 20 +++++++++++--------- libcli/security/privileges.h | 2 +- libcli/security/security_token.c | 10 +++++----- libcli/security/security_token.h | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) (limited to 'libcli') diff --git a/libcli/security/privileges.c b/libcli/security/privileges.c index 65000aa754..5d4cf77490 100644 --- a/libcli/security/privileges.c +++ b/libcli/security/privileges.c @@ -443,31 +443,33 @@ void security_token_set_right_bit(struct security_token *token, uint32_t right_b token->rights_mask |= right_bit; } -void security_token_debug_privileges(int dbg_lev, const struct security_token *token) +void security_token_debug_privileges(int dbg_class, int dbg_lev, const struct security_token *token) { - DEBUGADD(dbg_lev, (" Privileges (0x%16llX):\n", - (unsigned long long) token->privilege_mask)); + DEBUGADDC(dbg_class, dbg_lev, (" Privileges (0x%16llX):\n", + (unsigned long long) token->privilege_mask)); if (token->privilege_mask) { int idx = 0; int i = 0; for (idx = 0; idxprivilege_mask & privs[idx].privilege_mask) { - DEBUGADD(dbg_lev, (" Privilege[%3lu]: %s\n", (unsigned long)i++, - privs[idx].name)); + DEBUGADDC(dbg_class, dbg_lev, + (" Privilege[%3lu]: %s\n", (unsigned long)i++, + privs[idx].name)); } } } - DEBUGADD(dbg_lev, (" Rights (0x%16lX):\n", - (unsigned long) token->rights_mask)); + DEBUGADDC(dbg_class, dbg_lev, (" Rights (0x%16lX):\n", + (unsigned long) token->rights_mask)); if (token->rights_mask) { int idx = 0; int i = 0; for (idx = 0; idxrights_mask & rights[idx].right_mask) { - DEBUGADD(dbg_lev, (" Right[%3lu]: %s\n", (unsigned long)i++, - rights[idx].name)); + DEBUGADDC(dbg_class, dbg_lev, + (" Right[%3lu]: %s\n", (unsigned long)i++, + rights[idx].name)); } } } diff --git a/libcli/security/privileges.h b/libcli/security/privileges.h index f67a38bc27..a65dbdfcd7 100644 --- a/libcli/security/privileges.h +++ b/libcli/security/privileges.h @@ -98,6 +98,6 @@ void security_token_set_privilege(struct security_token *token, enum sec_privile */ void security_token_set_right_bit(struct security_token *token, uint32_t right_bit); -void security_token_debug_privileges(int dbg_lev, const struct security_token *token); +void security_token_debug_privileges(int dbg_class, int dbg_lev, const struct security_token *token); #endif /* PRIVILEGES_H */ diff --git a/libcli/security/security_token.c b/libcli/security/security_token.c index 4e5aff87da..03dc528b93 100644 --- a/libcli/security/security_token.c +++ b/libcli/security/security_token.c @@ -44,13 +44,13 @@ struct security_token *security_token_initialise(TALLOC_CTX *mem_ctx) /**************************************************************************** prints a struct security_token to debug output. ****************************************************************************/ -void security_token_debug(int dbg_lev, const struct security_token *token) +void security_token_debug(int dbg_class, int dbg_lev, const struct security_token *token) { TALLOC_CTX *mem_ctx; uint32_t i; if (!token) { - DEBUG(dbg_lev, ("Security token: (NULL)\n")); + DEBUGC(dbg_class, dbg_lev, ("Security token: (NULL)\n")); return; } @@ -59,14 +59,14 @@ void security_token_debug(int dbg_lev, const struct security_token *token) return; } - DEBUG(dbg_lev, ("Security token SIDs (%lu):\n", + DEBUGC(dbg_class, dbg_lev, ("Security token SIDs (%lu):\n", (unsigned long)token->num_sids)); for (i = 0; i < token->num_sids; i++) { - DEBUGADD(dbg_lev, (" SID[%3lu]: %s\n", (unsigned long)i, + DEBUGADDC(dbg_class, dbg_lev, (" SID[%3lu]: %s\n", (unsigned long)i, dom_sid_string(mem_ctx, &token->sids[i]))); } - security_token_debug_privileges(dbg_lev, token); + security_token_debug_privileges(dbg_class, dbg_lev, token); talloc_free(mem_ctx); } diff --git a/libcli/security/security_token.h b/libcli/security/security_token.h index 87978e2811..b8ca990035 100644 --- a/libcli/security/security_token.h +++ b/libcli/security/security_token.h @@ -37,7 +37,7 @@ struct security_token *security_token_initialise(TALLOC_CTX *mem_ctx); /**************************************************************************** prints a struct security_token to debug output. ****************************************************************************/ -void security_token_debug(int dbg_lev, const struct security_token *token); +void security_token_debug(int dbg_class, int dbg_lev, const struct security_token *token); bool security_token_is_sid(const struct security_token *token, const struct dom_sid *sid); -- cgit