summaryrefslogtreecommitdiffstats
path: root/server/confdb
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-09-18 12:35:34 +0200
committerStephen Gallagher <sgallagh@redhat.com>2009-09-21 10:35:10 -0400
commit8c50bd085c0efe5fde354deee2c8118887aae29d (patch)
treeb3968a8878c533438aef689b79825915e2720ef2 /server/confdb
parent9570ca098cd0e92d1eb6aabc00fb8cac9fddd442 (diff)
downloadsssd-8c50bd085c0efe5fde354deee2c8118887aae29d.tar.gz
sssd-8c50bd085c0efe5fde354deee2c8118887aae29d.tar.xz
sssd-8c50bd085c0efe5fde354deee2c8118887aae29d.zip
Use syslog for logging error conditions in SSSD
This is just a band-aid until ELAPI is fully functional and ready to use.
Diffstat (limited to 'server/confdb')
-rw-r--r--server/confdb/confdb.c36
-rw-r--r--server/confdb/confdb_setup.c24
2 files changed, 30 insertions, 30 deletions
diff --git a/server/confdb/confdb.c b/server/confdb/confdb.c
index 324946d2a..8cfdf952a 100644
--- a/server/confdb/confdb.c
+++ b/server/confdb/confdb.c
@@ -658,15 +658,15 @@ 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"));
+ SYSLOG_ERROR("Could not set up debug fn.\n");
talloc_free(cdb);
return EIO;
}
ret = ldb_connect(cdb->ldb, confdb_location, 0, NULL);
if (ret != LDB_SUCCESS) {
- DEBUG(0, ("Unable to open config database [%s]\n",
- confdb_location));
+ SYSLOG_ERROR("Unable to open config database [%s]\n",
+ confdb_location);
talloc_free(cdb);
return EIO;
}
@@ -739,7 +739,7 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
}
if (res->count != 1) {
- DEBUG(0, ("Unknown domain [%s]\n", name));
+ SYSLOG_ERROR("Unknown domain [%s]\n", name);
ret = ENOENT;
goto done;
}
@@ -752,7 +752,7 @@ 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"));
+ SYSLOG_ERROR("Invalid configuration entry, fatal error!\n");
ret = EINVAL;
goto done;
}
@@ -771,8 +771,8 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
}
}
else {
- DEBUG(0, ("Domain [%s] does not specify a provider, disabling!\n",
- domain->name));
+ SYSLOG_ERROR("Domain [%s] does not specify a provider, disabling!\n",
+ domain->name);
ret = EINVAL;
goto done;
}
@@ -786,9 +786,9 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
* superceeded. */
val = ldb_msg_find_attr_as_int(res->msgs[0], "enumerate", 0);
if (val > 0) { /* ok there was a number in here */
- DEBUG(0, ("Warning: enumeration parameter in %s still uses integers! "
- "Enumeration is now a boolean and takes true/false values. "
- "Interpreting as true\n", domain->name));
+ SYSLOG_ERROR("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;
} else { /* assume the new format */
if (ldb_msg_find_attr_as_bool(res->msgs[0], "enumerate", 0)) {
@@ -814,7 +814,7 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
ret = get_entry_as_uint32(res->msgs[0], &domain->id_min,
"minId", SSSD_MIN_ID);
if (ret != EOK) {
- DEBUG(0, ("Invalid value for minId\n"));
+ SYSLOG_ERROR("Invalid value for minId\n");
ret = EINVAL;
goto done;
}
@@ -822,13 +822,13 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
ret = get_entry_as_uint32(res->msgs[0], &domain->id_max,
"maxId", 0);
if (ret != EOK) {
- DEBUG(0, ("Invalid value for maxId\n"));
+ SYSLOG_ERROR("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"));
+ SYSLOG_ERROR("Invalid domain range\n");
ret = EINVAL;
goto done;
}
@@ -869,19 +869,19 @@ int confdb_get_domains(struct confdb_ctx *cdb,
ret = confdb_get_string_as_list(cdb, tmp_ctx,
CONFDB_DOMAINS_PATH, "domains", &domlist);
if (ret == ENOENT) {
- DEBUG(0, ("No domains configured, fatal error!\n"));
+ SYSLOG_ERROR("No domains configured, fatal error!\n");
goto done;
}
if (ret != EOK ) {
- DEBUG(0, ("Fatal error retrieving domains list!\n"));
+ SYSLOG_ERROR("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",
- ret, strerror(ret), domlist[i]));
+ SYSLOG_ERROR("Error (%d [%s]) retrieving domain [%s], skipping!\n",
+ ret, strerror(ret), domlist[i]);
ret = EOK;
continue;
}
@@ -896,7 +896,7 @@ int confdb_get_domains(struct confdb_ctx *cdb,
}
if (cdb->doms == NULL) {
- DEBUG(0, ("No properly configured domains, fatal error!\n"));
+ SYSLOG_ERROR("No properly configured domains, fatal error!\n");
ret = ENOENT;
goto done;
}
diff --git a/server/confdb/confdb_setup.c b/server/confdb/confdb_setup.c
index 00bba7f11..3c2cb7151 100644
--- a/server/confdb/confdb_setup.c
+++ b/server/confdb/confdb_setup.c
@@ -110,8 +110,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",
- ret, ldb_errstring(cdb->ldb)));
+ SYSLOG_ERROR("Failed to initialize DB (%d,[%s]), aborting!\n",
+ ret, ldb_errstring(cdb->ldb));
return EIO;
}
ldb_ldif_read_free(cdb->ldb, ldif);
@@ -279,13 +279,13 @@ int confdb_init_db(const char *config_file, struct confdb_ctx *cdb)
/* ok, first of all stat conf file */
ret = stat(config_file, &cstat);
if (ret != 0) {
- DEBUG(0, ("Unable to stat config file [%s]! (%d [%s])\n",
- config_file, errno, strerror(errno)));
+ SYSLOG_ERROR("Unable to stat config file [%s]! (%d [%s])\n",
+ config_file, errno, strerror(errno));
return errno;
}
ret = snprintf(timestr, 21, "%llu", (long long unsigned)cstat.st_mtime);
if (ret <= 0 || ret >= 21) {
- DEBUG(0, ("Failed to convert time_t to string ??\n"));
+ SYSLOG_ERROR("Failed to convert time_t to string ??\n");
return errno ? errno: EFAULT;
}
@@ -303,7 +303,7 @@ int confdb_init_db(const char *config_file, struct confdb_ctx *cdb)
/* Set up a transaction to replace the configuration */
ret = ldb_transaction_start(cdb->ldb);
if (ret != LDB_SUCCESS) {
- DEBUG(0, ("Failed to start a transaction for updating the configuration\n"));
+ SYSLOG_ERROR("Failed to start a transaction for updating the configuration\n");
talloc_free(tmp_ctx);
return sysdb_error_to_errno(ret);
}
@@ -311,7 +311,7 @@ int confdb_init_db(const char *config_file, struct confdb_ctx *cdb)
/* Purge existing database */
ret = confdb_purge(cdb);
if (ret != EOK) {
- DEBUG(0, ("Could not purge existing configuration\n"));
+ SYSLOG_ERROR("Could not purge existing configuration\n");
goto done;
}
@@ -319,8 +319,8 @@ int confdb_init_db(const char *config_file, struct confdb_ctx *cdb)
ret = config_from_file("sssd", config_file, &sssd_config,
INI_STOP_ON_ANY, &error_list);
if (ret != EOK) {
- DEBUG(0, ("Parse error reading configuration file [%s]\n",
- config_file));
+ SYSLOG_ERROR("Parse error reading configuration file [%s]\n",
+ config_file);
print_file_parsing_errors(stderr, error_list);
free_ini_config_errors(error_list);
free_ini_config(sssd_config);
@@ -330,7 +330,7 @@ int confdb_init_db(const char *config_file, struct confdb_ctx *cdb)
ret = confdb_create_ldif(tmp_ctx, sssd_config, &config_ldif);
free_ini_config(sssd_config);
if (ret != EOK) {
- DEBUG(0, ("Could not create LDIF for confdb\n"));
+ SYSLOG_ERROR("Could not create LDIF for confdb\n");
goto done;
}
@@ -340,8 +340,8 @@ int confdb_init_db(const char *config_file, struct confdb_ctx *cdb)
while ((ldif = ldb_ldif_read_string(cdb->ldb, (const char **)&config_ldif))) {
ret = ldb_add(cdb->ldb, ldif->msg);
if (ret != LDB_SUCCESS) {
- DEBUG(0, ("Failed to initialize DB (%d,[%s]), aborting!\n",
- ret, ldb_errstring(cdb->ldb)));
+ SYSLOG_ERROR("Failed to initialize DB (%d,[%s]), aborting!\n",
+ ret, ldb_errstring(cdb->ldb));
ret = EIO;
goto done;
}