diff options
author | Nikolai Kondrashov <Nikolai.Kondrashov@redhat.com> | 2014-02-12 10:12:59 -0500 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2014-05-02 10:58:33 +0200 |
commit | 46c28ba3044c2121c2c0af4493ac655dcb41e0e6 (patch) | |
tree | 376633177afd84f0b46a8e2e5533f5337a38cf95 /src/confdb | |
parent | dad68b3284228a38b4beb06946701e8795980966 (diff) | |
download | sssd-46c28ba3044c2121c2c0af4493ac655dcb41e0e6.tar.gz sssd-46c28ba3044c2121c2c0af4493ac655dcb41e0e6.tar.xz sssd-46c28ba3044c2121c2c0af4493ac655dcb41e0e6.zip |
Update DEBUG* invocations to use new levels
Use a script (identical to commit
83bf46f4066e3d5e838a32357c201de9bd6ecdfd) to update DEBUG* macro
invocations, which use literal numbers for levels, to use bitmask macros
instead:
grep -rl --include '*.[hc]' DEBUG . |
while read f; do
mv "$f"{,.orig}
perl -e 'use strict;
use File::Slurp;
my @map=qw"
SSSDBG_FATAL_FAILURE
SSSDBG_CRIT_FAILURE
SSSDBG_OP_FAILURE
SSSDBG_MINOR_FAILURE
SSSDBG_CONF_SETTINGS
SSSDBG_FUNC_DATA
SSSDBG_TRACE_FUNC
SSSDBG_TRACE_LIBS
SSSDBG_TRACE_INTERNAL
SSSDBG_TRACE_ALL
";
my $text=read_file(\*STDIN);
my $repl;
$text=~s/
^
(
.*
\b
(DEBUG|DEBUG_PAM_DATA|DEBUG_GR_MEM)
\s*
\(\s*
)(
[0-9]
)(
\s*,
)
(
\s*
)
(
.*
)
$
/
$repl = $1.$map[$3].$4.$5.$6,
length($repl) <= 80
? $repl
: $1.$map[$3].$4."\n".(" " x length($1)).$6
/xmge;
print $text;
' < "$f.orig" > "$f"
rm "$f.orig"
done
Diffstat (limited to 'src/confdb')
-rw-r--r-- | src/confdb/confdb.c | 85 | ||||
-rw-r--r-- | src/confdb/confdb_setup.c | 5 |
2 files changed, 56 insertions, 34 deletions
diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c index 7dccde1ff..c93c6659e 100644 --- a/src/confdb/confdb.c +++ b/src/confdb/confdb.c @@ -206,7 +206,8 @@ int confdb_add_param(struct confdb_ctx *cdb, done: talloc_free(tmp_ctx); if (ret != EOK) { - DEBUG(1, "Failed to add [%s] to [%s], error [%d] (%s)\n", + DEBUG(SSSDBG_CRIT_FAILURE, + "Failed to add [%s] to [%s], error [%d] (%s)\n", attribute, section, ret, strerror(ret)); } return ret; @@ -282,7 +283,8 @@ int confdb_get_param(struct confdb_ctx *cdb, done: talloc_free(tmp_ctx); if (ret != EOK) { - DEBUG(1, "Failed to get [%s] from [%s], error [%d] (%s)\n", + DEBUG(SSSDBG_CRIT_FAILURE, + "Failed to get [%s] from [%s], error [%d] (%s)\n", attribute, section, ret, strerror(ret)); } return ret; @@ -407,7 +409,8 @@ int confdb_get_string(struct confdb_ctx *cdb, TALLOC_CTX *ctx, failed: talloc_free(values); - DEBUG(1, "Failed to get [%s] from [%s], error [%d] (%s)\n", + DEBUG(SSSDBG_CRIT_FAILURE, + "Failed to get [%s] from [%s], error [%d] (%s)\n", attribute, section, ret, strerror(ret)); return ret; } @@ -462,7 +465,8 @@ int confdb_get_int(struct confdb_ctx *cdb, failed: talloc_free(tmp_ctx); - DEBUG(1, "Failed to read [%s] from [%s], error [%d] (%s)\n", + DEBUG(SSSDBG_CRIT_FAILURE, + "Failed to read [%s] from [%s], error [%d] (%s)\n", attribute, section, ret, strerror(ret)); return ret; } @@ -512,7 +516,8 @@ long confdb_get_long(struct confdb_ctx *cdb, failed: talloc_free(tmp_ctx); - DEBUG(1, "Failed to read [%s] from [%s], error [%d] (%s)\n", + DEBUG(SSSDBG_CRIT_FAILURE, + "Failed to read [%s] from [%s], error [%d] (%s)\n", attribute, section, ret, strerror(ret)); return ret; } @@ -552,7 +557,7 @@ int confdb_get_bool(struct confdb_ctx *cdb, } else { - DEBUG(2, "Value is not a boolean!\n"); + DEBUG(SSSDBG_OP_FAILURE, "Value is not a boolean!\n"); ret = EINVAL; goto failed; } @@ -568,7 +573,8 @@ int confdb_get_bool(struct confdb_ctx *cdb, failed: talloc_free(tmp_ctx); - DEBUG(1, "Failed to read [%s] from [%s], error [%d] (%s)\n", + DEBUG(SSSDBG_CRIT_FAILURE, + "Failed to read [%s] from [%s], error [%d] (%s)\n", attribute, section, ret, strerror(ret)); return ret; } @@ -604,7 +610,8 @@ int confdb_get_string_as_list(struct confdb_ctx *cdb, TALLOC_CTX *ctx, done: talloc_free(values); if (ret != EOK && ret != ENOENT) { - DEBUG(2, "Failed to get [%s] from [%s], error [%d] (%s)\n", + DEBUG(SSSDBG_OP_FAILURE, + "Failed to get [%s] from [%s], error [%d] (%s)\n", attribute, section, ret, strerror(ret)); } return ret; @@ -643,7 +650,7 @@ int confdb_init(TALLOC_CTX *mem_ctx, ret = ldb_set_debug(cdb->ldb, ldb_debug_messages, NULL); if (ret != LDB_SUCCESS) { - DEBUG(0,"Could not set up debug fn.\n"); + DEBUG(SSSDBG_FATAL_FAILURE,"Could not set up debug fn.\n"); talloc_free(cdb); return EIO; } @@ -653,7 +660,7 @@ int confdb_init(TALLOC_CTX *mem_ctx, ret = ldb_connect(cdb->ldb, confdb_location, 0, NULL); umask(old_umask); if (ret != LDB_SUCCESS) { - DEBUG(0, "Unable to open config database [%s]\n", + DEBUG(SSSDBG_FATAL_FAILURE, "Unable to open config database [%s]\n", confdb_location); talloc_free(cdb); return EIO; @@ -780,7 +787,7 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, } if (res->count != 1) { - DEBUG(0, "Unknown domain [%s]\n", name); + DEBUG(SSSDBG_FATAL_FAILURE, "Unknown domain [%s]\n", name); ret = ENOENT; goto done; } @@ -793,7 +800,8 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, tmp = ldb_msg_find_attr_as_string(res->msgs[0], "cn", NULL); if (!tmp) { - DEBUG(0, "Invalid configuration entry, fatal error!\n"); + DEBUG(SSSDBG_FATAL_FAILURE, + "Invalid configuration entry, fatal error!\n"); ret = EINVAL; goto done; } @@ -815,7 +823,8 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, } } else { - DEBUG(0, "Domain [%s] does not specify an ID provider, disabling!\n", + DEBUG(SSSDBG_FATAL_FAILURE, + "Domain [%s] does not specify an ID provider, disabling!\n", domain->name); ret = EINVAL; goto done; @@ -823,7 +832,7 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, if (strcasecmp(domain->provider, "files") == 0) { /* The files provider is not valid anymore */ - DEBUG(0, "The \"files\" provider is invalid\n"); + DEBUG(SSSDBG_FATAL_FAILURE, "The \"files\" provider is invalid\n"); ret = EINVAL; goto done; } @@ -837,7 +846,8 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, CONFDB_DOMAIN_AUTH_PROVIDER, NULL); if (tmp && strcasecmp(tmp, "local") != 0) { - DEBUG(0, "Local ID provider does not support [%s] as an AUTH provider.\n", tmp); + DEBUG(SSSDBG_FATAL_FAILURE, + "Local ID provider does not support [%s] as an AUTH provider.\n", tmp); ret = EINVAL; goto done; } @@ -846,7 +856,8 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, CONFDB_DOMAIN_ACCESS_PROVIDER, NULL); if (tmp && strcasecmp(tmp, "permit") != 0) { - DEBUG(0, "Local ID provider does not support [%s] as an ACCESS provider.\n", tmp); + DEBUG(SSSDBG_FATAL_FAILURE, + "Local ID provider does not support [%s] as an ACCESS provider.\n", tmp); ret = EINVAL; goto done; } @@ -855,7 +866,8 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, CONFDB_DOMAIN_CHPASS_PROVIDER, NULL); if (tmp && strcasecmp(tmp, "local") != 0) { - DEBUG(0, "Local ID provider does not support [%s] as a CHPASS provider.\n", tmp); + DEBUG(SSSDBG_FATAL_FAILURE, + "Local ID provider does not support [%s] as a CHPASS provider.\n", tmp); ret = EINVAL; goto done; } @@ -873,7 +885,8 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, * superceeded. */ val = ldb_msg_find_attr_as_int(res->msgs[0], CONFDB_DOMAIN_ENUMERATE, 0); if (val > 0) { /* ok there was a number in here */ - DEBUG(0, "Warning: enumeration parameter in %s still uses integers! " + DEBUG(SSSDBG_FATAL_FAILURE, + "Warning: enumeration parameter in %s still uses integers! " "Enumeration is now a boolean and takes true/false values. " "Interpreting as true\n", domain->name); domain->enumerate = true; @@ -881,7 +894,8 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, ret = get_entry_as_bool(res->msgs[0], &domain->enumerate, CONFDB_DOMAIN_ENUMERATE, 0); if(ret != EOK) { - DEBUG(0, "Invalid value for %s\n", CONFDB_DOMAIN_ENUMERATE); + DEBUG(SSSDBG_FATAL_FAILURE, + "Invalid value for %s\n", CONFDB_DOMAIN_ENUMERATE); goto done; } } @@ -893,7 +907,7 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, * in NSS interfaces */ ret = get_entry_as_bool(res->msgs[0], &domain->fqnames, CONFDB_DOMAIN_FQ, 0); if(ret != EOK) { - DEBUG(0, "Invalid value for %s\n", CONFDB_DOMAIN_FQ); + DEBUG(SSSDBG_FATAL_FAILURE, "Invalid value for %s\n", CONFDB_DOMAIN_FQ); goto done; } @@ -910,7 +924,7 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, CONFDB_DOMAIN_MINID, confdb_get_min_id(domain)); if (ret != EOK) { - DEBUG(0, "Invalid value for minId\n"); + DEBUG(SSSDBG_FATAL_FAILURE, "Invalid value for minId\n"); ret = EINVAL; goto done; } @@ -918,13 +932,13 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, ret = get_entry_as_uint32(res->msgs[0], &domain->id_max, CONFDB_DOMAIN_MAXID, 0); if (ret != EOK) { - DEBUG(0, "Invalid value for maxId\n"); + DEBUG(SSSDBG_FATAL_FAILURE, "Invalid value for maxId\n"); ret = EINVAL; goto done; } if (domain->id_max && (domain->id_max < domain->id_min)) { - DEBUG(0, "Invalid domain range\n"); + DEBUG(SSSDBG_FATAL_FAILURE, "Invalid domain range\n"); ret = EINVAL; goto done; } @@ -933,14 +947,16 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, ret = get_entry_as_bool(res->msgs[0], &domain->cache_credentials, CONFDB_DOMAIN_CACHE_CREDS, 0); if(ret != EOK) { - DEBUG(0, "Invalid value for %s\n", CONFDB_DOMAIN_CACHE_CREDS); + DEBUG(SSSDBG_FATAL_FAILURE, + "Invalid value for %s\n", CONFDB_DOMAIN_CACHE_CREDS); goto done; } ret = get_entry_as_bool(res->msgs[0], &domain->legacy_passwords, CONFDB_DOMAIN_LEGACY_PASS, 0); if(ret != EOK) { - DEBUG(0, "Invalid value for %s\n", CONFDB_DOMAIN_LEGACY_PASS); + DEBUG(SSSDBG_FATAL_FAILURE, + "Invalid value for %s\n", CONFDB_DOMAIN_LEGACY_PASS); goto done; } @@ -1044,7 +1060,8 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, CONFDB_PAM_PWD_EXPIRATION_WARNING, -1, &val); if (ret != EOK) { - DEBUG(1, "Failed to read PAM expiration warning, not fatal.\n"); + DEBUG(SSSDBG_CRIT_FAILURE, + "Failed to read PAM expiration warning, not fatal.\n"); val = -1; } } @@ -1060,7 +1077,8 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, ret = get_entry_as_uint32(res->msgs[0], &domain->override_gid, CONFDB_DOMAIN_OVERRIDE_GID, 0); if (ret != EOK) { - DEBUG(0, "Invalid value for [%s]\n", CONFDB_DOMAIN_OVERRIDE_GID); + DEBUG(SSSDBG_FATAL_FAILURE, + "Invalid value for [%s]\n", CONFDB_DOMAIN_OVERRIDE_GID); goto done; } @@ -1118,7 +1136,8 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb, ret = get_entry_as_bool(res->msgs[0], &domain->case_sensitive, CONFDB_DOMAIN_CASE_SENSITIVE, true); if(ret != EOK) { - DEBUG(0, "Invalid value for %s\n", CONFDB_DOMAIN_CASE_SENSITIVE); + DEBUG(SSSDBG_FATAL_FAILURE, + "Invalid value for %s\n", CONFDB_DOMAIN_CASE_SENSITIVE); goto done; } if (domain->case_sensitive == false && @@ -1178,18 +1197,19 @@ int confdb_get_domains(struct confdb_ctx *cdb, CONFDB_MONITOR_ACTIVE_DOMAINS, &domlist); if (ret == ENOENT) { - DEBUG(0, "No domains configured, fatal error!\n"); + DEBUG(SSSDBG_FATAL_FAILURE, "No domains configured, fatal error!\n"); goto done; } if (ret != EOK ) { - DEBUG(0, "Fatal error retrieving domains list!\n"); + DEBUG(SSSDBG_FATAL_FAILURE, "Fatal error retrieving domains list!\n"); goto done; } for (i = 0; domlist[i]; i++) { ret = confdb_get_domain_internal(cdb, cdb, domlist[i], &domain); if (ret) { - DEBUG(0, "Error (%d [%s]) retrieving domain [%s], skipping!\n", + DEBUG(SSSDBG_FATAL_FAILURE, + "Error (%d [%s]) retrieving domain [%s], skipping!\n", ret, strerror(ret), domlist[i]); continue; } @@ -1198,7 +1218,8 @@ int confdb_get_domains(struct confdb_ctx *cdb, } if (cdb->doms == NULL) { - DEBUG(0, "No properly configured domains, fatal error!\n"); + DEBUG(SSSDBG_FATAL_FAILURE, + "No properly configured domains, fatal error!\n"); ret = ENOENT; goto done; } diff --git a/src/confdb/confdb_setup.c b/src/confdb/confdb_setup.c index d7bf4bd40..857725f1a 100644 --- a/src/confdb/confdb_setup.c +++ b/src/confdb/confdb_setup.c @@ -56,7 +56,7 @@ int confdb_test(struct confdb_ctx *cdb) if (strcmp(values[0], CONFDB_VERSION) != 0) { /* Existing version does not match executable version */ - DEBUG(1, "Upgrading confdb version from %s to %s\n", + DEBUG(SSSDBG_CRIT_FAILURE, "Upgrading confdb version from %s to %s\n", values[0], CONFDB_VERSION); /* This is recoverable, since we purge the confdb file @@ -114,7 +114,8 @@ int confdb_create_base(struct confdb_ctx *cdb) while ((ldif = ldb_ldif_read_string(cdb->ldb, &base_ldif))) { ret = ldb_add(cdb->ldb, ldif->msg); if (ret != LDB_SUCCESS) { - DEBUG(0, "Failed to initialize DB (%d,[%s]), aborting!\n", + DEBUG(SSSDBG_FATAL_FAILURE, + "Failed to initialize DB (%d,[%s]), aborting!\n", ret, ldb_errstring(cdb->ldb)); return EIO; } |