summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2009-09-22 13:11:29 -0400
committerSimo Sorce <ssorce@redhat.com>2009-09-23 07:33:31 -0400
commit87b8670b2749d02ffdc6c06506ac692b09db5be2 (patch)
treeead3f62f72c3522d3dc7703cd9f009aabc86a023 /server
parent091df02f920b5f5a658962d3add6f965d84375ac (diff)
downloadsssd-87b8670b2749d02ffdc6c06506ac692b09db5be2.tar.gz
sssd-87b8670b2749d02ffdc6c06506ac692b09db5be2.tar.bz2
sssd-87b8670b2749d02ffdc6c06506ac692b09db5be2.zip
Revert "Use syslog for logging error conditions in SSSD"
This reverts commit 8c50bd085c0efe5fde354deee2c8118887aae29d. Amended: commit 1016af2b1b97ad4290ccce8fa462cc7e3c191b2e also made use of the SYSLOG_ERROR() macro, so those portions of that code also needed to be reverted.
Diffstat (limited to 'server')
-rw-r--r--server/confdb/confdb.c46
-rw-r--r--server/confdb/confdb_setup.c24
-rw-r--r--server/db/sysdb.c66
-rw-r--r--server/db/sysdb_ops.c10
-rw-r--r--server/monitor/monitor.c185
-rw-r--r--server/monitor/monitor_sbus.c12
-rw-r--r--server/providers/data_provider.c64
-rw-r--r--server/providers/data_provider_be.c76
-rw-r--r--server/providers/dp_auth_util.c12
-rw-r--r--server/providers/krb5/krb5_auth.c4
-rw-r--r--server/providers/ldap/ldap_id.c4
-rw-r--r--server/providers/ldap/sdap.c66
-rw-r--r--server/providers/ldap/sdap_async.c6
-rw-r--r--server/providers/proxy.c24
-rw-r--r--server/responder/common/responder_common.c52
-rw-r--r--server/responder/common/responder_dp.c24
-rw-r--r--server/responder/nss/nsssrv.c28
-rw-r--r--server/responder/nss/nsssrv_cmd.c52
-rw-r--r--server/responder/pam/pam_LOCAL_domain.c2
-rw-r--r--server/responder/pam/pamsrv.c14
-rw-r--r--server/responder/pam/pamsrv_cache.c2
-rw-r--r--server/responder/pam/pamsrv_cmd.c6
-rw-r--r--server/responder/pam/pamsrv_dp.c12
-rw-r--r--server/sbus/sssd_dbus_common.c8
-rw-r--r--server/sbus/sssd_dbus_connection.c10
-rw-r--r--server/tools/tools_util.c3
-rw-r--r--server/util/debug.c1
-rw-r--r--server/util/server.c34
-rw-r--r--server/util/util.h16
29 files changed, 403 insertions, 460 deletions
diff --git a/server/confdb/confdb.c b/server/confdb/confdb.c
index ffd839db..bb1fc2b2 100644
--- a/server/confdb/confdb.c
+++ b/server/confdb/confdb.c
@@ -665,15 +665,15 @@ int confdb_init(TALLOC_CTX *mem_ctx,
ret = ldb_set_debug(cdb->ldb, ldb_debug_messages, NULL);
if (ret != LDB_SUCCESS) {
- SYSLOG_ERROR("Could not set up debug fn.\n");
+ DEBUG(0,("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) {
- SYSLOG_ERROR("Unable to open config database [%s]\n",
- confdb_location);
+ DEBUG(0, ("Unable to open config database [%s]\n",
+ confdb_location));
talloc_free(cdb);
return EIO;
}
@@ -785,7 +785,7 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
}
if (res->count != 1) {
- SYSLOG_ERROR("Unknown domain [%s]\n", name);
+ DEBUG(0, ("Unknown domain [%s]\n", name));
ret = ENOENT;
goto done;
}
@@ -798,7 +798,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) {
- SYSLOG_ERROR("Invalid configuration entry, fatal error!\n");
+ DEBUG(0, ("Invalid configuration entry, fatal error!\n"));
ret = EINVAL;
goto done;
}
@@ -817,8 +817,8 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
}
}
else {
- SYSLOG_ERROR("Domain [%s] does not specify a provider, disabling!\n",
- domain->name);
+ DEBUG(0, ("Domain [%s] does not specify a provider, disabling!\n",
+ domain->name));
ret = EINVAL;
goto done;
}
@@ -832,15 +832,15 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
* superceeded. */
val = ldb_msg_find_attr_as_int(res->msgs[0], CONFDB_ENUMERATE, 0);
if (val > 0) { /* ok there was a number in here */
- 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);
+ 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));
domain->enumerate = true;
} else { /* assume the new format */
ret = get_entry_as_bool(res->msgs[0], &domain->enumerate,
CONFDB_ENUMERATE, 0);
if(ret != EOK) {
- SYSLOG_ERROR("Invalid value for %s\n", CONFDB_ENUMERATE);
+ DEBUG(0, ("Invalid value for %s\n", CONFDB_ENUMERATE));
goto done;
}
}
@@ -851,7 +851,7 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
/* Determine if this is domain uses MPG */
ret = get_entry_as_bool(res->msgs[0], &domain->mpg, CONFDB_MPG, 0);
if(ret != EOK) {
- SYSLOG_ERROR("Invalid value for %s\n", CONFDB_MPG);
+ DEBUG(0, ("Invalid value for %s\n", CONFDB_MPG));
goto done;
}
@@ -864,14 +864,14 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
* in NSS interfaces */
ret = get_entry_as_bool(res->msgs[0], &domain->fqnames, CONFDB_FQ, 0);
if(ret != EOK) {
- SYSLOG_ERROR("Invalid value for %s\n", CONFDB_FQ);
+ DEBUG(0, ("Invalid value for %s\n", CONFDB_FQ));
goto done;
}
ret = get_entry_as_uint32(res->msgs[0], &domain->id_min,
CONFDB_MINID, SSSD_MIN_ID);
if (ret != EOK) {
- SYSLOG_ERROR("Invalid value for minId\n");
+ DEBUG(0, ("Invalid value for minId\n"));
ret = EINVAL;
goto done;
}
@@ -879,13 +879,13 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
ret = get_entry_as_uint32(res->msgs[0], &domain->id_max,
CONFDB_MAXID, 0);
if (ret != EOK) {
- SYSLOG_ERROR("Invalid value for maxId\n");
+ DEBUG(0, ("Invalid value for maxId\n"));
ret = EINVAL;
goto done;
}
if (domain->id_max && (domain->id_max < domain->id_min)) {
- SYSLOG_ERROR("Invalid domain range\n");
+ DEBUG(0, ("Invalid domain range\n"));
ret = EINVAL;
goto done;
}
@@ -894,14 +894,14 @@ static int confdb_get_domain_internal(struct confdb_ctx *cdb,
ret = get_entry_as_bool(res->msgs[0], &domain->cache_credentials,
CONFDB_CACHE_CREDS, 0);
if(ret != EOK) {
- SYSLOG_ERROR("Invalid value for %s\n", CONFDB_CACHE_CREDS);
+ DEBUG(0, ("Invalid value for %s\n", CONFDB_CACHE_CREDS));
goto done;
}
ret = get_entry_as_bool(res->msgs[0], &domain->legacy_passwords,
CONFDB_LEGACY_PASS, 0);
if(ret != EOK) {
- SYSLOG_ERROR("Invalid value for %s\n", CONFDB_LEGACY_PASS);
+ DEBUG(0, ("Invalid value for %s\n", CONFDB_LEGACY_PASS));
goto done;
}
@@ -932,19 +932,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) {
- SYSLOG_ERROR("No domains configured, fatal error!\n");
+ DEBUG(0, ("No domains configured, fatal error!\n"));
goto done;
}
if (ret != EOK ) {
- SYSLOG_ERROR("Fatal error retrieving domains list!\n");
+ DEBUG(0, ("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) {
- SYSLOG_ERROR("Error (%d [%s]) retrieving domain [%s], skipping!\n",
- ret, strerror(ret), domlist[i]);
+ DEBUG(0, ("Error (%d [%s]) retrieving domain [%s], skipping!\n",
+ ret, strerror(ret), domlist[i]));
ret = EOK;
continue;
}
@@ -959,7 +959,7 @@ int confdb_get_domains(struct confdb_ctx *cdb,
}
if (cdb->doms == NULL) {
- SYSLOG_ERROR("No properly configured domains, fatal error!\n");
+ DEBUG(0, ("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 3c2cb715..00bba7f1 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) {
- SYSLOG_ERROR("Failed to initialize DB (%d,[%s]), aborting!\n",
- ret, ldb_errstring(cdb->ldb));
+ DEBUG(0, ("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) {
- SYSLOG_ERROR("Unable to stat config file [%s]! (%d [%s])\n",
- config_file, errno, strerror(errno));
+ DEBUG(0, ("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) {
- SYSLOG_ERROR("Failed to convert time_t to string ??\n");
+ DEBUG(0, ("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) {
- SYSLOG_ERROR("Failed to start a transaction for updating the configuration\n");
+ DEBUG(0, ("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) {
- SYSLOG_ERROR("Could not purge existing configuration\n");
+ DEBUG(0, ("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) {
- SYSLOG_ERROR("Parse error reading configuration file [%s]\n",
- config_file);
+ DEBUG(0, ("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) {
- SYSLOG_ERROR("Could not create LDIF for confdb\n");
+ DEBUG(0, ("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) {
- SYSLOG_ERROR("Failed to initialize DB (%d,[%s]), aborting!\n",
- ret, ldb_errstring(cdb->ldb));
+ DEBUG(0, ("Failed to initialize DB (%d,[%s]), aborting!\n",
+ ret, ldb_errstring(cdb->ldb)));
ret = EIO;
goto done;
}
diff --git a/server/db/sysdb.c b/server/db/sysdb.c
index b63a5a49..87d0de96 100644
--- a/server/db/sysdb.c
+++ b/server/db/sysdb.c
@@ -808,16 +808,16 @@ static int sysdb_upgrade_02(struct confdb_ctx *cdb,
}
if (strcmp(version, SYSDB_VERSION_0_2) != 0) {
- SYSLOG_ERROR("Wrong DB version [%s],"
- " expected [%s] for this upgrade!\n",
- version, SYSDB_VERSION);
+ DEBUG(0,("Wrong DB version [%s],"
+ " expected [%s] for this upgrade!\n",
+ version, SYSDB_VERSION));
ret = EINVAL;
goto done;
}
}
talloc_zfree(res);
- SYSLOG_NOTICE("UPGRADING DB TO VERSION %s\n", SYSDB_VERSION_0_3);
+ DEBUG(0, ("UPGRADING DB TO VERSION %s\n", SYSDB_VERSION_0_3));
/* ldb uses posix locks,
* posix is stupid and kills all locks when you close *any* file
@@ -924,18 +924,18 @@ static int sysdb_upgrade_02(struct confdb_ctx *cdb,
ret = ldb_add(ctx->ldb, msg);
if (ret != LDB_SUCCESS) {
- SYSLOG_ERROR("WARNING: Could not add entry %s,"
- " to new ldb file! (%d [%s])\n",
- ldb_dn_get_linearized(msg->dn),
- ret, ldb_errstring(ctx->ldb));
+ DEBUG(0, ("WARNING: Could not add entry %s,"
+ " to new ldb file! (%d [%s])\n",
+ ldb_dn_get_linearized(msg->dn),
+ ret, ldb_errstring(ctx->ldb)));
}
ret = ldb_delete(local->ldb, msg->dn);
if (ret != LDB_SUCCESS) {
- SYSLOG_ERROR("WARNING: Could not remove entry %s,"
- " from old ldb file! (%d [%s])\n",
- ldb_dn_get_linearized(msg->dn),
- ret, ldb_errstring(local->ldb));
+ DEBUG(0, ("WARNING: Could not remove entry %s,"
+ " from old ldb file! (%d [%s])\n",
+ ldb_dn_get_linearized(msg->dn),
+ ret, ldb_errstring(local->ldb)));
}
}
@@ -1129,8 +1129,8 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
}
if (!allow_upgrade) {
- SYSLOG_ERROR("Wrong DB version (got %s expected %s)\n",
- version, SYSDB_VERSION);
+ DEBUG(0, ("Wrong DB version (got %s expected %s)\n",
+ version, SYSDB_VERSION));
ret = EINVAL;
goto done;
}
@@ -1144,8 +1144,8 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
if (strcmp(version, SYSDB_VERSION_0_2) == 0) {
/* if this is not local we have a big problem */
if (strcasecmp(domain->provider, "local") != 0) {
- SYSLOG_ERROR("Fatal: providers other than 'local'"
- " shouldn't present v0.2, db corrupted?\n");
+ DEBUG(0, ("Fatal: providers other than 'local'"
+ " shouldn't present v0.2, db corrupted?\n"));
ret = EFAULT;
goto done;
}
@@ -1155,9 +1155,9 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
if (need_02_upgrade) {
*need_02_upgrade = true;
} else {
- SYSLOG_ERROR("DB file seem to need an upgrade,"
- " but upgrade flag is not provided,"
- " db corrupted?\n");
+ DEBUG(0, ("DB file seem to need an upgrade,"
+ " but upgrade flag is not provided,"
+ " db corrupted?\n"));
ret = EFAULT;
goto done;
}
@@ -1168,8 +1168,8 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
}
- SYSLOG_ERROR("Unknown DB version [%s], expected [%s] for domain %s!\n",
- version?version:"not found", SYSDB_VERSION, domain->name);
+ DEBUG(0,("Unknown DB version [%s], expected [%s] for domain %s!\n",
+ version?version:"not found", SYSDB_VERSION, domain->name));
ret = EINVAL;
goto done;
}
@@ -1180,8 +1180,8 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
while ((ldif = ldb_ldif_read_string(ctx->ldb, &base_ldif))) {
ret = ldb_add(ctx->ldb, ldif->msg);
if (ret != LDB_SUCCESS) {
- SYSLOG_ERROR("Failed to initialize DB (%d, [%s]) for domain %s!",
- ret, ldb_errstring(ctx->ldb), domain->name);
+ DEBUG(0, ("Failed to initialize DB (%d, [%s]) for domain %s!",
+ ret, ldb_errstring(ctx->ldb), domain->name));
ret = EIO;
goto done;
}
@@ -1208,8 +1208,8 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
/* do a synchronous add */
ret = ldb_add(ctx->ldb, msg);
if (ret != LDB_SUCCESS) {
- SYSLOG_ERROR("Failed to initialize DB (%d, [%s]) for domain %s!",
- ret, ldb_errstring(ctx->ldb), domain->name);
+ DEBUG(0, ("Failed to initialize DB (%d, [%s]) for domain %s!",
+ ret, ldb_errstring(ctx->ldb), domain->name));
ret = EIO;
goto done;
}
@@ -1236,8 +1236,8 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
/* do a synchronous add */
ret = ldb_add(ctx->ldb, msg);
if (ret != LDB_SUCCESS) {
- SYSLOG_ERROR("Failed to initialize DB (%d, [%s]) for domain %s!",
- ret, ldb_errstring(ctx->ldb), domain->name);
+ DEBUG(0, ("Failed to initialize DB (%d, [%s]) for domain %s!",
+ ret, ldb_errstring(ctx->ldb), domain->name));
ret = EIO;
goto done;
}
@@ -1264,8 +1264,8 @@ static int sysdb_domain_init_internal(TALLOC_CTX *mem_ctx,
/* do a synchronous add */
ret = ldb_add(ctx->ldb, msg);
if (ret != LDB_SUCCESS) {
- SYSLOG_ERROR("Failed to initialize DB (%d, [%s]) for domain %s!",
- ret, ldb_errstring(ctx->ldb), domain->name);
+ DEBUG(0, ("Failed to initialize DB (%d, [%s]) for domain %s!",
+ ret, ldb_errstring(ctx->ldb), domain->name));
ret = EIO;
goto done;
}
@@ -1360,10 +1360,10 @@ int sysdb_init(TALLOC_CTX *mem_ctx,
ret = sysdb_upgrade_02(cdb, ev, ctx, ctx_list);
if (ret != EOK) {
- SYSLOG_ERROR("FATAL: Upgrade form db version %s failed!\n",
- SYSDB_VERSION_0_2);
- SYSLOG_ERROR("You can find a backup of the database "
- "in file named %s.bak", ctx->ldb_file);
+ DEBUG(0, ("FATAL: Upgrade form db version %d failed!\n",
+ SYSDB_VERSION_0_2));
+ DEBUG(0, ("You can find a backup of the database here: %s\n",
+ backup_file));
talloc_zfree(ctx_list);
return ret;
}
diff --git a/server/db/sysdb_ops.c b/server/db/sysdb_ops.c
index c0a48328..3a53c9e5 100644
--- a/server/db/sysdb_ops.c
+++ b/server/db/sysdb_ops.c
@@ -1352,8 +1352,8 @@ static void sysdb_get_new_id_base(struct tevent_req *subreq)
if ((state->domain->id_max != 0) &&
(state->new_id > state->domain->id_max)) {
- SYSLOG_ERROR("Failed to allocate new id, out of range (%u/%u)\n",
- state->new_id, state->domain->id_max);
+ DEBUG(0, ("Failed to allocate new id, out of range (%u/%u)\n",
+ state->new_id, state->domain->id_max));
tevent_req_error(req, ERANGE);
return;
}
@@ -1484,8 +1484,8 @@ static void sysdb_get_new_id_verify(struct tevent_req *subreq)
/* check again we are not falling out of range */
if ((state->domain->id_max != 0) &&
(state->new_id > state->domain->id_max)) {
- SYSLOG_ERROR("Failed to allocate new id, out of range (%u/%u)\n",
- state->new_id, state->domain->id_max);
+ DEBUG(0, ("Failed to allocate new id, out of range (%u/%u)\n",
+ state->new_id, state->domain->id_max));
tevent_req_error(req, ERANGE);
return;
}
@@ -1733,7 +1733,7 @@ struct tevent_req *sysdb_add_user_send(TALLOC_CTX *mem_ctx,
if (domain->mpg) {
if (gid != 0) {
- SYSLOG_ERROR("Cannot add user with arbitrary GID in MPG domain!\n");
+ DEBUG(0, ("Cannot add user with arbitrary GID in MPG domain!\n"));
ERROR_OUT(ret, EINVAL, fail);
}
state->gid = state->uid;
diff --git a/server/monitor/monitor.c b/server/monitor/monitor.c
index b052865f..44ce5f2c 100644
--- a/server/monitor/monitor.c
+++ b/server/monitor/monitor.c
@@ -59,8 +59,6 @@
#define MONITOR_DEF_PING_TIME 10
#define MONITOR_CONF_ENTRY "config/services/monitor"
-#define PRG_NAME "sssd"
-
struct svc_spy;
struct mt_svc {
@@ -199,7 +197,7 @@ static int client_registration(DBusMessage *message,
data = sbus_conn_get_private_data(conn);
mini = talloc_get_type(data, struct mon_init_conn);
if (!mini) {
- SYSLOG_ERROR("Connection holds no valid init data\n");
+ DEBUG(0, ("Connection holds no valid init data\n"));
return EINVAL;
}
@@ -232,8 +230,8 @@ static int client_registration(DBusMessage *message,
svc = svc->next;
}
if (!svc) {
- SYSLOG_ERROR("Unable to find peer [%s] in list of services,"
- " killing connection!\n", svc_name);
+ DEBUG(0, ("Unable to find peer [%s] in list of services,"
+ " killing connection!\n", svc_name));
sbus_disconnect(conn);
/* FIXME: should we just talloc_zfree(conn) ? */
goto done;
@@ -247,7 +245,7 @@ static int client_registration(DBusMessage *message,
* try to access or even free, freed memory. */
ret = add_svc_conn_spy(svc);
if (ret) {
- SYSLOG_ERROR("Failed to attch spy\n");
+ DEBUG(0, ("Failed to attch spy\n"));
goto done;
}
@@ -371,7 +369,7 @@ static void svc_try_restart(struct mt_svc *svc, time_t now)
/* restart the process */
if (svc->restarts > 3) { /* TODO: get val from config */
- SYSLOG_ERROR("Process [%s], definitely stopped!\n", svc->name);
+ DEBUG(0, ("Process [%s], definitely stopped!\n", svc->name));
talloc_free(svc);
return;
}
@@ -383,7 +381,7 @@ static void svc_try_restart(struct mt_svc *svc, time_t now)
ret = start_service(svc, false);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to restart service '%s'\n", svc->name);
+ DEBUG(0,("Failed to restart service '%s'\n", svc->name));
talloc_free(svc);
return;
}
@@ -468,8 +466,8 @@ static void set_tasks_checker(struct mt_svc *svc)
tv.tv_usec = 0;
te = tevent_add_timer(svc->mt_ctx->ev, svc, tv, tasks_check_handler, svc);
if (te == NULL) {
- SYSLOG_ERROR("failed to add event, monitor offline for [%s]!\n",
- svc->name);
+ DEBUG(0, ("failed to add event, monitor offline for [%s]!\n",
+ svc->name));
/* FIXME: shutdown ? */
}
svc->ping_ev = te;
@@ -491,8 +489,8 @@ static void global_checks_handler(struct tevent_context *ev,
}
if (pid == -1) {
- SYSLOG_ERROR("waitpid returned -1 (errno:%d[%s])\n",
- errno, strerror(errno));
+ DEBUG(0, ("waitpid returned -1 (errno:%d[%s])\n",
+ errno, strerror(errno)));
goto done;
}
@@ -506,7 +504,7 @@ static void global_checks_handler(struct tevent_context *ev,
}
}
if (svc == NULL) {
- SYSLOG_ERROR("Unknown child (%d) did exit\n", pid);
+ DEBUG(0, ("Unknown child (%d) did exit\n", pid));
}
done:
@@ -523,7 +521,7 @@ static void set_global_checker(struct mt_ctx *ctx)
tv.tv_usec = 0;
te = tevent_add_timer(ctx->ev, ctx, tv, global_checks_handler, ctx);
if (te == NULL) {
- SYSLOG_ERROR("failed to add global checker event! PANIC TIME!\n");
+ DEBUG(0, ("failed to add global checker event! PANIC TIME!\n"));
/* FIXME: is this right ? shoulkd we try to clean up first ?*/
exit(-1);
}
@@ -534,9 +532,9 @@ static int monitor_kill_service (struct mt_svc *svc)
int ret;
ret = kill(svc->pid, SIGTERM);
if (ret != EOK) {
- SYSLOG_ERROR("Sending signal to child (%s:%d) failed! "
- "Ignore and pretend child is dead.\n",
- svc->name, svc->pid);
+ DEBUG(0,("Sending signal to child (%s:%d) failed! "
+ "Ignore and pretend child is dead.\n",
+ svc->name, svc->pid));
}
return ret;
@@ -554,8 +552,8 @@ static void shutdown_reply(DBusPendingCall *pending, void *data)
* until reply is valid or timeout has occurred. If reply is NULL
* here, something is seriously wrong and we should bail out.
*/
- SYSLOG_ERROR("A reply callback was called but no reply was received"
- " and no timeout occurred\n");
+ DEBUG(0, ("A reply callback was called but no reply was received"
+ " and no timeout occurred\n"));
/* Destroy this connection */
monitor_kill_service(svc);
@@ -572,7 +570,7 @@ static void shutdown_reply(DBusPendingCall *pending, void *data)
/* Something went wrong on the client side
* Time to forcibly kill the service
*/
- SYSLOG_ERROR("Received an error shutting down service.\n");
+ DEBUG(0, ("Received an error shutting down service.\n"));
monitor_kill_service(svc);
}
@@ -606,7 +604,7 @@ static int monitor_shutdown_service(struct mt_svc *svc)
MONITOR_INTERFACE,
MON_CLI_METHOD_SHUTDOWN);
if (!msg) {
- SYSLOG_ERROR("Out of memory?!\n");
+ DEBUG(0,("Out of memory?!\n"));
monitor_kill_service(svc);
talloc_free(svc);
return ENOMEM;
@@ -615,7 +613,7 @@ static int monitor_shutdown_service(struct mt_svc *svc)
dbret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply,
svc->mt_ctx->service_id_timeout);
if (!dbret || pending_reply == NULL) {
- SYSLOG_ERROR("D-BUS send failed.\n");
+ DEBUG(0, ("D-BUS send failed.\n"));
dbus_message_unref(msg);
monitor_kill_service(svc);
talloc_free(svc);
@@ -640,8 +638,8 @@ static void reload_reply(DBusPendingCall *pending, void *data)
* until reply is valid or timeout has occurred. If reply is NULL
* here, something is seriously wrong and we should bail out.
*/
- SYSLOG_ERROR("A reply callback was called but no reply was received"
- " and no timeout occurred\n");
+ DEBUG(0, ("A reply callback was called but no reply was received"
+ " and no timeout occurred\n"));
/* Destroy this connection */
sbus_disconnect(svc->conn);
@@ -665,7 +663,7 @@ static int monitor_signal_reconf(struct config_file_ctx *file_ctx,
/* Update the confdb configuration */
ret = confdb_init_db(filename, file_ctx->mt_ctx->cdb);
if (ret != EOK) {
- SYSLOG_ERROR("Could not reload configuration!");
+ DEBUG(0, ("Could not reload configuration!"));
kill(getpid(), SIGTERM);
return ret;
}
@@ -721,7 +719,7 @@ static int service_signal(struct mt_svc *svc, const char *svc_signal)
MONITOR_INTERFACE,
svc_signal);
if (!msg) {
- SYSLOG_ERROR("Out of memory?!\n");
+ DEBUG(0,("Out of memory?!\n"));
monitor_kill_service(svc);
talloc_free(svc);
return ENOMEM;
@@ -730,7 +728,7 @@ static int service_signal(struct mt_svc *svc, const char *svc_signal)
dbret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply,
svc->mt_ctx->service_id_timeout);
if (!dbret || pending_reply == NULL) {
- SYSLOG_ERROR("D-BUS send failed.\n");
+ DEBUG(0, ("D-BUS send failed.\n"));
dbus_message_unref(msg);
monitor_kill_service(svc);
talloc_free(svc);
@@ -856,12 +854,12 @@ int get_monitor_config(struct mt_ctx *ctx)
SERVICE_CONF_ENTRY, "activeServices",
&ctx->services);
if (ret != EOK) {
- SYSLOG_ERROR("No services configured\n");
+ DEBUG(0, ("No services configured!\n"));
return EINVAL;
}
ret = append_data_provider(ctx);
if (ret != EOK) {
- SYSLOG_ERROR("Could not add Data Provider to the list of services!\n");
+ DEBUG(0, ("Could not add Data Provider to the list of services!\n"));
return ret;
}
@@ -871,13 +869,13 @@ int get_monitor_config(struct mt_ctx *ctx)
}
ret = confdb_get_domains(ctx->cdb, &ctx->domains);
if (ret != EOK) {
- SYSLOG_ERROR("No domains configured.\n");
+ DEBUG(0, ("No domains configured.\n"));
return ret;
}
ret = check_local_domain_unique(ctx->domains);
if (ret != EOK) {
- SYSLOG_ERROR("More than one local domain configured.\n");
+ DEBUG(0, ("More than one local domain configured.\n"));
return ret;
}
@@ -926,7 +924,7 @@ static int get_service_config(struct mt_ctx *ctx, const char *name,
ret = confdb_get_string(ctx->cdb, svc, path, "command",
NULL, &svc->command);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to start service '%s'\n", svc->name);
+ DEBUG(0,("Failed to start service '%s'\n", svc->name));
talloc_free(svc);
return ret;
}
@@ -946,7 +944,7 @@ static int get_service_config(struct mt_ctx *ctx, const char *name,
ret = confdb_get_int(ctx->cdb, svc, path, "timeout",
MONITOR_DEF_PING_TIME, &svc->ping_time);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to start service '%s'\n", svc->name);
+ DEBUG(0,("Failed to start service '%s'\n", svc->name));
talloc_free(svc);
return ret;
}
@@ -966,7 +964,7 @@ static int add_new_service(struct mt_ctx *ctx, const char *name, bool startup)
ret = start_service(svc, startup);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to start service '%s'\n", svc->name);
+ DEBUG(0,("Failed to start service '%s'\n", svc->name));
talloc_free(svc);
}
@@ -1011,7 +1009,7 @@ static int get_provider_config(struct mt_ctx *ctx, const char *name,
ret = confdb_get_string(ctx->cdb, svc, path,
"provider", NULL, &svc->provider);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to find provider from [%s] configuration\n", name);
+ DEBUG(0, ("Failed to find provider from [%s] configuration\n", name));
talloc_free(svc);
return ret;
}
@@ -1019,7 +1017,7 @@ static int get_provider_config(struct mt_ctx *ctx, const char *name,
ret = confdb_get_string(ctx->cdb, svc, path,
"command", NULL, &svc->command);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to find command from [%s] configuration\n", name);
+ DEBUG(0, ("Failed to find command from [%s] configuration\n", name));
talloc_free(svc);
return ret;
}
@@ -1027,7 +1025,7 @@ static int get_provider_config(struct mt_ctx *ctx, const char *name,
ret = confdb_get_int(ctx->cdb, svc, path, "timeout",
MONITOR_DEF_PING_TIME, &svc->ping_time);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to start service '%s'\n", svc->name);
+ DEBUG(0,("Failed to start service '%s'\n", svc->name));
talloc_free(svc);
return ret;
}
@@ -1064,14 +1062,14 @@ static int add_new_provider(struct mt_ctx *ctx, const char *name, bool startup)
ret = get_provider_config(ctx, name, &svc);
if (ret != EOK) {
- SYSLOG_ERROR("Could not get provider configuration for [%s]\n",
- name);
+ DEBUG(0, ("Could not get provider configuration for [%s]\n",
+ name));
return ret;
}
ret = start_service(svc, startup);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to start service '%s'\n", svc->name);
+ DEBUG(0,("Failed to start service '%s'\n", svc->name));
talloc_free(svc);
}
@@ -1097,7 +1095,8 @@ static void remove_service(struct mt_ctx *ctx, const char *name)
/* Shut it down */
ret = monitor_shutdown_service(cur_svc);
if (ret != EOK) {
- SYSLOG_ERROR("Unable to shut down service [%s]!", name);
+ DEBUG(0, ("Unable to shut down service [%s]!",
+ name));
/* TODO: Handle this better */
}
}
@@ -1159,7 +1158,7 @@ static int update_monitor_config(struct mt_ctx *ctx)
break;
}
if (cur_svc == NULL) {
- SYSLOG_ERROR("Service entry missing data\n");
+ DEBUG(0, ("Service entry missing data\n"));
/* This shouldn't be possible, but if it happens
* we'll throw an error
*/
@@ -1172,9 +1171,9 @@ static int update_monitor_config(struct mt_ctx *ctx)
*/
ret = get_service_config(ctx, new_config->services[i], &new_svc);
if (ret != EOK) {
- SYSLOG_ERROR("Unable to determine if service has changed.\n");
- SYSLOG_ERROR("Disabling service [%s].\n",
- new_config->services[i]);
+ DEBUG(0, ("Unable to determine if service has changed.\n"));
+ DEBUG(0, ("Disabling service [%s].\n",
+ new_config->services[i]));
/* Not much we can do here, no way to know whether the
* current configuration is safe, and restarting the
* service won't work because the new startup requires
@@ -1247,7 +1246,7 @@ static int update_monitor_config(struct mt_ctx *ctx)
cur_svc = cur_svc->next;
}
if (cur_svc == NULL) {
- SYSLOG_ERROR("Service entry missing data for [%s]\n", new_dom->name);
+ DEBUG(0, ("Service entry missing data for [%s]\n", new_dom->name));
/* This shouldn't be possible
*/
talloc_free(new_config);
@@ -1259,9 +1258,9 @@ static int update_monitor_config(struct mt_ctx *ctx)
*/
ret = get_provider_config(ctx, new_dom->name, &new_svc);
if (ret != EOK) {
- SYSLOG_ERROR("Unable to determine if service has changed.\n");
- SYSLOG_ERROR("Disabling service [%s].\n",
- new_config->services[i]);
+ DEBUG(0, ("Unable to determine if service has changed.\n"));
+ DEBUG(0, ("Disabling service [%s].\n",
+ new_config->services[i]));
/* Not much we can do here, no way to know whether the
* current configuration is safe, and restarting the
* service won't work because the new startup requires
@@ -1338,15 +1337,12 @@ static int monitor_cleanup(void)
ret = unlink(file);
if (ret == -1) {
ret = errno;
- SYSLOG_ERROR("Error removing pidfile! (%d [%s])\n",
- ret, strerror(ret));
+ DEBUG(0, ("Error removing pidfile! (%d [%s])\n",
+ ret, strerror(ret)));
talloc_free(file);
return errno;
}
- /* close syslog */
- closelog();
-
talloc_free(file);
return EOK;
}
@@ -1362,7 +1358,7 @@ static void monitor_quit(struct tevent_context *ev,
#if HAVE_GETPGRP
if (getpgrp() == getpid()) {
- SYSLOG_NOTICE("%s: killing children\n", strsignal(signum));
+ DEBUG(0,("%s: killing children\n", strsignal(signum)));
kill(-getpgrp(), SIGTERM);
}
#endif
@@ -1380,8 +1376,8 @@ int read_config_file(const char *config_file)
ret = config_from_file("sssd", config_file, &sssd_config,
INI_STOP_ON_ANY, &error_list);
if (ret != EOK) {
- SYSLOG_ERROR("Parse error reading configuration file [%s]\n",
- config_file)
+ DEBUG(0, ("Parse error reading configuration file [%s]\n",
+ config_file));
print_file_parsing_errors(stderr, error_list);
}
@@ -1405,14 +1401,14 @@ static errno_t load_configuration(TALLOC_CTX *mem_ctx,
cdb_file = talloc_asprintf(ctx, "%s/%s", DB_PATH, CONFDB_FILE);
if (cdb_file == NULL) {
- SYSLOG_ERROR("Out of memory, aborting!\n");
+ DEBUG(0,("Out of memory, aborting!\n"));
ret = ENOMEM;
goto done;
}
ret = confdb_init(ctx, &ctx->cdb, cdb_file);
if (ret != EOK) {
- SYSLOG_ERROR("The confdb initialization failed\n");
+ DEBUG(0,("The confdb initialization failed\n"));
goto done;
}
@@ -1429,26 +1425,26 @@ static errno_t load_configuration(TALLOC_CTX *mem_ctx,
ret = confdb_init(ctx, &ctx->cdb, cdb_file);
if (ret != EOK) {
- SYSLOG_ERROR("The confdb initialization failed\n");
+ DEBUG(0,("The confdb initialization failed\n"));
goto done;
}
/* Load special entries */
ret = confdb_create_base(ctx->cdb);
if (ret != EOK) {
- SYSLOG_ERROR("Unable to load special entries into confdb\n");
+ DEBUG(0, ("Unable to load special entries into confdb\n"));
goto done;
}
} else if (ret != EOK) {
- SYSLOG_ERROR("Fatal error initializing confdb\n");
+ DEBUG(0, ("Fatal error initializing confdb\n"));
goto done;
}
talloc_zfree(cdb_file);
ret = confdb_init_db(config_file, ctx->cdb);
if (ret != EOK) {
- SYSLOG_ERROR("ConfDB initialization has failed [%s]\n",
- strerror(ret))
+ DEBUG(0, ("ConfDB initialization has failed [%s]\n",
+ strerror(ret)));
goto done;
}
@@ -1500,7 +1496,7 @@ static void config_file_changed(struct tevent_context *ev,
te = tevent_add_timer(ev, ev, tv, process_config_file, file_ctx);
if (!te) {
- SYSLOG_ERROR("Unable to queue config file update! Exiting.");
+ DEBUG(0, ("Unable to queue config file update! Exiting."));
kill(getpid(), SIGTERM);
return;
}
@@ -1547,7 +1543,7 @@ static void process_config_file(struct tevent_context *ev,
len = read(file_ctx->mt_ctx->inotify_fd, buf+total_len,
event_size-total_len);
if (len == -1 && errno != EINTR) {
- SYSLOG_ERROR("Critical error reading inotify file descriptor.\n");
+ DEBUG(0, ("Critical error reading inotify file descriptor.\n"));
talloc_free(tmp_ctx);
return;
}
@@ -1569,7 +1565,7 @@ static void process_config_file(struct tevent_context *ev,
while (total_len < in_event->len) {
len = read(file_ctx->mt_ctx->inotify_fd, &name, in_event->len);
if (len == -1 && errno != EINTR) {
- SYSLOG_ERROR("Critical error reading inotify file descriptor.\n");
+ DEBUG(0, ("Critical error reading inotify file descriptor.\n"));
talloc_free(tmp_ctx);
return;
}
@@ -1585,7 +1581,7 @@ static void process_config_file(struct tevent_context *ev,
}
}
if (!cb) {
- SYSLOG_ERROR("Unknown watch descriptor\n");
+ DEBUG(0, ("Unknown watch descriptor\n"));
return;
}
@@ -1604,7 +1600,7 @@ static void process_config_file(struct tevent_context *ev,
cb->retries = 0;
rw_ctx = talloc(file_ctx, struct rewatch_ctx);
if(!rw_ctx) {
- SYSLOG_ERROR("Could not restore inotify watch. Quitting!\n");
+ DEBUG(0, ("Could not restore inotify watch. Quitting!\n"));
close(file_ctx->mt_ctx->inotify_fd);
kill(getpid(), SIGTERM);
return;
@@ -1614,7 +1610,7 @@ static void process_config_file(struct tevent_context *ev,
tev = tevent_add_timer(ev, rw_ctx, tv, rewatch_config_file, rw_ctx);
if (te == NULL) {
- SYSLOG_ERROR("Could not restore inotify watch. Quitting!\n");
+ DEBUG(0, ("Could not restore inotify watch. Quitting!\n"));
close(file_ctx->mt_ctx->inotify_fd);
kill(getpid(), SIGTERM);
}
@@ -1646,7 +1642,7 @@ static void rewatch_config_file(struct tevent_context *ev,
/* Retry six times at five-second intervals before giving up */
cb->retries++;
if (cb->retries > 6) {
- SYSLOG_ERROR("Could not restore inotify watch. Quitting!\n");
+ DEBUG(0, ("Could not restore inotify watch. Quitting!\n"));
close(file_ctx->mt_ctx->inotify_fd);
kill(getpid(), SIGTERM);
}
@@ -1664,7 +1660,7 @@ static void rewatch_config_file(struct tevent_context *ev,
tev = tevent_add_timer(ev, ev, tv, rewatch_config_file, rw_ctx);
if (te == NULL) {
- SYSLOG_ERROR("Could not restore inotify watch. Quitting!\n");
+ DEBUG(0, ("Could not restore inotify watch. Quitting!\n"));
close(file_ctx->mt_ctx->inotify_fd);
kill(getpid(), SIGTERM);
}
@@ -1697,8 +1693,8 @@ static void poll_config_file(struct tevent_context *ev,
ret = stat(cb->filename, &file_stat);
if (ret < 0) {
err = errno;
- SYSLOG_ERROR("Could not stat file [%s]. Error [%d:%s]\n",
- cb->filename, err, strerror(err))
+ DEBUG(0, ("Could not stat file [%s]. Error [%d:%s]\n",
+ cb->filename, err, strerror(err)));
/* TODO: If the config file is missing, should we shut down? */
return;
}
@@ -1722,7 +1718,7 @@ static void poll_config_file(struct tevent_context *ev,
file_ctx->timer = tevent_add_timer(ev, file_ctx->parent_ctx, tv,
poll_config_file, file_ctx);
if (!file_ctx->timer) {
- SYSLOG_ERROR("Error: Config file no longer monitored for changes!");
+ DEBUG(0, ("Error: Config file no longer monitored for changes!"));
}
}
@@ -1740,8 +1736,8 @@ static int try_inotify(struct config_file_ctx *file_ctx, const char *filename,
file_ctx->mt_ctx->inotify_fd = inotify_init();
if (file_ctx->mt_ctx->inotify_fd < 0) {
err = errno;
- SYSLOG_ERROR("Could not initialize inotify, error [%d:%s]\n",
- err, strerror(err))
+ DEBUG(0, ("Could not initialize inotify, error [%d:%s]\n",
+ err, strerror(err)));
return err;
}
@@ -1786,8 +1782,8 @@ static int try_inotify(struct config_file_ctx *file_ctx, const char *filename,
cb->filename, IN_MODIFY);
if (cb->wd < 0) {
err = errno;
- SYSLOG_ERROR("Could not add inotify watch for file [%s]. Error [%d:%s]\n",
- cb->filename, err, strerror(err))
+ DEBUG(0, ("Could not add inotify watch for file [%s]. Error [%d:%s]\n",
+ cb->filename, err, strerror(err)));
close(file_ctx->mt_ctx->inotify_fd);
return err;
}
@@ -1814,8 +1810,8 @@ static int monitor_config_file(TALLOC_CTX *mem_ctx,
ret = stat(file, &file_stat);
if (ret < 0) {
err = errno;
- SYSLOG_ERROR("Could not stat file [%s]. Error [%d:%s]\n",
- file, err, strerror(err))
+ DEBUG(0, ("Could not stat file [%s]. Error [%d:%s]\n",
+ file, err, strerror(err)));
return err;
}
if (!ctx->file_ctx) {
@@ -1972,7 +1968,7 @@ static int monitor_service_init(struct sbus_connection *conn, void *data)
mini = talloc(conn, struct mon_init_conn);
if (!mini) {
- SYSLOG_ERROR("Out of memory?!\n");
+ DEBUG(0,("Out of memory?!\n"));
talloc_zfree(conn);
return ENOMEM;
}
@@ -1984,7 +1980,7 @@ static int monitor_service_init(struct sbus_connection *conn, void *data)
mini->timeout = tevent_add_timer(ctx->ev, mini, tv, init_timeout, mini);
if (!mini->timeout) {
- SYSLOG_ERROR("Out of memory?!\n");
+ DEBUG(0,("Out of memory?!\n"));
talloc_zfree(conn);
return ENOMEM;
}
@@ -2026,7 +2022,7 @@ static int service_send_ping(struct mt_svc *svc)
MONITOR_INTERFACE,
MON_CLI_METHOD_PING);
if (!msg) {
- SYSLOG_ERROR("Out of memory?!\n");
+ DEBUG(0,("Out of memory?!\n"));
talloc_zfree(svc->conn);
return ENOMEM;
}
@@ -2039,7 +2035,7 @@ static int service_send_ping(struct mt_svc *svc)
* We can't communicate on this connection
* We'll drop it using the default destructor.
*/
- SYSLOG_ERROR("D-BUS send failed.\n");
+ DEBUG(0, ("D-BUS send failed.\n"));
talloc_zfree(svc->conn);
return EIO;
}
@@ -2066,8 +2062,8 @@ static void ping_check(DBusPendingCall *pending, void *data)
* until reply is valid or timeout has occurred. If reply is NULL
* here, something is seriously wrong and we should bail out.
*/
- SYSLOG_ERROR("A reply callback was called but no reply was received"
- " and no timeout occurred\n");
+ DEBUG(0, ("A reply callback was called but no reply was received"
+ " and no timeout occurred\n"));
/* Destroy this connection */
sbus_disconnect(svc->conn);
@@ -2093,8 +2089,8 @@ static void ping_check(DBusPendingCall *pending, void *data)
if (strcmp(dbus_error_name, DBUS_ERROR_TIMEOUT) == 0)
break;
- SYSLOG_ERROR("A service PING returned an error [%s], closing connection.\n",
- dbus_error_name);
+ DEBUG(0,("A service PING returned an error [%s], closing connection.\n",
+ dbus_error_name));
/* Falling through to default intentionally*/
default:
/*
@@ -2139,7 +2135,7 @@ static int service_check_alive(struct mt_svc *svc)
if (WIFEXITED(status)) { /* children exited on it's own */
/* TODO: check configuration to see if it was removed
* from the list of process to run */
- SYSLOG_NOTICE("Process [%s] exited\n", svc->name);
+ DEBUG(0,("Process [%s] exited\n", svc->name));
}
return ECHILD;
@@ -2276,7 +2272,7 @@ static int start_service(struct mt_svc *svc, bool startup)
te = tevent_add_timer(svc->mt_ctx->ev, svc, tv,
service_startup_handler, svc);
if (te == NULL) {
- SYSLOG_ERROR("Unable to queue service %s for startup\n", svc->name);
+ DEBUG(0, ("Unable to queue service %s for startup\n", svc->name));
return ENOMEM;
}
return EOK;
@@ -2314,7 +2310,7 @@ static void service_startup_handler(struct tevent_context *ev,
mt_svc->pid = fork();
if (mt_svc->pid != 0) {
if (mt_svc->pid == -1) {
- SYSLOG_ERROR("Could not fork child to start service [%s]. Continuing.\n", mt_svc->name);
+ DEBUG(0, ("Could not fork child to start service [%s]. Continuing.\n", mt_svc->name))
return;
}
@@ -2334,7 +2330,7 @@ static void service_startup_handler(struct tevent_context *ev,
/* If we are here, exec() has failed
* Print errno and abort quickly */
- SYSLOG_ERROR("Could not exec %s, reason: %s\n", mt_svc->command, strerror(errno));
+ DEBUG(0,("Could not exec %s, reason: %s\n", mt_svc->command, strerror(errno)));
/* We have to call _exit() instead of exit() here
* because a bug in D-BUS will cause the server to
@@ -2413,9 +2409,6 @@ int main(int argc, const char *argv[])
/* we want a pid file check */
flags |= FLAGS_PID_FILE;
- /* enable syslog logging */
- openlog(PRG_NAME, LOG_PID, LOG_DAEMON);
-
/* Parse config file, fail if cannot be done */
ret = load_configuration(tmp_ctx, config_file, &monitor);
if (ret != EOK) return 4;
diff --git a/server/monitor/monitor_sbus.c b/server/monitor/monitor_sbus.c
index 6e9a0e05..9995986b 100644
--- a/server/monitor/monitor_sbus.c
+++ b/server/monitor/monitor_sbus.c
@@ -74,8 +74,8 @@ static void id_callback(DBusPendingCall *pending, void *ptr)
* until reply is valid or timeout has occurred. If reply is NULL
* here, something is seriously wrong and we should bail out.
*/
- SYSLOG_ERROR("Severe error. A reply callback was called but no"
- " reply was received and no timeout occurred\n");
+ DEBUG(0, ("Severe error. A reply callback was called but no"
+ " reply was received and no timeout occurred\n"));
/* FIXME: Destroy this connection ? */
goto done;
@@ -99,8 +99,8 @@ static void id_callback(DBusPendingCall *pending, void *ptr)
break;
case DBUS_MESSAGE_TYPE_ERROR:
- SYSLOG_ERROR("The Monitor returned an error [%s]\n",
- dbus_message_get_error_name(reply));
+ DEBUG(0,("The Monitor returned an error [%s]\n",
+ dbus_message_get_error_name(reply)));
/* Falling through to default intentionally*/
default:
/*
@@ -136,7 +136,7 @@ int monitor_common_send_id(struct sbus_connection *conn,
MON_SRV_INTERFACE,
MON_SRV_METHOD_REGISTER);
if (msg == NULL) {
- SYSLOG_ERROR("Out of memory?!\n");
+ DEBUG(0, ("Out of memory?!\n"));
return ENOMEM;
}
@@ -159,7 +159,7 @@ int monitor_common_send_id(struct sbus_connection *conn,
* We can't communicate on this connection
* We'll drop it using the default destructor.
*/
- SYSLOG_ERROR("D-BUS send failed.\n");
+ DEBUG(0, ("D-BUS send failed.\n"));
dbus_message_unref(msg);
return EIO;
}
diff --git a/server/providers/data_provider.c b/server/providers/data_provider.c
index f4affd1a..f8efcc8d 100644
--- a/server/providers/data_provider.c
+++ b/server/providers/data_provider.c
@@ -43,8 +43,6 @@
#define DP_CONF_ENTRY "config/services/dp"
-#define PRG_NAME "sssd"
-
struct dp_backend;
struct dp_frontend;
@@ -153,7 +151,7 @@ static int dp_monitor_init(struct dp_ctx *dpctx)
/* Set up SBUS connection to the monitor */
ret = monitor_get_sbus_address(dpctx, dpctx->cdb, &sbus_address);
if (ret != EOK) {
- SYSLOG_ERROR("Could not locate monitor address.\n");
+ DEBUG(0, ("Could not locate monitor address.\n"));
return ret;
}
@@ -161,7 +159,7 @@ static int dp_monitor_init(struct dp_ctx *dpctx)
&monitor_dp_interface, &conn,
NULL, NULL);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to connect to monitor services.\n");
+ DEBUG(0, ("Failed to connect to monitor services.\n"));
return ret;
}
@@ -170,7 +168,7 @@ static int dp_monitor_init(struct dp_ctx *dpctx)
DATA_PROVIDER_SERVICE_NAME,
DATA_PROVIDER_VERSION);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to identify to the monitor!\n");
+ DEBUG(0, ("Failed to identify to the monitor!\n"));
return ret;
}
@@ -204,7 +202,7 @@ static int dp_client_init(struct sbus_connection *conn, void *data)
dpcli = talloc(conn, struct dp_client);
if (!dpcli) {
- SYSLOG_ERROR("Out of memory?!\n");
+ DEBUG(0,("Out of memory?!\n"));
talloc_zfree(conn);
return ENOMEM;
}
@@ -218,7 +216,7 @@ static int dp_client_init(struct sbus_connection *conn, void *data)
dpcli->timeout = tevent_add_timer(dpctx->ev, dpcli,
tv, init_timeout, dpcli);
if (!dpcli->timeout) {
- SYSLOG_ERROR("Out of memory?!\n");
+ DEBUG(0,("Out of memory?!\n"));
talloc_zfree(conn);
return ENOMEM;
}
@@ -250,7 +248,7 @@ static int client_registration(DBusMessage *message,
data = sbus_conn_get_private_data(conn);
dpcli = talloc_get_type(data, struct dp_client);
if (!dpcli) {
- SYSLOG_ERROR("Connection holds no valid init data\n");
+ DEBUG(0, ("Connection holds no valid init data\n"));
return EINVAL;
}
@@ -278,14 +276,14 @@ static int client_registration(DBusMessage *message,
case DP_CLI_BACKEND:
dpbe = talloc_zero(dpcli->dpctx, struct dp_backend);
if (!dpbe) {
- SYSLOG_ERROR("Out of memory!\n");
+ DEBUG(0, ("Out of memory!\n"));
sbus_disconnect(conn);
return ENOMEM;
}
dpbe->domain = talloc_strdup(dpbe, cli_domain);
if (!dpbe->domain) {
- SYSLOG_ERROR("Out of memory!\n");
+ DEBUG(0, ("Out of memory!\n"));
sbus_disconnect(conn);
return ENOMEM;
}
@@ -302,14 +300,14 @@ static int client_registration(DBusMessage *message,
case DP_CLI_FRONTEND:
dpfe = talloc_zero(dpcli->dpctx, struct dp_frontend);
if (!dpfe) {
- SYSLOG_ERROR("Out of memory!\n");
+ DEBUG(0, ("Out of memory!\n"));
sbus_disconnect(conn);
return ENOMEM;
}
dpfe->name = talloc_strdup(dpfe, cli_name);
if (!dpfe->name) {
- SYSLOG_ERROR("Out of memory!\n");
+ DEBUG(0, ("Out of memory!\n"));
sbus_disconnect(conn);
return ENOMEM;
}
@@ -332,7 +330,7 @@ static int client_registration(DBusMessage *message,
/* reply that all is ok */
reply = dbus_message_new_method_return(message);
if (!reply) {
- SYSLOG_ERROR("Dbus Out of memory!\n");
+ DEBUG(0, ("Dbus Out of memory!\n"));
return ENOMEM;
}
@@ -340,7 +338,7 @@ static int client_registration(DBusMessage *message,
DBUS_TYPE_UINT16, &version,
DBUS_TYPE_INVALID);
if (!dbret) {
- SYSLOG_ERROR("Failed to build dbus reply\n");
+ DEBUG(0, ("Failed to build dbus reply\n"));
dbus_message_unref(reply);
sbus_disconnect(conn);
return EIO;
@@ -375,7 +373,7 @@ static void be_got_account_info(DBusPendingCall *pending, void *data)
* until reply is valid or timeout has occurred. If reply is NULL
* here, something is seriously wrong and we should bail out.
*/
- SYSLOG_ERROR("Severe error. A reply callback was called but no reply was received and no timeout occurred\n");
+ DEBUG(0, ("Severe error. A reply callback was called but no reply was received and no timeout occurred\n"));
/* Destroy this connection */
sbus_disconnect(bereq->be->dpcli->conn);
@@ -404,8 +402,8 @@ static void be_got_account_info(DBusPendingCall *pending, void *data)
break;
case DBUS_MESSAGE_TYPE_ERROR:
- SYSLOG_ERROR("The Data Provider returned an error [%s], closing connection.\n",
- dbus_message_get_error_name(reply));
+ DEBUG(0,("The Data Provider returned an error [%s], closing connection.\n",
+ dbus_message_get_error_name(reply)));
/* Falling through to default intentionally*/
default:
/*
@@ -470,7 +468,7 @@ static int dp_send_acct_req(struct dp_be_request *bereq,
DP_CLI_INTERFACE,
DP_CLI_METHOD_GETACCTINFO);
if (msg == NULL) {
- SYSLOG_ERROR("Out of memory?!\n");
+ DEBUG(0,("Out of memory?!\n"));
return ENOMEM;
}
@@ -494,7 +492,7 @@ static int dp_send_acct_req(struct dp_be_request *bereq,
* We can't communicate on this connection
* We'll drop it using the default destructor.
*/
- SYSLOG_ERROR("D-BUS send failed.\n");
+ DEBUG(0, ("D-BUS send failed.\n"));
dbus_message_unref(msg);
return EIO;
}
@@ -690,7 +688,7 @@ static void be_got_pam_reply(DBusPendingCall *pending, void *data)
* until reply is valid or timeout has occurred. If reply is NULL
* here, something is seriously wrong and we should bail out.
*/
- SYSLOG_ERROR("Severe error. A reply callback was called but no reply was received and no timeout occurred\n");
+ DEBUG(0, ("Severe error. A reply callback was called but no reply was received and no timeout occurred\n"));
/* Destroy this connection */
sbus_disconnect(bereq->be->dpcli->conn);
@@ -717,8 +715,8 @@ static void be_got_pam_reply(DBusPendingCall *pending, void *data)
break;
case DBUS_MESSAGE_TYPE_ERROR:
- SYSLOG_ERROR("The Data Provider returned an error [%s], closing connection.\n",
- dbus_message_get_error_name(reply));
+ DEBUG(0,("The Data Provider returned an error [%s], closing connection.\n",
+ dbus_message_get_error_name(reply)));
/* Falling through to default intentionally*/
default:
/*
@@ -767,7 +765,7 @@ static int dp_call_pamhandler(struct dp_be_request *bereq, struct pam_data *pd)
DP_CLI_INTERFACE,
DP_CLI_METHOD_PAMHANDLER);
if (msg == NULL) {
- SYSLOG_ERROR("Out of memory?!\n");
+ DEBUG(0,("Out of memory?!\n"));
return ENOMEM;
}
@@ -788,7 +786,7 @@ static int dp_call_pamhandler(struct dp_be_request *bereq, struct pam_data *pd)
* We can't communicate on this connection
* We'll drop it using the default destructor.
*/
- SYSLOG_ERROR("D-BUS send failed.\n");
+ DEBUG(0, ("D-BUS send failed.\n"));
dbus_message_unref(msg);
return EIO;
}
@@ -829,7 +827,7 @@ static int dp_pamhandler(DBusMessage *message, struct sbus_connection *conn)
ret = dp_unpack_pam_request(message, pd, &dbus_error);
if (!ret) {
- SYSLOG_ERROR("Failed, to parse message!\n");
+ DEBUG(0,("Failed, to parse message!\n"));
if (dbus_error_is_set(&dbus_error)) dbus_error_free(&dbus_error);
talloc_free(pd);
return EIO;
@@ -840,7 +838,7 @@ static int dp_pamhandler(DBusMessage *message, struct sbus_connection *conn)
reply = dbus_message_new_method_return(message);
if (!reply) {
- SYSLOG_ERROR("Out of memory?!\n");
+ DEBUG(0,("Out of memory?!\n"));
talloc_free(pd);
return ENOMEM;
}
@@ -966,7 +964,7 @@ static int dp_process_init(TALLOC_CTX *mem_ctx,
dpctx = talloc_zero(mem_ctx, struct dp_ctx);
if (!dpctx) {
- SYSLOG_ERROR("fatal error initializing dp_ctx\n");
+ DEBUG(0, ("fatal error initializing dp_ctx\n"));
return ENOMEM;
}
dpctx->ev = ev;
@@ -974,13 +972,13 @@ static int dp_process_init(TALLOC_CTX *mem_ctx,
ret = dp_monitor_init(dpctx);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error setting up monitor bus\n");
+ DEBUG(0, ("fatal error setting up monitor bus\n"));
return ret;
}
ret = dp_srv_init(dpctx);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error setting up server bus\n");
+ DEBUG(0, ("fatal error setting up server bus\n"));
return ret;
}
@@ -1013,11 +1011,8 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- /* enable syslog logging */
- openlog(PRG_NAME, LOG_PID, LOG_DAEMON);
-
/* set up things like debug , signals, daemonization, etc... */
- ret = server_setup(PRG_NAME, 0, DP_CONF_ENTRY, &main_ctx);
+ ret = server_setup("sssd[dp]", 0, DP_CONF_ENTRY, &main_ctx);
if (ret != EOK) return 2;
ret = die_if_parent_died();
@@ -1034,9 +1029,6 @@ int main(int argc, const char *argv[])
/* loop on main */
server_loop(main_ctx);
- /* close syslog */
- closelog();
-
return 0;
}
diff --git a/server/providers/data_provider_be.c b/server/providers/data_provider_be.c
index b8630e6a..2e83ab6e 100644
--- a/server/providers/data_provider_be.c
+++ b/server/providers/data_provider_be.c
@@ -516,7 +516,7 @@ static int mon_cli_init(struct be_ctx *ctx)
/* Set up SBUS connection to the monitor */
ret = monitor_get_sbus_address(ctx, ctx->cdb, &sbus_address);
if (ret != EOK) {
- SYSLOG_ERROR("Could not locate monitor address.\n");
+ DEBUG(0, ("Could not locate monitor address.\n"));
return ret;
}
@@ -524,7 +524,7 @@ static int mon_cli_init(struct be_ctx *ctx)
&monitor_be_interface, &ctx->mon_conn,
NULL, ctx);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to connect to monitor services.\n");
+ DEBUG(0, ("Failed to connect to monitor services.\n"));
return ret;
}
@@ -533,7 +533,7 @@ static int mon_cli_init(struct be_ctx *ctx)
ctx->identity,
DATA_PROVIDER_VERSION);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to identify to the monitor!\n");
+ DEBUG(0, ("Failed to identify to the monitor!\n"));
return ret;
}
@@ -552,7 +552,7 @@ static int be_cli_init(struct be_ctx *ctx)
/* Set up SBUS connection to the monitor */
ret = dp_get_sbus_address(ctx, ctx->cdb, &sbus_address);
if (ret != EOK) {
- SYSLOG_ERROR("Could not locate monitor address.\n");
+ DEBUG(0, ("Could not locate monitor address.\n"));
return ret;
}
@@ -560,7 +560,7 @@ static int be_cli_init(struct be_ctx *ctx)
&be_interface, &ctx->dp_conn,
NULL, ctx);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to connect to monitor services.\n");
+ DEBUG(0, ("Failed to connect to monitor services.\n"));
return ret;
}
@@ -569,7 +569,7 @@ static int be_cli_init(struct be_ctx *ctx)
DP_CLI_BACKEND, DATA_PROVIDER_VERSION,
"", ctx->domain->name);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to identify to the data provider!\n");
+ DEBUG(0, ("Failed to identify to the data provider!\n"));
return ret;
}
@@ -577,7 +577,7 @@ static int be_cli_init(struct be_ctx *ctx)
ret = confdb_get_int(ctx->cdb, ctx, SERVICE_CONF_ENTRY,
"reconnection_retries", 3, &max_retries);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to set up automatic reconnection\n");
+ DEBUG(0, ("Failed to set up automatic reconnection\n"));
return ret;
}
@@ -604,20 +604,20 @@ static void be_cli_reconnect_init(struct sbus_connection *conn, int status, void
DP_CLI_BACKEND, DATA_PROVIDER_VERSION,
"", be_ctx->domain->name);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to send id to the data provider!\n");
+ DEBUG(0, ("Failed to send id to the data provider!\n"));
} else {
return;
}
}
/* Handle failure */
- SYSLOG_ERROR("Could not reconnect to data provider.\n");
+ DEBUG(0, ("Could not reconnect to data provider.\n"));
/* Kill the backend and let the monitor restart it */
ret = be_finalize(be_ctx);
if (ret != EOK) {
- SYSLOG_ERROR("Finalizing back-end failed with error [%d] [%s]\n",
- ret, strerror(ret));
+ DEBUG(0, ("Finalizing back-end failed with error [%d] [%s]\n",
+ ret, strerror(ret)));
be_shutdown(NULL, ret, NULL);
}
}
@@ -629,8 +629,8 @@ static void be_shutdown(struct be_req *req, int status, const char *errstr)
exit(0);
/* Something went wrong in finalize */
- SYSLOG_ERROR("Finalizing auth module failed with error [%d] [%s]\n",
- status, errstr ? : strerror(status));
+ DEBUG(0, ("Finalizing auth module failed with error [%d] [%s]\n",
+ status, errstr ? : strerror(status)));
exit(1);
}
@@ -643,8 +643,8 @@ static void be_id_shutdown(struct be_req *req, int status, const char *errstr)
if (status != EOK) {
/* Something went wrong in finalize */
- SYSLOG_ERROR("Finalizing auth module failed with error [%d] [%s]\n",
- status, errstr ? : strerror(status));
+ DEBUG(0, ("Finalizing auth module failed with error [%d] [%s]\n",
+ status, errstr ? : strerror(status)));
}
ctx = req->be_ctx;
@@ -690,7 +690,7 @@ static int be_finalize(struct be_ctx *ctx)
fail:
/* If we got here, we couldn't shut down cleanly. */
- SYSLOG_ERROR("ERROR: could not shut down cleanly.\n");
+ DEBUG(0, ("ERROR: could not shut down cleanly.\n"));
return ret;
}
@@ -784,8 +784,8 @@ static int load_backend_module(struct be_ctx *ctx,
DEBUG(7, ("Loading backend [%s] with path [%s].\n", mod_name, path));
handle = dlopen(path, RTLD_NOW);
if (!handle) {
- SYSLOG_ERROR("Unable to load %s module with path (%s), error: %s\n",
- mod_name, path, dlerror());
+ DEBUG(0, ("Unable to load %s module with path (%s), error: %s\n",
+ mod_name, path, dlerror()));
ret = ELIBACC;
goto done;
}
@@ -797,16 +797,16 @@ static int load_backend_module(struct be_ctx *ctx,
mod_init_fn = (bet_init_fn_t)dlsym(ctx->loaded_be[lb].handle,
mod_init_fn_name);
if (mod_init_fn == NULL) {
- SYSLOG_ERROR("Unable to load init fn %s from module %s, error: %s\n",
- mod_init_fn_name, mod_name, dlerror());
+ DEBUG(0, ("Unable to load init fn %s from module %s, error: %s\n",
+ mod_init_fn_name, mod_name, dlerror()));
ret = ELIBBAD;
goto done;
}
ret = mod_init_fn(ctx, be_ops, be_pvt_data);
if (ret != EOK) {
- SYSLOG_ERROR("Error (%d) in module (%s) initialization (%s)!\n",
- ret, mod_name, mod_init_fn_name);
+ DEBUG(0, ("Error (%d) in module (%s) initialization (%s)!\n",
+ ret, mod_name, mod_init_fn_name));
goto done;
}
@@ -877,7 +877,7 @@ int be_process_init(TALLOC_CTX *mem_ctx,
ctx = talloc_zero(mem_ctx, struct be_ctx);
if (!ctx) {
- SYSLOG_ERROR("fatal error initializing be_ctx\n");
+ DEBUG(0, ("fatal error initializing be_ctx\n"));
return ENOMEM;
}
ctx->ev = ev;
@@ -885,37 +885,37 @@ int be_process_init(TALLOC_CTX *mem_ctx,
ctx->identity = talloc_asprintf(ctx, "%%BE_%s", be_domain);
ctx->conf_path = talloc_asprintf(ctx, "config/domains/%s", be_domain);
if (!ctx->identity || !ctx->conf_path) {
- SYSLOG_ERROR("Out of memory!?\n");
+ DEBUG(0, ("Out of memory!?\n"));
return ENOMEM;
}
ret = confdb_get_domain(cdb, be_domain, &ctx->domain);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error retrieving domain configuration\n");
+ DEBUG(0, ("fatal error retrieving domain configuration\n"));
return ret;
}
ret = sysdb_domain_init(ctx, ev, ctx->domain, DB_PATH, &ctx->sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error opening cache database\n");
+ DEBUG(0, ("fatal error opening cache database\n"));
return ret;
}
ret = mon_cli_init(ctx);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error setting up monitor bus\n");
+ DEBUG(0, ("fatal error setting up monitor bus\n"));
return ret;
}
ret = be_cli_init(ctx);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error setting up server bus\n");
+ DEBUG(0, ("fatal error setting up server bus\n"));
return ret;
}
ret = be_rewrite(ctx);
if (ret != EOK) {
- SYSLOG_ERROR("error rewriting provider types\n");
+ DEBUG(0, ("error rewriting provider types\n"));
return ret;
}
@@ -923,7 +923,7 @@ int be_process_init(TALLOC_CTX *mem_ctx,
&ctx->bet_info[BET_ID].bet_ops,
&ctx->bet_info[BET_ID].pvt_bet_data);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error initializing data providers\n");
+ DEBUG(0, ("fatal error initializing data providers\n"));
return ret;
}
@@ -932,7 +932,7 @@ int be_process_init(TALLOC_CTX *mem_ctx,
&ctx->bet_info[BET_AUTH].pvt_bet_data);
if (ret != EOK) {
if (ret != ENOENT) {
- SYSLOG_ERROR("fatal error initializing data providers\n");
+ DEBUG(0, ("fatal error initializing data providers\n"));
return ret;
}
DEBUG(1, ("No authentication module provided for [%s] !!\n",
@@ -944,7 +944,7 @@ int be_process_init(TALLOC_CTX *mem_ctx,
&ctx->bet_info[BET_ACCESS].pvt_bet_data);
if (ret != EOK) {
if (ret != ENOENT) {
- SYSLOG_ERROR("fatal error initializing data providers\n");
+ DEBUG(0, ("fatal error initializing data providers\n"));
return ret;
}
DEBUG(1, ("No access control module provided for [%s] "
@@ -958,7 +958,7 @@ int be_process_init(TALLOC_CTX *mem_ctx,
&ctx->bet_info[BET_CHPASS].pvt_bet_data);
if (ret != EOK) {
if (ret != ENOENT) {
- SYSLOG_ERROR("fatal error initializing data providers\n");
+ DEBUG(0, ("fatal error initializing data providers\n"));
return ret;
}
DEBUG(1, ("No change password module provided for [%s] !!\n",
@@ -1012,12 +1012,9 @@ int main(int argc, const char *argv[])
conf_entry = talloc_asprintf(NULL, BE_CONF_ENTRY, be_domain);
if (!conf_entry) return 2;
- /* enable syslog logging */
- openlog(srv_name, LOG_PID, LOG_DAEMON);
-
ret = server_setup(srv_name, 0, conf_entry, &main_ctx);
if (ret != EOK) {
- SYSLOG_ERROR("Could not set up mainloop [%d]\n", ret);
+ DEBUG(0, ("Could not set up mainloop [%d]\n", ret));
return 2;
}
@@ -1032,7 +1029,7 @@ int main(int argc, const char *argv[])
main_ctx->event_ctx,
main_ctx->confdb_ctx);
if (ret != EOK) {
- SYSLOG_ERROR("Could not initialize backend [%d]\n", ret);
+ DEBUG(0, ("Could not initialize backend [%d]\n", ret));
return 3;
}
@@ -1041,9 +1038,6 @@ int main(int argc, const char *argv[])
/* loop on main */
server_loop(main_ctx);
- /* close syslog */
- closelog();
-
return 0;
}
diff --git a/server/providers/dp_auth_util.c b/server/providers/dp_auth_util.c
index 8bfa0849..80e9f167 100644
--- a/server/providers/dp_auth_util.c
+++ b/server/providers/dp_auth_util.c
@@ -241,8 +241,8 @@ static void id_callback(DBusPendingCall *pending, void *ptr)
* until reply is valid or timeout has occurred. If reply is NULL
* here, something is seriously wrong and we should bail out.
*/
- SYSLOG_ERROR("Severe error. A reply callback was called but no"
- " reply was received and no timeout occurred\n");
+ DEBUG(0, ("Severe error. A reply callback was called but no"
+ " reply was received and no timeout occurred\n"));
/* FIXME: Destroy this connection ? */
goto done;
@@ -266,8 +266,8 @@ static void id_callback(DBusPendingCall *pending, void *ptr)
break;
case DBUS_MESSAGE_TYPE_ERROR:
- SYSLOG_ERROR("The Monitor returned an error [%s]\n",
- dbus_message_get_error_name(reply));
+ DEBUG(0,("The Monitor returned an error [%s]\n",
+ dbus_message_get_error_name(reply)));
/* Falling through to default intentionally*/
default:
/*
@@ -304,7 +304,7 @@ int dp_common_send_id(struct sbus_connection *conn,
DP_SRV_INTERFACE,
DP_SRV_METHOD_REGISTER);
if (msg == NULL) {
- SYSLOG_ERROR("Out of memory?!\n");
+ DEBUG(0, ("Out of memory?!\n"));
return ENOMEM;
}
@@ -330,7 +330,7 @@ int dp_common_send_id(struct sbus_connection *conn,
* We can't communicate on this connection
* We'll drop it using the default destructor.
*/
- SYSLOG_ERROR("D-BUS send failed.\n");
+ DEBUG(0, ("D-BUS send failed.\n"));
dbus_message_unref(msg);
return EIO;
}
diff --git a/server/providers/krb5/krb5_auth.c b/server/providers/krb5/krb5_auth.c
index 0eac91f5..03e79032 100644
--- a/server/providers/krb5/krb5_auth.c
+++ b/server/providers/krb5/krb5_auth.c
@@ -793,11 +793,11 @@ static void krb5_pam_handler_done(struct tevent_req *req)
}
break;
default:
- SYSLOG_ERROR("unsupported PAM command [%d].\n", pd->cmd);
+ DEBUG(0, ("unsupported PAM command [%d].\n", pd->cmd));
}
if (password == NULL) {
- SYSLOG_ERROR("password not available, offline auth may not work.\n");
+ DEBUG(0, ("password not available, offline auth may not work.\n"));
goto done;
}
diff --git a/server/providers/ldap/ldap_id.c b/server/providers/ldap/ldap_id.c
index bd376f7c..72caf966 100644
--- a/server/providers/ldap/ldap_id.c
+++ b/server/providers/ldap/ldap_id.c
@@ -873,7 +873,7 @@ static void ldap_id_enumerate_set_timer(struct sdap_id_ctx *ctx,
tv = tevent_timeval_add(&tv, ert, 0);
enum_task = tevent_add_timer(ctx->be->ev, ctx, tv, ldap_id_enumerate, ctx);
if (!enum_task) {
- SYSLOG_ERROR("FATAL: failed to setup enumeration task!\n");
+ DEBUG(0, ("FATAL: failed to setup enumeration task!\n"));
/* shutdown! */
exit(1);
}
@@ -1354,7 +1354,7 @@ int sssm_ldap_init(struct be_ctx *bectx,
enum_task = tevent_add_timer(ctx->be->ev, ctx, ctx->last_run,
ldap_id_enumerate, ctx);
if (!enum_task) {
- SYSLOG_ERROR("FATAL: failed to setup enumeration task!\n");
+ DEBUG(0, ("FATAL: failed to setup enumeration task!\n"));
ret = EFAULT;
goto done;
}
diff --git a/server/providers/ldap/sdap.c b/server/providers/ldap/sdap.c
index 7edcc3d8..22d238e6 100644
--- a/server/providers/ldap/sdap.c
+++ b/server/providers/ldap/sdap.c
@@ -148,8 +148,8 @@ int sdap_get_options(TALLOC_CTX *memctx,
if (ret != EOK ||
((opts->basic[i].def_val.string != NULL) &&
(opts->basic[i].val.string == NULL))) {
- SYSLOG_ERROR("Failed to retrieve value for option (%s)\n",
- opts->basic[i].opt_name);
+ DEBUG(0, ("Failed to retrieve value for option (%s)\n",
+ opts->basic[i].opt_name));
if (ret == EOK) ret = EINVAL;
goto done;
}
@@ -162,8 +162,8 @@ int sdap_get_options(TALLOC_CTX *memctx,
opts->basic[i].opt_name,
NULL, &tmp);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to retrieve value for option (%s)\n",
- opts->basic[i].opt_name);
+ DEBUG(0, ("Failed to retrieve value for option (%s)\n",
+ opts->basic[i].opt_name));
goto done;
}
@@ -186,8 +186,8 @@ int sdap_get_options(TALLOC_CTX *memctx,
opts->basic[i].def_val.number,
&opts->basic[i].val.number);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to retrieve value for option (%s)\n",
- opts->basic[i].opt_name);
+ DEBUG(0, ("Failed to retrieve value for option (%s)\n",
+ opts->basic[i].opt_name));
goto done;
}
DEBUG(6, ("Option %s has value %d\n",
@@ -200,8 +200,8 @@ int sdap_get_options(TALLOC_CTX *memctx,
opts->basic[i].def_val.boolean,
&opts->basic[i].val.boolean);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to retrieve value for option (%s)\n",
- opts->basic[i].opt_name);
+ DEBUG(0, ("Failed to retrieve value for option (%s)\n",
+ opts->basic[i].opt_name));
goto done;
}
DEBUG(6, ("Option %s is %s\n",
@@ -223,7 +223,7 @@ int sdap_get_options(TALLOC_CTX *memctx,
default_user_map = rfc2307bis_user_map;
default_group_map = rfc2307bis_group_map;
} else {
- SYSLOG_ERROR("Unrecognized schema type: %s\n", schema);
+ DEBUG(0, ("Unrecognized schema type: %s\n", schema));
ret = EINVAL;
goto done;
}
@@ -240,8 +240,8 @@ int sdap_get_options(TALLOC_CTX *memctx,
&opts->user_map[i].name);
if (ret != EOK ||
(opts->user_map[i].def_name && !opts->user_map[i].name)) {
- SYSLOG_ERROR("Failed to retrieve a value (%s)\n",
- opts->user_map[i].opt_name);
+ DEBUG(0, ("Failed to retrieve a value (%s)\n",
+ opts->user_map[i].opt_name));
if (ret != EOK) ret = EINVAL;
goto done;
}
@@ -262,8 +262,8 @@ int sdap_get_options(TALLOC_CTX *memctx,
&opts->group_map[i].name);
if (ret != EOK ||
(opts->group_map[i].def_name && !opts->group_map[i].name)) {
- SYSLOG_ERROR("Failed to retrieve a value (%s)\n",
- opts->group_map[i].opt_name);
+ DEBUG(0, ("Failed to retrieve a value (%s)\n",
+ opts->group_map[i].opt_name));
if (ret != EOK) ret = EINVAL;
goto done;
}
@@ -301,10 +301,10 @@ const char *_sdap_go_get_cstring(struct sdap_gen_opts *opts,
int id, const char *location)
{
if (opts[id].type != SDAP_STRING) {
- SYSLOG_ERROR("[%s] Requested type 'String' for option '%s'"
- " but value is of type '%s'!\n",
- location, opts[id].opt_name,
- sdap_type_to_string(opts[id].type));
+ DEBUG(0, ("[%s] Requested type 'String' for option '%s'"
+ " but value is of type '%s'!\n",
+ location, opts[id].opt_name,
+ sdap_type_to_string(opts[id].type)));
return NULL;
}
return opts[id].val.cstring;
@@ -314,10 +314,10 @@ char *_sdap_go_get_string(struct sdap_gen_opts *opts,
int id, const char *location)
{
if (opts[id].type != SDAP_STRING) {
- SYSLOG_ERROR("[%s] Requested type 'String' for option '%s'"
- " but value is of type '%s'!\n",
- location, opts[id].opt_name,
- sdap_type_to_string(opts[id].type));
+ DEBUG(0, ("[%s] Requested type 'String' for option '%s'"
+ " but value is of type '%s'!\n",
+ location, opts[id].opt_name,
+ sdap_type_to_string(opts[id].type)));
return NULL;
}
return opts[id].val.string;
@@ -328,10 +328,10 @@ struct sdap_blob _sdap_go_get_blob(struct sdap_gen_opts *opts,
{
struct sdap_blob null_blob = { NULL, 0 };
if (opts[id].type != SDAP_BLOB) {
- SYSLOG_ERROR("[%s] Requested type 'Blob' for option '%s'"
- " but value is of type '%s'!\n",
- location, opts[id].opt_name,
- sdap_type_to_string(opts[id].type));
+ DEBUG(0, ("[%s] Requested type 'Blob' for option '%s'"
+ " but value is of type '%s'!\n",
+ location, opts[id].opt_name,
+ sdap_type_to_string(opts[id].type)));
return null_blob;
}
return opts[id].val.blob;
@@ -341,10 +341,10 @@ int _sdap_go_get_int(struct sdap_gen_opts *opts,
int id, const char *location)
{
if (opts[id].type != SDAP_NUMBER) {
- SYSLOG_ERROR("[%s] Requested type 'Number' for option '%s'"
- " but value is of type '%s'!\n",
- location, opts[id].opt_name,
- sdap_type_to_string(opts[id].type));
+ DEBUG(0, ("[%s] Requested type 'Number' for option '%s'"
+ " but value is of type '%s'!\n",
+ location, opts[id].opt_name,
+ sdap_type_to_string(opts[id].type)));
return 0;
}
return opts[id].val.number;
@@ -354,10 +354,10 @@ bool _sdap_go_get_bool(struct sdap_gen_opts *opts,
int id, const char *location)
{
if (opts[id].type != SDAP_BOOL) {
- SYSLOG_ERROR("[%s] Requested type 'Boolean' for option '%s'"
- " but value is of type '%s'!\n",
- location, opts[id].opt_name,
- sdap_type_to_string(opts[id].type));
+ DEBUG(0, ("[%s] Requested type 'Boolean' for option '%s'"
+ " but value is of type '%s'!\n",
+ location, opts[id].opt_name,
+ sdap_type_to_string(opts[id].type)));
return false;
}
return opts[id].val.boolean;
diff --git a/server/providers/ldap/sdap_async.c b/server/providers/ldap/sdap_async.c
index f50750a2..6ab88679 100644
--- a/server/providers/ldap/sdap_async.c
+++ b/server/providers/ldap/sdap_async.c
@@ -1350,7 +1350,7 @@ static struct tevent_req *sdap_save_group_send(TALLOC_CTX *memctx,
continue;
}
if (mu > mg) { /* shouldn't be possible */
- SYSLOG_ERROR("Fatal Internal error: aborting\n");
+ DEBUG(0, ("Fatal Internal error: aborting\n"));
ret = EFAULT;
goto fail;
}
@@ -1369,8 +1369,8 @@ static struct tevent_req *sdap_save_group_send(TALLOC_CTX *memctx,
break;
default:
- SYSLOG_ERROR("FATAL ERROR: Unhandled schema type! (%d)\n",
- opts->schema_type);
+ DEBUG(0, ("FATAL ERROR: Unhandled schema type! (%d)\n",
+ opts->schema_type));
ret = EFAULT;
goto fail;
}
diff --git a/server/providers/proxy.c b/server/providers/proxy.c
index 22717e86..80a2a550 100644
--- a/server/providers/proxy.c
+++ b/server/providers/proxy.c
@@ -2227,78 +2227,78 @@ int sssm_proxy_init(struct be_ctx *bectx,
handle = dlopen(libpath, RTLD_NOW);
if (!handle) {
- SYSLOG_ERROR("Unable to load %s module with path, error: %s\n",
- libpath, dlerror());
+ DEBUG(0, ("Unable to load %s module with path, error: %s\n",
+ libpath, dlerror()));
ret = ELIBACC;
goto done;
}
ctx->ops.getpwnam_r = proxy_dlsym(handle, "_nss_%s_getpwnam_r", libname);
if (!ctx->ops.getpwnam_r) {
- SYSLOG_ERROR("Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(0, ("Failed to load NSS fns, error: %s\n", dlerror()));
ret = ELIBBAD;
goto done;
}
ctx->ops.getpwuid_r = proxy_dlsym(handle, "_nss_%s_getpwuid_r", libname);
if (!ctx->ops.getpwuid_r) {
- SYSLOG_ERROR("Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(0, ("Failed to load NSS fns, error: %s\n", dlerror()));
ret = ELIBBAD;
goto done;
}
ctx->ops.setpwent = proxy_dlsym(handle, "_nss_%s_setpwent", libname);
if (!ctx->ops.setpwent) {
- SYSLOG_ERROR("Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(0, ("Failed to load NSS fns, error: %s\n", dlerror()));
ret = ELIBBAD;
goto done;
}
ctx->ops.getpwent_r = proxy_dlsym(handle, "_nss_%s_getpwent_r", libname);
if (!ctx->ops.getpwent_r) {
- SYSLOG_ERROR("Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(0, ("Failed to load NSS fns, error: %s\n", dlerror()));
ret = ELIBBAD;
goto done;
}
ctx->ops.endpwent = proxy_dlsym(handle, "_nss_%s_endpwent", libname);
if (!ctx->ops.endpwent) {
- SYSLOG_ERROR("Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(0, ("Failed to load NSS fns, error: %s\n", dlerror()));
ret = ELIBBAD;
goto done;
}
ctx->ops.getgrnam_r = proxy_dlsym(handle, "_nss_%s_getgrnam_r", libname);
if (!ctx->ops.getgrnam_r) {
- SYSLOG_ERROR("Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(0, ("Failed to load NSS fns, error: %s\n", dlerror()));
ret = ELIBBAD;
goto done;
}
ctx->ops.getgrgid_r = proxy_dlsym(handle, "_nss_%s_getgrgid_r", libname);
if (!ctx->ops.getgrgid_r) {
- SYSLOG_ERROR("Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(0, ("Failed to load NSS fns, error: %s\n", dlerror()));
ret = ELIBBAD;
goto done;
}
ctx->ops.setgrent = proxy_dlsym(handle, "_nss_%s_setgrent", libname);
if (!ctx->ops.setgrent) {
- SYSLOG_ERROR("Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(0, ("Failed to load NSS fns, error: %s\n", dlerror()));
ret = ELIBBAD;
goto done;
}
ctx->ops.getgrent_r = proxy_dlsym(handle, "_nss_%s_getgrent_r", libname);
if (!ctx->ops.getgrent_r) {
- SYSLOG_ERROR("Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(0, ("Failed to load NSS fns, error: %s\n", dlerror()));
ret = ELIBBAD;
goto done;
}
ctx->ops.endgrent = proxy_dlsym(handle, "_nss_%s_endgrent", libname);
if (!ctx->ops.endgrent) {
- SYSLOG_ERROR("Failed to load NSS fns, error: %s\n", dlerror());
+ DEBUG(0, ("Failed to load NSS fns, error: %s\n", dlerror()));
ret = ELIBBAD;
goto done;
}
diff --git a/server/responder/common/responder_common.c b/server/responder/common/responder_common.c
index 119a1dd4..57c8678b 100644
--- a/server/responder/common/responder_common.c
+++ b/server/responder/common/responder_common.c
@@ -72,7 +72,7 @@ static void client_send(struct tevent_context *ev, struct cli_ctx *cctx)
return;
}
if (ret != EOK) {
- SYSLOG_ERROR("Failed to read request, aborting client!\n");
+ DEBUG(0, ("Failed to read request, aborting client!\n"));
talloc_free(cctx);
return;
}
@@ -92,7 +92,7 @@ static void client_recv(struct tevent_context *ev, struct cli_ctx *cctx)
if (!cctx->creq) {
cctx->creq = talloc_zero(cctx, struct cli_request);
if (!cctx->creq) {
- SYSLOG_ERROR("Failed to alloc request, aborting client!\n");
+ DEBUG(0, ("Failed to alloc request, aborting client!\n"));
talloc_free(cctx);
return;
}
@@ -102,7 +102,7 @@ static void client_recv(struct tevent_context *ev, struct cli_ctx *cctx)
ret = sss_packet_new(cctx->creq, SSS_PACKET_MAX_RECV_SIZE,
0, &cctx->creq->in);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to alloc request, aborting client!\n");
+ DEBUG(0, ("Failed to alloc request, aborting client!\n"));
talloc_free(cctx);
return;
}
@@ -116,7 +116,7 @@ static void client_recv(struct tevent_context *ev, struct cli_ctx *cctx)
/* execute command */
ret = sss_cmd_execute(cctx, cctx->rctx->sss_cmds);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to execute request, aborting client!\n");
+ DEBUG(0, ("Failed to execute request, aborting client!\n"));
talloc_free(cctx);
}
/* past this point cctx can be freed at any time by callbacks
@@ -193,7 +193,7 @@ static void accept_priv_fd_handler(struct tevent_context *ev,
if (!cctx) {
struct sockaddr_un addr;
int fd;
- SYSLOG_ERROR("Out of memory trying to setup client context on privileged pipe!\n");
+ DEBUG(0, ("Out of memory trying to setup client context on privileged pipe!\n"));
/* accept and close to signal the client we have a problem */
memset(&addr, 0, sizeof(addr));
len = sizeof(addr);
@@ -246,7 +246,7 @@ static void accept_fd_handler(struct tevent_context *ev,
if (!cctx) {
struct sockaddr_un addr;
int fd;
- SYSLOG_ERROR("Out of memory trying to setup client context!\n");
+ DEBUG(0, ("Out of memory trying to setup client context!\n"));
/* accept and close to signal the client we have a problem */
memset(&addr, 0, sizeof(addr));
len = sizeof(addr);
@@ -295,7 +295,7 @@ static int sss_monitor_init(struct resp_ctx *rctx,
/* Set up SBUS connection to the monitor */
ret = monitor_get_sbus_address(rctx, rctx->cdb, &sbus_address);
if (ret != EOK) {
- SYSLOG_ERROR("Could not locate monitor address.\n");
+ DEBUG(0, ("Could not locate monitor address.\n"));
return ret;
}
@@ -303,14 +303,14 @@ static int sss_monitor_init(struct resp_ctx *rctx,
intf, &rctx->mon_conn,
NULL, NULL);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to connect to monitor services.\n");
+ DEBUG(0, ("Failed to connect to monitor services.\n"));
return ret;
}
/* Identify ourselves to the monitor */
ret = monitor_common_send_id(rctx->mon_conn, svc_name, svc_version);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to identify to the monitor!\n");
+ DEBUG(0, ("Failed to identify to the monitor!\n"));
return ret;
}
@@ -328,7 +328,7 @@ static int sss_dp_init(struct resp_ctx *rctx,
/* Set up SBUS connection to the monitor */
ret = dp_get_sbus_address(rctx, rctx->cdb, &sbus_address);
if (ret != EOK) {
- SYSLOG_ERROR("Could not locate DP address.\n");
+ DEBUG(0, ("Could not locate DP address.\n"));
return ret;
}
@@ -336,7 +336,7 @@ static int sss_dp_init(struct resp_ctx *rctx,
intf, &rctx->dp_conn,
NULL, NULL);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to connect to monitor services.\n");
+ DEBUG(0, ("Failed to connect to monitor services.\n"));
return ret;
}
@@ -345,7 +345,7 @@ static int sss_dp_init(struct resp_ctx *rctx,
cli_type, cli_version,
cli_name, cli_domain);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to identify to the DP!\n");
+ DEBUG(0, ("Failed to identify to the DP!\n"));
return ret;
}
@@ -414,18 +414,18 @@ static int set_unix_socket(struct resp_ctx *rctx)
unlink(rctx->sock_name);
if (bind(rctx->lfd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
- SYSLOG_ERROR("Unable to bind on socket '%s'\n", rctx->sock_name);
+ DEBUG(0,("Unable to bind on socket '%s'\n", rctx->sock_name));
goto failed;
}
if (listen(rctx->lfd, 10) != 0) {
- SYSLOG_ERROR("Unable to listen on socket '%s'\n", rctx->sock_name);
+ DEBUG(0,("Unable to listen on socket '%s'\n", rctx->sock_name));
goto failed;
}
rctx->lfde = tevent_add_fd(rctx->ev, rctx, rctx->lfd,
TEVENT_FD_READ, accept_fd_handler, rctx);
if (!rctx->lfde) {
- SYSLOG_ERROR("Failed to queue handler on pipe\n");
+ DEBUG(0, ("Failed to queue handler on pipe\n"));
goto failed;
}
}
@@ -450,18 +450,18 @@ static int set_unix_socket(struct resp_ctx *rctx)
unlink(rctx->priv_sock_name);
if (bind(rctx->priv_lfd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
- SYSLOG_ERROR("Unable to bind on socket '%s'\n", rctx->priv_sock_name);
+ DEBUG(0,("Unable to bind on socket '%s'\n", rctx->priv_sock_name));
goto failed;
}
if (listen(rctx->priv_lfd, 10) != 0) {
- SYSLOG_ERROR("Unable to listen on socket '%s'\n", rctx->priv_sock_name);
+ DEBUG(0,("Unable to listen on socket '%s'\n", rctx->priv_sock_name));
goto failed;
}
rctx->priv_lfde = tevent_add_fd(rctx->ev, rctx, rctx->priv_lfd,
TEVENT_FD_READ, accept_priv_fd_handler, rctx);
if (!rctx->priv_lfde) {
- SYSLOG_ERROR("Failed to queue handler on privileged pipe\n");
+ DEBUG(0, ("Failed to queue handler on privileged pipe\n"));
goto failed;
}
}
@@ -500,7 +500,7 @@ int sss_process_init(TALLOC_CTX *mem_ctx,
rctx = talloc_zero(mem_ctx, struct resp_ctx);
if (!rctx) {
- SYSLOG_ERROR("fatal error initializing resp_ctx\n");
+ DEBUG(0, ("fatal error initializing resp_ctx\n"));
return ENOMEM;
}
rctx->ev = ev;
@@ -512,13 +512,13 @@ int sss_process_init(TALLOC_CTX *mem_ctx,
ret = confdb_get_domains(rctx->cdb, &rctx->domains);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error setting up domain map\n");
+ DEBUG(0, ("fatal error setting up domain map\n"));
return ret;
}
ret = sss_monitor_init(rctx, monitor_intf, svc_name, svc_version);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error setting up message bus\n");
+ DEBUG(0, ("fatal error setting up message bus\n"));
return ret;
}
@@ -526,30 +526,30 @@ int sss_process_init(TALLOC_CTX *mem_ctx,
cli_type, cli_version,
cli_name, cli_domain);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error setting up backend connector\n");
+ DEBUG(0, ("fatal error setting up backend connector\n"));
return ret;
}
else if (!rctx->dp_conn) {
- SYSLOG_ERROR("Data Provider is not yet available. Retrying.\n");
+ DEBUG(0, ("Data Provider is not yet available. Retrying.\n"));
return EIO;
}
ret = sysdb_init(rctx, ev, cdb, NULL, false, &rctx->db_list);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error initializing resp_ctx\n");
+ DEBUG(0, ("fatal error initializing resp_ctx\n"));
return ret;
}
ret = sss_names_init(rctx, rctx->cdb, &rctx->names);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error initializing regex data\n");
+ DEBUG(0, ("fatal error initializing regex data\n"));
return ret;
}
/* after all initializations we are ready to listen on our socket */
ret = set_unix_socket(rctx);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error initializing socket\n");
+ DEBUG(0, ("fatal error initializing socket\n"));
return ret;
}
diff --git a/server/responder/common/responder_dp.c b/server/responder/common/responder_dp.c
index a51fc5e4..a6365186 100644
--- a/server/responder/common/responder_dp.c
+++ b/server/responder/common/responder_dp.c
@@ -70,7 +70,7 @@ static int sss_dp_req_destructor(void *ptr)
key.str = sdp_req->key;
int hret = hash_delete(dp_requests, &key);
if (hret != HASH_SUCCESS) {
- SYSLOG_ERROR("Could not clear entry from request queue\n");
+ DEBUG(0, ("Could not clear entry from request queue\n"));
/* This should never happen */
return EIO;
}
@@ -269,7 +269,7 @@ int sss_dp_send_acct_req(struct resp_ctx *rctx, TALLOC_CTX *memctx,
/* We have a new request asking for a callback */
sdp_req = talloc_get_type(value.ptr, struct sss_dp_req);
if (!sdp_req) {
- SYSLOG_ERROR("Could not retrieve DP request context\n");
+ DEBUG(0, ("Could not retrieve DP request context\n"));
ret = EIO;
goto done;
}
@@ -303,8 +303,8 @@ int sss_dp_send_acct_req(struct resp_ctx *rctx, TALLOC_CTX *memctx,
value.ptr = sdp_req;
hret = hash_enter(dp_requests, &key, &value);
if (hret != HASH_SUCCESS) {
- SYSLOG_ERROR("Could not store request query (%s)",
- hash_error_string(hret));
+ DEBUG(0, ("Could not store request query (%s)",
+ hash_error_string(hret)));
ret = EIO;
goto done;
}
@@ -315,8 +315,8 @@ int sss_dp_send_acct_req(struct resp_ctx *rctx, TALLOC_CTX *memctx,
break;
default:
- SYSLOG_ERROR("Could not query request list (%s)\n",
- hash_error_string(hret));
+ DEBUG(0,("Could not query request list (%s)\n",
+ hash_error_string(hret)));
ret = EIO;
goto done;
}
@@ -364,7 +364,7 @@ static int sss_dp_send_acct_req_create(struct resp_ctx *rctx,
DP_CLI_INTERFACE,
DP_SRV_METHOD_GETACCTINFO);
if (msg == NULL) {
- SYSLOG_ERROR("Out of memory?!\n");
+ DEBUG(0,("Out of memory?!\n"));
return ENOMEM;
}
@@ -390,7 +390,7 @@ static int sss_dp_send_acct_req_create(struct resp_ctx *rctx,
* We can't communicate on this connection
* We'll drop it using the default destructor.
*/
- SYSLOG_ERROR("D-BUS send failed.\n");
+ DEBUG(0, ("D-BUS send failed.\n"));
dbus_message_unref(msg);
return EIO;
}
@@ -423,7 +423,7 @@ static int sss_dp_send_acct_req_create(struct resp_ctx *rctx,
sss_dp_send_acct_callback,
sdp_req, NULL);
if (!dbret) {
- SYSLOG_ERROR("Could not queue up pending request!");
+ DEBUG(0, ("Could not queue up pending request!"));
talloc_zfree(sdp_req);
dbus_pending_call_cancel(pending_reply);
dbus_message_unref(msg);
@@ -456,7 +456,7 @@ static int sss_dp_get_reply(DBusPendingCall *pending,
* until reply is valid or timeout has occurred. If reply is NULL
* here, something is seriously wrong and we should bail out.
*/
- SYSLOG_ERROR("Severe error. A reply callback was called but no reply was received and no timeout occurred\n");
+ DEBUG(0, ("Severe error. A reply callback was called but no reply was received and no timeout occurred\n"));
/* FIXME: Destroy this connection ? */
err = EIO;
@@ -490,8 +490,8 @@ static int sss_dp_get_reply(DBusPendingCall *pending,
err = ETIME;
goto done;
}
- SYSLOG_ERROR("The Data Provider returned an error [%s]\n",
- dbus_message_get_error_name(reply));
+ DEBUG(0,("The Data Provider returned an error [%s]\n",
+ dbus_message_get_error_name(reply)));
/* Falling through to default intentionally*/
default:
/*
diff --git a/server/responder/nss/nsssrv.c b/server/responder/nss/nsssrv.c
index e0bdcdd3..3920189a 100644
--- a/server/responder/nss/nsssrv.c
+++ b/server/responder/nss/nsssrv.c
@@ -46,8 +46,6 @@
#define SSS_NSS_PIPE_NAME "nss"
-#define PRG_NAME "sssd[nss]"
-
static int service_reload(DBusMessage *message, struct sbus_connection *conn);
struct sbus_method monitor_nss_methods[] = {
@@ -115,13 +113,13 @@ static int nss_get_config(struct nss_ctx *nctx,
&nctx->cache_refresh_timeout);
if (ret != EOK) goto done;
if (nctx->cache_refresh_timeout >= nctx->cache_timeout) {
- SYSLOG_ERROR("Configuration error: EntryCacheNoWaitRefreshTimeout exceeds"
- "EntryCacheTimeout. Disabling feature.\n");
+ DEBUG(0,("Configuration error: EntryCacheNoWaitRefreshTimeout exceeds"
+ "EntryCacheTimeout. Disabling feature.\n"));
nctx->cache_refresh_timeout = 0;
}
if (nctx->cache_refresh_timeout < 0) {
- SYSLOG_ERROR("Configuration error: EntryCacheNoWaitRefreshTimeout is"
- "invalid. Disabling feature.\n");
+ DEBUG(0,("Configuration error: EntryCacheNoWaitRefreshTimeout is"
+ "invalid. Disabling feature.\n"));
nctx->cache_refresh_timeout = 0;
}
@@ -241,7 +239,7 @@ static void nss_dp_reconnect_init(struct sbus_connection *conn,
}
/* Failed to reconnect */
- SYSLOG_ERROR("Could not reconnect to data provider.\n");
+ DEBUG(0, ("Could not reconnect to data provider.\n"));
/* Kill the backend and let the monitor restart it */
nss_shutdown(rctx);
}
@@ -256,13 +254,13 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
nctx = talloc_zero(mem_ctx, struct nss_ctx);
if (!nctx) {
- SYSLOG_ERROR("fatal error initializing nss_ctx\n");
+ DEBUG(0, ("fatal error initializing nss_ctx\n"));
return ENOMEM;
}
ret = nss_ncache_init(nctx, &nctx->ncache);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error initializing negative cache\n");
+ DEBUG(0, ("fatal error initializing negative cache\n"));
return ret;
}
@@ -287,7 +285,7 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
ret = nss_get_config(nctx, nctx->rctx, cdb);
if (ret != EOK) {
- SYSLOG_ERROR("fatal error getting nss config\n");
+ DEBUG(0, ("fatal error getting nss config\n"));
return ret;
}
@@ -296,7 +294,7 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
SERVICE_CONF_ENTRY,
"reconnection_retries", 3, &max_retries);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to set up automatic reconnection\n");
+ DEBUG(0, ("Failed to set up automatic reconnection\n"));
return ret;
}
@@ -335,11 +333,8 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- /* enable syslog logging */
- openlog(PRG_NAME, LOG_PID, LOG_DAEMON);
-
/* set up things like debug , signals, daemonization, etc... */
- ret = server_setup(PRG_NAME, 0, NSS_SRV_CONFIG, &main_ctx);
+ ret = server_setup("sssd[nss]", 0, NSS_SRV_CONFIG, &main_ctx);
if (ret != EOK) return 2;
ret = die_if_parent_died();
@@ -356,9 +351,6 @@ int main(int argc, const char *argv[])
/* loop on main */
server_loop(main_ctx);
- /* close syslog */
- closelog();
-
return 0;
}
diff --git a/server/responder/nss/nsssrv_cmd.c b/server/responder/nss/nsssrv_cmd.c
index 87886a30..8ca0be68 100644
--- a/server/responder/nss/nsssrv_cmd.c
+++ b/server/responder/nss/nsssrv_cmd.c
@@ -464,7 +464,7 @@ static void nss_cmd_getpwnam_callback(void *ptr, int status,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_getpwnam(cmdctx, sysdb,
@@ -562,7 +562,7 @@ static void nss_cmd_getpwnam_dp_callback(uint16_t err_maj, uint32_t err_min,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_getpwnam(cmdctx, sysdb,
@@ -692,7 +692,7 @@ static int nss_cmd_getpwnam(struct cli_ctx *cctx)
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
ret = EFAULT;
goto done;
}
@@ -782,8 +782,8 @@ static void nss_cmd_getpwuid_callback(void *ptr, int status,
ret = ENOENT;
}
if (dom == NULL) {
- SYSLOG_ERROR("No matching domain found for [%lu], fail!\n",
- (unsigned long)cmdctx->id);
+ DEBUG(0, ("No matching domain found for [%lu], fail!\n",
+ (unsigned long)cmdctx->id));
ret = ENOENT;
}
@@ -799,7 +799,7 @@ static void nss_cmd_getpwuid_callback(void *ptr, int status,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_getpwuid(cmdctx, sysdb,
@@ -897,7 +897,7 @@ static void nss_cmd_getpwuid_dp_callback(uint16_t err_maj, uint32_t err_min,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_getpwuid(cmdctx, sysdb,
@@ -985,7 +985,7 @@ static int nss_cmd_getpwuid(struct cli_ctx *cctx)
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
ret = EFAULT;
goto done;
}
@@ -1113,7 +1113,7 @@ static void nss_cmd_setpwent_callback(void *ptr, int status,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_enumpwent(dctx, sysdb,
@@ -1174,7 +1174,7 @@ static void nss_cmd_setpw_dp_callback(uint16_t err_maj, uint32_t err_min,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_enumpwent(cmdctx, sysdb,
@@ -1260,7 +1260,7 @@ static int nss_cmd_setpwent_ext(struct cli_ctx *cctx, bool immediate)
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
ret = EFAULT;
goto done;
}
@@ -1798,7 +1798,7 @@ static void nss_cmd_getgrnam_callback(void *ptr, int status,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_getgrnam(cmdctx, sysdb,
@@ -1892,7 +1892,7 @@ static void nss_cmd_getgrnam_dp_callback(uint16_t err_maj, uint32_t err_min,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_getgrnam(cmdctx, sysdb,
@@ -2022,7 +2022,7 @@ static int nss_cmd_getgrnam(struct cli_ctx *cctx)
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
ret = EFAULT;
goto done;
}
@@ -2113,8 +2113,8 @@ static void nss_cmd_getgrgid_callback(void *ptr, int status,
ret = ENOENT;
}
if (dom == NULL) {
- SYSLOG_ERROR("No matching domain found for [%lu], fail!\n",
- (unsigned long)cmdctx->id);
+ DEBUG(0, ("No matching domain found for [%lu], fail!\n",
+ (unsigned long)cmdctx->id));
ret = ENOENT;
}
@@ -2130,7 +2130,7 @@ static void nss_cmd_getgrgid_callback(void *ptr, int status,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_getgrgid(cmdctx, sysdb,
@@ -2222,7 +2222,7 @@ static void nss_cmd_getgrgid_dp_callback(uint16_t err_maj, uint32_t err_min,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_getgrgid(cmdctx, sysdb,
@@ -2310,7 +2310,7 @@ static int nss_cmd_getgrgid(struct cli_ctx *cctx)
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
ret = EFAULT;
goto done;
}
@@ -2434,7 +2434,7 @@ static void nss_cmd_setgrent_callback(void *ptr, int status,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_enumgrent(dctx, sysdb,
@@ -2495,7 +2495,7 @@ static void nss_cmd_setgr_dp_callback(uint16_t err_maj, uint32_t err_min,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_enumgrent(dctx, sysdb,
@@ -2581,7 +2581,7 @@ static int nss_cmd_setgrent_ext(struct cli_ctx *cctx, bool immediate)
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
ret = EFAULT;
goto done;
}
@@ -2824,7 +2824,7 @@ static void nss_cmd_getinitgr_callback(uint16_t err_maj, uint32_t err_min,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_initgroups(cmdctx, sysdb,
@@ -2875,7 +2875,7 @@ static void nss_cmd_getinitnam_dp_callback(uint16_t err_maj, uint32_t err_min,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_getpwnam(cmdctx, sysdb,
@@ -3021,7 +3021,7 @@ static void nss_cmd_getinit_callback(void *ptr, int status,
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
NSS_CMD_FATAL_ERROR(cctx);
}
ret = sysdb_getpwnam(cmdctx, sysdb,
@@ -3200,7 +3200,7 @@ static int nss_cmd_initgroups(struct cli_ctx *cctx)
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
dctx->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
ret = EFAULT;
goto done;
}
diff --git a/server/responder/pam/pam_LOCAL_domain.c b/server/responder/pam/pam_LOCAL_domain.c
index 25a5aed4..41d64b3e 100644
--- a/server/responder/pam/pam_LOCAL_domain.c
+++ b/server/responder/pam/pam_LOCAL_domain.c
@@ -462,7 +462,7 @@ int LOCAL_pam_handler(struct pam_auth_req *preq)
ret = sysdb_get_ctx_from_list(preq->cctx->rctx->db_list,
preq->domain, &lreq->dbctx);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
talloc_free(lreq);
return ret;
}
diff --git a/server/responder/pam/pamsrv.c b/server/responder/pam/pamsrv.c
index 4e0bf83e..c751528f 100644
--- a/server/responder/pam/pamsrv.c
+++ b/server/responder/pam/pamsrv.c
@@ -48,8 +48,6 @@
#define PAM_SBUS_SERVICE_NAME "pam"
#define PAM_SRV_CONFIG "config/services/pam"
-#define PRG_NAME "sssd[pam]"
-
static int service_reload(DBusMessage *message, struct sbus_connection *conn);
struct sbus_method monitor_pam_methods[] = {
@@ -119,7 +117,7 @@ static void pam_dp_reconnect_init(struct sbus_connection *conn, int status, void
}
/* Handle failure */
- SYSLOG_ERROR("Could not reconnect to data provider.\n");
+ DEBUG(0, ("Could not reconnect to data provider.\n"));
/* Kill the backend and let the monitor restart it */
pam_shutdown(rctx);
}
@@ -157,7 +155,7 @@ static int pam_process_init(TALLOC_CTX *mem_ctx,
ret = confdb_get_int(rctx->cdb, rctx, SERVICE_CONF_ENTRY,
"reconnection_retries", 3, &max_retries);
if (ret != EOK) {
- SYSLOG_ERROR("Failed to set up automatic reconnection\n");
+ DEBUG(0, ("Failed to set up automatic reconnection\n"));
return ret;
}
@@ -193,11 +191,8 @@ int main(int argc, const char *argv[])
poptFreeContext(pc);
- /* enable syslog logging */
- openlog(PRG_NAME, LOG_PID, LOG_DAEMON);
-
/* set up things like debug , signals, daemonization, etc... */
- ret = server_setup(PRG_NAME, 0, PAM_SRV_CONFIG, &main_ctx);
+ ret = server_setup("sssd[pam]", 0, PAM_SRV_CONFIG, &main_ctx);
if (ret != EOK) return 2;
ret = die_if_parent_died();
@@ -214,9 +209,6 @@ int main(int argc, const char *argv[])
/* loop on main */
server_loop(main_ctx);
- /* close syslog */
- closelog();
-
return 0;
}
diff --git a/server/responder/pam/pamsrv_cache.c b/server/responder/pam/pamsrv_cache.c
index 51e8354d..9c5c209f 100644
--- a/server/responder/pam/pamsrv_cache.c
+++ b/server/responder/pam/pamsrv_cache.c
@@ -148,7 +148,7 @@ int pam_cache_auth(struct pam_auth_req *preq)
ret = sysdb_get_ctx_from_list(preq->cctx->rctx->db_list,
preq->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
return ret;
}
ret = sysdb_get_user_attr(preq, sysdb,
diff --git a/server/responder/pam/pamsrv_cmd.c b/server/responder/pam/pamsrv_cmd.c
index 874ff201..671dc087 100644
--- a/server/responder/pam/pamsrv_cmd.c
+++ b/server/responder/pam/pamsrv_cmd.c
@@ -532,7 +532,7 @@ static int pam_forwarder(struct cli_ctx *cctx, int pam_cmd)
ret = sysdb_get_ctx_from_list(cctx->rctx->db_list,
preq->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
goto done;
}
ret = sysdb_getpwnam(preq, sysdb,
@@ -584,7 +584,7 @@ static void pam_check_user_dp_callback(uint16_t err_maj, uint32_t err_min,
ret = sysdb_get_ctx_from_list(preq->cctx->rctx->db_list,
preq->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
goto done;
}
ret = sysdb_getpwnam(preq, sysdb,
@@ -733,7 +733,7 @@ static void pam_check_user_callback(void *ptr, int status,
ret = sysdb_get_ctx_from_list(preq->cctx->rctx->db_list,
preq->domain, &sysdb);
if (ret != EOK) {
- SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
+ DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
preq->pd->pam_status = PAM_SYSTEM_ERR;
pam_reply(preq);
return;
diff --git a/server/responder/pam/pamsrv_dp.c b/server/responder/pam/pamsrv_dp.c
index 3f2a9bce..7ea2b7e4 100644
--- a/server/responder/pam/pamsrv_dp.c
+++ b/server/responder/pam/pamsrv_dp.c
@@ -46,7 +46,7 @@ static void pam_dp_process_reply(DBusPendingCall *pending, void *ptr)
dbus_pending_call_block(pending);
msg = dbus_pending_call_steal_reply(pending);
if (msg == NULL) {
- SYSLOG_ERROR("Severe error. A reply callback was called but no reply was received and no timeout occurred\n");
+ DEBUG(0, ("Severe error. A reply callback was called but no reply was received and no timeout occurred\n"));
preq->pd->pam_status = PAM_SYSTEM_ERR;
goto done;
}
@@ -57,18 +57,18 @@ static void pam_dp_process_reply(DBusPendingCall *pending, void *ptr)
case DBUS_MESSAGE_TYPE_METHOD_RETURN:
ret = dp_unpack_pam_response(msg, preq->pd, &dbus_error);
if (!ret) {
- SYSLOG_ERROR("Failed to parse reply.\n");
+ DEBUG(0, ("Failed to parse reply.\n"));
preq->pd->pam_status = PAM_SYSTEM_ERR;
goto done;
}
DEBUG(4, ("received: [%d][%s]\n", preq->pd->pam_status, preq->pd->domain));
break;
case DBUS_MESSAGE_TYPE_ERROR:
- SYSLOG_ERROR("Reply error.\n");
+ DEBUG(0, ("Reply error.\n"));
preq->pd->pam_status = PAM_SYSTEM_ERR;
break;
default:
- SYSLOG_ERROR("Default... what now?.\n");
+ DEBUG(0, ("Default... what now?.\n"));
preq->pd->pam_status = PAM_SYSTEM_ERR;
}
@@ -103,7 +103,7 @@ int pam_dp_send_req(struct pam_auth_req *preq, int timeout)
DP_CLI_INTERFACE,
DP_SRV_METHOD_PAMHANDLER);
if (msg == NULL) {
- SYSLOG_ERROR("Out of memory?!\n");
+ DEBUG(0,("Out of memory?!\n"));
return ENOMEM;
}
@@ -124,7 +124,7 @@ int pam_dp_send_req(struct pam_auth_req *preq, int timeout)
* We can't communicate on this connection
* We'll drop it using the default destructor.
*/
- SYSLOG_ERROR("D-BUS send failed.\n");
+ DEBUG(0, ("D-BUS send failed.\n"));
dbus_message_unref(msg);
return EIO;
}
diff --git a/server/sbus/sssd_dbus_common.c b/server/sbus/sssd_dbus_common.c
index 8ec15215..e5970a3e 100644
--- a/server/sbus/sssd_dbus_common.c
+++ b/server/sbus/sssd_dbus_common.c
@@ -130,7 +130,7 @@ dbus_bool_t sbus_add_watch(DBusWatch *dbus_watch, void *data)
/* does not exist, allocate new one */
watch = talloc_zero(conn, struct sbus_watch_ctx);
if (!watch) {
- SYSLOG_ERROR("Out of Memory!\n");
+ DEBUG(0, ("Out of Memory!\n"));
return FALSE;
}
watch->conn = conn;
@@ -170,7 +170,7 @@ dbus_bool_t sbus_add_watch(DBusWatch *dbus_watch, void *data)
watch, fd, event_flags,
sbus_watch_handler, watch);
if (!watch->fde) {
- SYSLOG_ERROR("Failed to set up fd event!\n");
+ DEBUG(0, ("Failed to set up fd event!\n"));
talloc_zfree(watch);
return FALSE;
}
@@ -323,7 +323,7 @@ dbus_bool_t sbus_add_timeout(DBusTimeout *dbus_timeout, void *data)
timeout = talloc_zero(conn, struct sbus_timeout_ctx);
if (!timeout) {
- SYSLOG_ERROR("Out of Memory!\n");
+ DEBUG(0, ("Out of Memory!\n"));
return FALSE;
}
timeout->dbus_timeout = dbus_timeout;
@@ -332,7 +332,7 @@ dbus_bool_t sbus_add_timeout(DBusTimeout *dbus_timeout, void *data)
timeout->te = tevent_add_timer(conn->ev, timeout, tv,
sbus_timeout_handler, timeout);
if (!timeout->te) {
- SYSLOG_ERROR("Failed to set up timeout event!\n");
+ DEBUG(0, ("Failed to set up timeout event!\n"));
return FALSE;
}
diff --git a/server/sbus/sssd_dbus_connection.c b/server/sbus/sssd_dbus_connection.c
index 907194f8..1953ee59 100644
--- a/server/sbus/sssd_dbus_connection.c
+++ b/server/sbus/sssd_dbus_connection.c
@@ -61,7 +61,7 @@ static void sbus_dispatch(struct tevent_context *ev,
/* Currently trying to reconnect, defer dispatch */
new_event = tevent_add_timer(ev, conn, tv, sbus_dispatch, conn);
if (new_event == NULL) {
- SYSLOG_ERROR("Could not defer dispatch!\n");
+ DEBUG(0,("Could not defer dispatch!\n"));
}
return;
}
@@ -75,7 +75,7 @@ static void sbus_dispatch(struct tevent_context *ev,
return;
}
- SYSLOG_ERROR("Cannot start auto-reconnection.\n");
+ DEBUG(0, ("Cannot start auto-reconnection.\n"));
conn->reconnect_callback(conn,
SBUS_RECONNECT_ERROR,
conn->reconnect_pvt);
@@ -483,7 +483,7 @@ int sbus_conn_add_interface(struct sbus_connection *conn,
path = intf->path;
if (path_in_interface_list(conn->intf_list, path)) {
- SYSLOG_ERROR("Cannot add method context with identical path.\n");
+ DEBUG(0, ("Cannot add method context with identical path.\n"));
return EINVAL;
}
@@ -499,7 +499,7 @@ int sbus_conn_add_interface(struct sbus_connection *conn,
dbret = dbus_connection_register_object_path(conn->dbus.conn,
path, &intf->vtable, intf_p);
if (!dbret) {
- SYSLOG_ERROR("Could not register object path to the connection.\n");
+ DEBUG(0, ("Could not register object path to the connection.\n"));
return ENOMEM;
}
@@ -580,7 +580,7 @@ static void sbus_reconnect(struct tevent_context *ev,
&iter->intf->vtable,
iter);
if (!dbret) {
- SYSLOG_ERROR("Could not register object path.\n");
+ DEBUG(0, ("Could not register object path.\n"));
dbus_connection_unref(conn->dbus.conn);
goto failed;
}
diff --git a/server/tools/tools_util.c b/server/tools/tools_util.c
index 34b2881d..eeec13c0 100644
--- a/server/tools/tools_util.c
+++ b/server/tools/tools_util.c
@@ -226,9 +226,6 @@ int init_sss_tools(struct tools_ctx **_tctx)
octx->domain = tctx->local;
tctx->octx = octx;
- /* No syslog in tools */
- send_syslog = 0;
-
*_tctx = tctx;
ret = EOK;
fini:
diff --git a/server/util/debug.c b/server/util/debug.c
index f0b5865e..a7b3a091 100644
--- a/server/util/debug.c
+++ b/server/util/debug.c
@@ -29,7 +29,6 @@
const char *debug_prg_name = "sssd";
int debug_level = 0;
int debug_timestamps = 0;
-int send_syslog = 1;
void debug_fn(const char *format, ...)
{
diff --git a/server/util/server.c b/server/util/server.c
index c195864f..0760e60f 100644
--- a/server/util/server.c
+++ b/server/util/server.c
@@ -62,11 +62,11 @@ static void close_low_fds(bool stderr_too)
if (fd < 0)
fd = open("/dev/null",O_WRONLY,0);
if (fd < 0) {
- SYSLOG_ERROR("Can't open /dev/null\n");
+ DEBUG(0,("Can't open /dev/null\n"));
return;
}
if (fd != i) {
- SYSLOG_ERROR("Didn't get file descriptor %d\n",i);
+ DEBUG(0,("Didn't get file descriptor %d\n",i));
return;
}
}
@@ -94,8 +94,8 @@ void become_daemon(bool Fork)
errno = 0;
if(chdir("/") == -1) {
ret = errno;
- SYSLOG_ERROR("Cannot change directory (%d [%s])\n",
- ret, strerror(ret));
+ DEBUG(0, ("Cannot change directory (%d [%s])\n",
+ ret, strerror(ret)));
return;
}
@@ -187,7 +187,7 @@ static void sig_term(int sig)
#if HAVE_GETPGRP
static int done_sigterm;
if (done_sigterm == 0 && getpgrp() == getpid()) {
- SYSLOG_NOTICE("SIGTERM: killing children\n");
+ DEBUG(0,("SIGTERM: killing children\n"));
done_sigterm = 1;
kill(-getpgrp(), SIGTERM);
}
@@ -201,7 +201,7 @@ static void sig_segv_abrt(int sig)
#if HAVE_GETPGRP
static int done;
if (done == 0 && getpgrp() == getpid()) {
- SYSLOG_NOTICE("%s: killing children\n", strsignal(sig));
+ DEBUG(0,("%s: killing children\n", strsignal(sig)));
done = 1;
kill(-getpgrp(), SIGTERM);
}
@@ -258,7 +258,7 @@ static void server_stdin_handler(struct tevent_context *event_ctx,
const char *binary_name = (const char *)private;
uint8_t c;
if (read(0, &c, 1) == 0) {
- SYSLOG_NOTICE("%s: EOF on stdin - terminating\n", binary_name);
+ DEBUG(0,("%s: EOF on stdin - terminating\n", binary_name));
#if HAVE_GETPGRP
if (getpgrp() == getpid()) {
kill(-getpgrp(), SIGTERM);
@@ -320,8 +320,8 @@ int server_setup(const char *name, int flags,
if (flags & FLAGS_PID_FILE) {
ret = pidfile(PID_PATH, name);
if (ret != EOK) {
- SYSLOG_ERROR("Error creating pidfile! (%d [%s])\n",
- ret, strerror(ret));
+ DEBUG(0, ("Error creating pidfile! (%d [%s])\n",
+ ret, strerror(ret)));
return ret;
}
}
@@ -335,13 +335,13 @@ int server_setup(const char *name, int flags,
* Everything else should hang off that */
event_ctx = tevent_context_init(talloc_autofree_context());
if (event_ctx == NULL) {
- SYSLOG_ERROR("The event context initialiaziton failed\n");
+ DEBUG(0,("The event context initialiaziton failed\n"));
return 1;
}
ctx = talloc(event_ctx, struct main_context);
if (ctx == NULL) {
- SYSLOG_ERROR("Out of memory, aborting!\n");
+ DEBUG(0,("Out of memory, aborting!\n"));
return ENOMEM;
}
@@ -349,14 +349,14 @@ int server_setup(const char *name, int flags,
conf_db = talloc_asprintf(ctx, "%s/%s", DB_PATH, CONFDB_FILE);
if (conf_db == NULL) {
- SYSLOG_ERROR("Out of memory, aborting!\n");
+ DEBUG(0,("Out of memory, aborting!\n"));
return ENOMEM;
}
DEBUG(3, ("CONFDB: %s\n", conf_db));
ret = confdb_init(ctx, &ctx->confdb_ctx, conf_db);
if (ret != EOK) {
- SYSLOG_ERROR("The confdb initialization failed\n");
+ DEBUG(0,("The confdb initialization failed\n"));
return ret;
}
@@ -364,8 +364,8 @@ int server_setup(const char *name, int flags,
ret = confdb_get_int(ctx->confdb_ctx, ctx, conf_entry,
"debug-level", debug_level, &debug_level);
if (ret != EOK) {
- SYSLOG_ERROR("Error reading from confdb (%d) [%s]\n",
- ret, strerror(ret));
+ DEBUG(0, ("Error reading from confdb (%d) [%s]\n",
+ ret, strerror(ret)));
return ret;
}
@@ -374,8 +374,8 @@ int server_setup(const char *name, int flags,
ret = confdb_get_bool(ctx->confdb_ctx, ctx, conf_entry,
"debug-timestamps", dt, &dt);
if (ret != EOK) {
- SYSLOG_ERROR("Error reading from confdb (%d) [%s]\n",
- ret, strerror(ret));
+ DEBUG(0, ("Error reading from confdb (%d) [%s]\n",
+ ret, strerror(ret)));
return ret;
}
if (dt) debug_timestamps = 1;
diff --git a/server/util/util.h b/server/util/util.h
index 1b039637..ea7f44e8 100644
--- a/server/util/util.h
+++ b/server/util/util.h
@@ -30,7 +30,6 @@
#include <limits.h>
#include <time.h>
#include <pcre.h>
-#include <syslog.h>
#include "config.h"
#include "talloc.h"
#include "tevent.h"
@@ -44,7 +43,6 @@ typedef int errno_t;
extern const char *debug_prg_name;
extern int debug_level;
extern int debug_timestamps;
-extern int send_syslog;
void debug_fn(const char *format, ...);
#define SSSD_DEBUG_OPTS \
@@ -83,20 +81,6 @@ void debug_fn(const char *format, ...);
#define PRINT(fmt, ...) fprintf(stdout, gettext(fmt), ##__VA_ARGS__)
#define ERROR(fmt, ...) fprintf(stderr, gettext(fmt), ##__VA_ARGS__)
-#define SYSLOG_ERROR(...) do { \
- DEBUG(0, (__VA_ARGS__)); \
- if (send_syslog) { \
- syslog(LOG_ERR, __VA_ARGS__); \
- } \
-} while(0);
-
-#define SYSLOG_NOTICE(...) do { \
- DEBUG(0, (__VA_ARGS__)); \
- if (send_syslog) { \
- syslog(LOG_NOTICE, __VA_ARGS__); \
- } \
-} while(0);
-
#ifndef discard_const
#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
#endif