From 99dd40a885ed3d42af4bbbde7ee2fc98830544d0 Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Tue, 9 Aug 2011 13:01:05 +0200 Subject: New DEBUG facility - conversion https://fedorahosted.org/sssd/ticket/925 Conversion of the old debug_level format to the new one. (only where it was necessary) Removed: SSS_DEFAULT_DEBUG_LEVEL (completely replaced with SSSDBG_DEFAULT) --- src/providers/child_common.c | 2 +- src/providers/data_provider.h | 2 +- src/providers/data_provider_be.c | 2 ++ src/providers/data_provider_fo.c | 6 +++--- src/providers/krb5/krb5_child.c | 2 ++ src/providers/ldap/ldap_child.c | 2 ++ src/providers/ldap/sdap_async.c | 2 +- src/providers/ldap/sdap_fd_events.c | 2 +- src/providers/proxy/proxy_auth.c | 2 +- src/providers/proxy/proxy_child.c | 1 + src/providers/proxy/proxy_id.c | 2 +- 11 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src/providers') diff --git a/src/providers/child_common.c b/src/providers/child_common.c index 16618c78..6e0f6a1a 100644 --- a/src/providers/child_common.c +++ b/src/providers/child_common.c @@ -400,7 +400,7 @@ static errno_t prepare_child_argv(TALLOC_CTX *mem_ctx, argv[--argc] = NULL; - argv[--argc] = talloc_asprintf(argv, "--debug-level=%d", + argv[--argc] = talloc_asprintf(argv, "--debug-level=%#.4x", debug_level); if (argv[argc] == NULL) { ret = ENOMEM; diff --git a/src/providers/data_provider.h b/src/providers/data_provider.h index e699e08f..c666072d 100644 --- a/src/providers/data_provider.h +++ b/src/providers/data_provider.h @@ -140,7 +140,7 @@ /* AUTH related common data and functions */ #define DEBUG_PAM_DATA(level, pd) do { \ - if (level <= debug_level) pam_print_data(level, pd); \ + if (DEBUG_IS_SET(debug_get_level(level))) pam_print_data(level, pd); \ } while(0); diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index 380e6cdb..7df82f44 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -1216,6 +1216,8 @@ int main(int argc, const char *argv[]) poptFreeContext(pc); + debug_level = debug_convert_old_level(debug_level); + /* set up things like debug , signals, daemonization, etc... */ debug_log_file = talloc_asprintf(NULL, "sssd_%s", be_domain); diff --git a/src/providers/data_provider_fo.c b/src/providers/data_provider_fo.c index b5c41734..fd23c0db 100644 --- a/src/providers/data_provider_fo.c +++ b/src/providers/data_provider_fo.c @@ -432,7 +432,7 @@ static void be_resolve_server_done(struct tevent_req *subreq) /* all fine we got the server */ - if (debug_level >= 4 && fo_get_server_name(state->srv)) { + if (DEBUG_IS_SET(SSSDBG_CONF_SETTINGS) && fo_get_server_name(state->srv)) { struct resolv_hostent *srvaddr; char ipaddr[128]; srvaddr = fo_get_server_hostent(state->srv); @@ -447,8 +447,8 @@ static void be_resolve_server_done(struct tevent_req *subreq) ipaddr, 128); DEBUG(4, ("Found address for server %s: [%s] TTL %d\n", - fo_get_server_str_name(state->srv), ipaddr, - srvaddr->addr_list[0]->ttl)); + fo_get_server_str_name(state->srv), ipaddr, + srvaddr->addr_list[0]->ttl)); } srv_status_change = fo_get_server_hostname_last_change(state->srv); diff --git a/src/providers/krb5/krb5_child.c b/src/providers/krb5/krb5_child.c index ffc6c798..48442de9 100644 --- a/src/providers/krb5/krb5_child.c +++ b/src/providers/krb5/krb5_child.c @@ -1573,6 +1573,8 @@ int main(int argc, const char *argv[]) poptFreeContext(pc); + debug_level = debug_convert_old_level(debug_level); + DEBUG(7, ("krb5_child started.\n")); pd = talloc_zero(NULL, struct pam_data); diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c index fb8dd806..8a1dc490 100644 --- a/src/providers/ldap/ldap_child.c +++ b/src/providers/ldap/ldap_child.c @@ -378,6 +378,8 @@ int main(int argc, const char *argv[]) poptFreeContext(pc); + debug_level = debug_convert_old_level(debug_level); + DEBUG(7, ("ldap_child started.\n")); main_ctx = talloc_new(NULL); diff --git a/src/providers/ldap/sdap_async.c b/src/providers/ldap/sdap_async.c index 5594dd55..6f73310e 100644 --- a/src/providers/ldap/sdap_async.c +++ b/src/providers/ldap/sdap_async.c @@ -981,7 +981,7 @@ static errno_t sdap_get_generic_ext_step(struct tevent_req *req) DEBUG(6, ("calling ldap_search_ext with [%s][%s].\n", state->filter, state->search_base)); - if (debug_level >= 7) { + if (DEBUG_IS_SET(SSSDBG_TRACE_LIBS)) { int i; if (state->attrs) { diff --git a/src/providers/ldap/sdap_fd_events.c b/src/providers/ldap/sdap_fd_events.c index 4fb67b82..3750da77 100644 --- a/src/providers/ldap/sdap_fd_events.c +++ b/src/providers/ldap/sdap_fd_events.c @@ -104,7 +104,7 @@ static int sdap_ldap_connect_callback_add(LDAP *ld, Sockbuf *sb, return EINVAL; } - if (debug_level >= 7) { + if (DEBUG_IS_SET(SSSDBG_TRACE_LIBS)) { char *uri = ldap_url_desc2str(srv); DEBUG(7, ("New LDAP connection to [%s] with fd [%d].\n", uri, ber_fd)); diff --git a/src/providers/proxy/proxy_auth.c b/src/providers/proxy/proxy_auth.c index f92c6471..adb0d872 100644 --- a/src/providers/proxy/proxy_auth.c +++ b/src/providers/proxy/proxy_auth.c @@ -240,7 +240,7 @@ static struct tevent_req *proxy_child_init_send(TALLOC_CTX *mem_ctx, state->child_ctx = child_ctx; state->command = talloc_asprintf(req, - "%s/proxy_child -d %d%s%s --domain %s --id %d", + "%s/proxy_child -d %#.4x%s%s --domain %s --id %d", SSSD_LIBEXEC_PATH, debug_level, (debug_timestamps ? "" : " --debug-timestamps=0"), (debug_to_file ? " --debug-to-files" : ""), diff --git a/src/providers/proxy/proxy_child.c b/src/providers/proxy/proxy_child.c index 0f588497..d19cc74c 100644 --- a/src/providers/proxy/proxy_child.c +++ b/src/providers/proxy/proxy_child.c @@ -507,6 +507,7 @@ int main(int argc, const char *argv[]) poptFreeContext(pc); + debug_level = debug_convert_old_level(debug_level); /* set up things like debug , signals, daemonization, etc... */ debug_log_file = talloc_asprintf(NULL, "proxy_child_%s", domain); diff --git a/src/providers/proxy/proxy_id.c b/src/providers/proxy/proxy_id.c index 041e25f2..ba45d7a4 100644 --- a/src/providers/proxy/proxy_id.c +++ b/src/providers/proxy/proxy_id.c @@ -395,7 +395,7 @@ done: #define DEBUG_GR_MEM(level, grp) \ do { \ - if (debug_level >= level) { \ + if (DEBUG_IS_SET(debug_get_level(level))) { \ if (!grp->gr_mem || !grp->gr_mem[0]) { \ DEBUG(level, ("Group %s has no members!\n", \ grp->gr_name)); \ -- cgit