diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2012-04-03 18:42:43 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-04-18 10:23:55 -0400 |
commit | bd09ead65cded3207cf228c44a31bbc87c2979bd (patch) | |
tree | 91d7abf452011afdbef9c42a3eb7d59fa8768a83 /src/providers | |
parent | 7329723a5d8ce46f146e78dabfad5c94b3eed505 (diff) | |
download | sssd-bd09ead65cded3207cf228c44a31bbc87c2979bd.tar.gz sssd-bd09ead65cded3207cf228c44a31bbc87c2979bd.tar.xz sssd-bd09ead65cded3207cf228c44a31bbc87c2979bd.zip |
Prevent printing NULL from DEBUG messages
Diffstat (limited to 'src/providers')
-rw-r--r-- | src/providers/data_provider_opts.c | 76 | ||||
-rw-r--r-- | src/providers/dp_pam_data_util.c | 14 | ||||
-rw-r--r-- | src/providers/ipa/ipa_hbac_rules.c | 2 | ||||
-rw-r--r-- | src/providers/ipa/ipa_hbac_services.c | 4 | ||||
-rw-r--r-- | src/providers/ipa/ipa_selinux_maps.c | 2 | ||||
-rw-r--r-- | src/providers/ldap/sdap.c | 13 | ||||
-rw-r--r-- | src/providers/ldap/sdap_async.c | 6 |
7 files changed, 67 insertions, 50 deletions
diff --git a/src/providers/data_provider_opts.c b/src/providers/data_provider_opts.c index 94849991c..95e413343 100644 --- a/src/providers/data_provider_opts.c +++ b/src/providers/data_provider_opts.c @@ -52,13 +52,16 @@ int dp_get_options(TALLOC_CTX *memctx, if (ret != EOK || ((opts[i].def_val.string != NULL) && (opts[i].val.string == NULL))) { - DEBUG(0, ("Failed to retrieve value for option (%s)\n", - opts[i].opt_name)); + DEBUG(SSSDBG_CRIT_FAILURE, + ("Failed to retrieve value for option (%s)\n", + opts[i].opt_name)); if (ret == EOK) ret = EINVAL; goto done; } - DEBUG(6, ("Option %s has value %s\n", - opts[i].opt_name, opts[i].val.cstring)); + DEBUG(SSSDBG_TRACE_FUNC, ("Option %s has%s value %s\n", + opts[i].opt_name, + opts[i].val.cstring ? "" : " no", + opts[i].val.cstring ? opts[i].val.cstring : "")); break; case DP_OPT_BLOB: @@ -66,8 +69,9 @@ int dp_get_options(TALLOC_CTX *memctx, opts[i].opt_name, NULL, &tmp); if (ret != EOK) { - DEBUG(0, ("Failed to retrieve value for option (%s)\n", - opts[i].opt_name)); + DEBUG(SSSDBG_CRIT_FAILURE, + ("Failed to retrieve value for option (%s)\n", + opts[i].opt_name)); goto done; } @@ -79,9 +83,8 @@ int dp_get_options(TALLOC_CTX *memctx, opts[i].val.blob.length = 0; } - DEBUG(6, ("Option %s has %s binary value.\n", - opts[i].opt_name, - opts[i].val.blob.length?"a":"no")); + DEBUG(SSSDBG_TRACE_FUNC, ("Option %s has %s binary value.\n", + opts[i].opt_name, opts[i].val.blob.length?"a":"no")); break; case DP_OPT_NUMBER: @@ -90,11 +93,12 @@ int dp_get_options(TALLOC_CTX *memctx, opts[i].def_val.number, &opts[i].val.number); if (ret != EOK) { - DEBUG(0, ("Failed to retrieve value for option (%s)\n", - opts[i].opt_name)); + DEBUG(SSSDBG_CRIT_FAILURE, + ("Failed to retrieve value for option (%s)\n", + opts[i].opt_name)); goto done; } - DEBUG(6, ("Option %s has value %d\n", + DEBUG(SSSDBG_TRACE_FUNC, ("Option %s has value %d\n", opts[i].opt_name, opts[i].val.number)); break; @@ -104,13 +108,13 @@ int dp_get_options(TALLOC_CTX *memctx, opts[i].def_val.boolean, &opts[i].val.boolean); if (ret != EOK) { - DEBUG(0, ("Failed to retrieve value for option (%s)\n", - opts[i].opt_name)); + DEBUG(SSSDBG_CRIT_FAILURE, + ("Failed to retrieve value for option (%s)\n", + opts[i].opt_name)); goto done; } - DEBUG(6, ("Option %s is %s\n", - opts[i].opt_name, - opts[i].val.boolean?"TRUE":"FALSE")); + DEBUG(SSSDBG_TRACE_FUNC, ("Option %s is %s\n", + opts[i].opt_name, opts[i].val.boolean?"TRUE":"FALSE")); break; } } @@ -150,12 +154,15 @@ int dp_copy_options(TALLOC_CTX *memctx, ret = dp_opt_set_string(opts, i, src_opts[i].def_val.string); } if (ret != EOK) { - DEBUG(0, ("Failed to copy value for option (%s)\n", - opts[i].opt_name)); + DEBUG(SSSDBG_CRIT_FAILURE, + ("Failed to copy value for option (%s)\n", + opts[i].opt_name)); goto done; } - DEBUG(6, ("Option %s has value %s\n", - opts[i].opt_name, opts[i].val.cstring)); + DEBUG(SSSDBG_TRACE_FUNC, ("Option %s has%s value %s\n", + opts[i].opt_name, + opts[i].val.cstring ? "" : " no", + opts[i].val.cstring ? opts[i].val.cstring : "")); break; case DP_OPT_BLOB: @@ -165,13 +172,13 @@ int dp_copy_options(TALLOC_CTX *memctx, ret = dp_opt_set_blob(opts, i, src_opts[i].def_val.blob); } if (ret != EOK) { - DEBUG(0, ("Failed to retrieve value for option (%s)\n", - opts[i].opt_name)); + DEBUG(SSSDBG_CRIT_FAILURE, + ("Failed to retrieve value for option (%s)\n", + opts[i].opt_name)); goto done; } - DEBUG(6, ("Option %s has %s binary value.\n", - opts[i].opt_name, - opts[i].val.blob.length?"a":"no")); + DEBUG(SSSDBG_TRACE_FUNC, ("Option %s has %s binary value.\n", + opts[i].opt_name, opts[i].val.blob.length?"a":"no")); break; case DP_OPT_NUMBER: @@ -181,11 +188,12 @@ int dp_copy_options(TALLOC_CTX *memctx, ret = dp_opt_set_int(opts, i, src_opts[i].def_val.number); } if (ret != EOK) { - DEBUG(0, ("Failed to retrieve value for option (%s)\n", - opts[i].opt_name)); + DEBUG(SSSDBG_CRIT_FAILURE, + ("Failed to retrieve value for option (%s)\n", + opts[i].opt_name)); goto done; } - DEBUG(6, ("Option %s has value %d\n", + DEBUG(SSSDBG_TRACE_FUNC, ("Option %s has value %d\n", opts[i].opt_name, opts[i].val.number)); break; @@ -196,13 +204,13 @@ int dp_copy_options(TALLOC_CTX *memctx, ret = dp_opt_set_int(opts, i, src_opts[i].def_val.boolean); } if (ret != EOK) { - DEBUG(0, ("Failed to retrieve value for option (%s)\n", - opts[i].opt_name)); + DEBUG(SSSDBG_CRIT_FAILURE, + ("Failed to retrieve value for option (%s)\n", + opts[i].opt_name)); goto done; } - DEBUG(6, ("Option %s is %s\n", - opts[i].opt_name, - opts[i].val.boolean?"TRUE":"FALSE")); + DEBUG(SSSDBG_TRACE_FUNC, ("Option %s is %s\n", + opts[i].opt_name, opts[i].val.boolean?"TRUE":"FALSE")); break; } } diff --git a/src/providers/dp_pam_data_util.c b/src/providers/dp_pam_data_util.c index 7ac50c4e1..889c47f00 100644 --- a/src/providers/dp_pam_data_util.c +++ b/src/providers/dp_pam_data_util.c @@ -45,6 +45,8 @@ } \ } while(0) +#define PAM_SAFE_ITEM(item) item ? item : "not set" + static const char *pamcmd2str(int cmd) { switch (cmd) { case SSS_PAM_AUTHENTICATE: @@ -138,12 +140,12 @@ failed: void pam_print_data(int l, struct pam_data *pd) { DEBUG(l, ("command: %s\n", pamcmd2str(pd->cmd))); - DEBUG(l, ("domain: %s\n", pd->domain)); - DEBUG(l, ("user: %s\n", pd->user)); - DEBUG(l, ("service: %s\n", pd->service)); - DEBUG(l, ("tty: %s\n", pd->tty)); - DEBUG(l, ("ruser: %s\n", pd->ruser)); - DEBUG(l, ("rhost: %s\n", pd->rhost)); + DEBUG(l, ("domain: %s\n", PAM_SAFE_ITEM(pd->domain))); + DEBUG(l, ("user: %s\n", PAM_SAFE_ITEM(pd->user))); + DEBUG(l, ("service: %s\n", PAM_SAFE_ITEM(pd->service))); + DEBUG(l, ("tty: %s\n", PAM_SAFE_ITEM(pd->tty))); + DEBUG(l, ("ruser: %s\n", PAM_SAFE_ITEM(pd->ruser))); + DEBUG(l, ("rhost: %s\n", PAM_SAFE_ITEM(pd->rhost))); DEBUG(l, ("authtok type: %d\n", pd->authtok_type)); DEBUG(l, ("authtok size: %d\n", pd->authtok_size)); DEBUG(l, ("newauthtok type: %d\n", pd->newauthtok_type)); diff --git a/src/providers/ipa/ipa_hbac_rules.c b/src/providers/ipa/ipa_hbac_rules.c index 49dcdfa0a..24caf1fd4 100644 --- a/src/providers/ipa/ipa_hbac_rules.c +++ b/src/providers/ipa/ipa_hbac_rules.c @@ -226,7 +226,7 @@ ipa_hbac_rule_info_next(struct tevent_req *req, DEBUG(SSSDBG_TRACE_FUNC, ("Sending request for next search base: " "[%s][%d][%s]\n", base->basedn, base->scope, - base->filter)); + state->cur_filter)); subreq = sdap_get_generic_send(state, state->ev, state->opts, state->sh, base->basedn, base->scope, diff --git a/src/providers/ipa/ipa_hbac_services.c b/src/providers/ipa/ipa_hbac_services.c index 4f0f5f7b1..c086f976e 100644 --- a/src/providers/ipa/ipa_hbac_services.c +++ b/src/providers/ipa/ipa_hbac_services.c @@ -148,7 +148,7 @@ static errno_t ipa_hbac_service_info_next(struct tevent_req *req, DEBUG(SSSDBG_TRACE_FUNC, ("Sending request for next search base: " "[%s][%d][%s]\n", base->basedn, base->scope, - base->filter)); + state->cur_filter)); subreq = sdap_get_generic_send(state, state->ev, state->opts, state->sh, base->basedn, base->scope, state->cur_filter, @@ -263,7 +263,7 @@ ipa_hbac_servicegroup_info_next(struct tevent_req *req, /* Look up service groups */ DEBUG(SSSDBG_TRACE_FUNC, ("Sending request for next search base: " "[%s][%d][%s]\n", base->basedn, base->scope, - base->filter)); + state->cur_filter)); subreq = sdap_get_generic_send(state, state->ev, state->opts, state->sh, base->basedn, base->scope, state->cur_filter, state->attrs, NULL, 0, diff --git a/src/providers/ipa/ipa_selinux_maps.c b/src/providers/ipa/ipa_selinux_maps.c index 7a54d24a7..711274b1b 100644 --- a/src/providers/ipa/ipa_selinux_maps.c +++ b/src/providers/ipa/ipa_selinux_maps.c @@ -128,7 +128,7 @@ ipa_selinux_get_maps_next(struct tevent_req *req, DEBUG(SSSDBG_TRACE_FUNC, ("Trying to fetch SELinux maps with following " "parameters: [%d][%s][%s]\n", base->scope, - base->filter, base->basedn)); + state->cur_filter, base->basedn)); subreq = sdap_get_generic_send(state, state->ev, state->opts, state->sh, base->basedn, base->scope, state->cur_filter, diff --git a/src/providers/ldap/sdap.c b/src/providers/ldap/sdap.c index 9e052eef5..616e7cba5 100644 --- a/src/providers/ldap/sdap.c +++ b/src/providers/ldap/sdap.c @@ -54,7 +54,8 @@ int sdap_get_map(TALLOC_CTX *memctx, map[i].def_name, &name); if (ret != EOK) { - DEBUG(0, ("Failed to retrieve value for %s\n", map[i].opt_name)); + DEBUG(SSSDBG_CRIT_FAILURE, + ("Failed to retrieve value for %s\n", map[i].opt_name)); talloc_zfree(map); return EINVAL; } @@ -62,7 +63,8 @@ int sdap_get_map(TALLOC_CTX *memctx, if (name) { ret = sss_filter_sanitize(map, name, &map[i].name); if (ret != EOK) { - DEBUG(1, ("Could not sanitize attribute [%s]\n", name)); + DEBUG(SSSDBG_CRIT_FAILURE, + ("Could not sanitize attribute [%s]\n", name)); talloc_zfree(map); return EINVAL; } @@ -72,14 +74,17 @@ int sdap_get_map(TALLOC_CTX *memctx, } if (map[i].def_name && !map[i].name) { - DEBUG(0, ("Failed to retrieve value for %s\n", map[i].opt_name)); + DEBUG(SSSDBG_CRIT_FAILURE, + ("Failed to retrieve value for %s\n", map[i].opt_name)); if (ret != EOK) { talloc_zfree(map); return EINVAL; } } - DEBUG(5, ("Option %s has value %s\n", map[i].opt_name, map[i].name)); + DEBUG(SSSDBG_TRACE_FUNC, ("Option %s has%s value %s\n", + map[i].opt_name, map[i].name ? "" : " no", + map[i].name ? map[i].name : "")); } *_map = map; diff --git a/src/providers/ldap/sdap_async.c b/src/providers/ldap/sdap_async.c index 076a3f220..b21d9c384 100644 --- a/src/providers/ldap/sdap_async.c +++ b/src/providers/ldap/sdap_async.c @@ -1155,8 +1155,10 @@ static errno_t sdap_get_generic_ext_step(struct tevent_req *req) */ talloc_zfree(state->op); - DEBUG(6, ("calling ldap_search_ext with [%s][%s].\n", state->filter, - state->search_base)); + DEBUG(SSSDBG_TRACE_FUNC, + ("calling ldap_search_ext with [%s][%s].\n", + state->filter ? state->filter : "no filter", + state->search_base)); if (DEBUG_IS_SET(SSSDBG_TRACE_LIBS)) { int i; |