summaryrefslogtreecommitdiffstats
path: root/src/confdb
diff options
context:
space:
mode:
Diffstat (limited to 'src/confdb')
-rw-r--r--src/confdb/confdb.c85
-rw-r--r--src/confdb/confdb_setup.c5
2 files changed, 56 insertions, 34 deletions
diff --git a/src/confdb/confdb.c b/src/confdb/confdb.c
index 57e373035..9a13f723d 100644
--- a/src/confdb/confdb.c
+++ b/src/confdb/confdb.c
@@ -210,7 +210,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;
@@ -286,7 +287,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;
@@ -411,7 +413,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;
}
@@ -466,7 +469,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;
}
@@ -516,7 +520,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;
}
@@ -556,7 +561,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;
}
@@ -572,7 +577,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;
}
@@ -608,7 +614,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;
@@ -647,7 +654,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;
}
@@ -657,7 +664,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;
@@ -784,7 +791,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;
}
@@ -797,7 +804,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;
}
@@ -819,7 +827,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;
@@ -827,7 +836,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;
}
@@ -841,7 +850,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;
}
@@ -850,7 +860,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;
}
@@ -859,7 +870,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;
}
@@ -877,7 +889,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;
@@ -885,7 +898,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;
}
}
@@ -897,7 +911,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;
}
@@ -914,7 +928,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;
}
@@ -922,13 +936,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;
}
@@ -937,14 +951,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;
}
@@ -1048,7 +1064,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;
}
}
@@ -1064,7 +1081,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;
}
@@ -1122,7 +1140,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 &&
@@ -1182,11 +1201,11 @@ 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;
}
@@ -1207,7 +1226,8 @@ int confdb_get_domains(struct confdb_ctx *cdb,
domain = NULL;
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;
}
@@ -1216,7 +1236,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;
}