summaryrefslogtreecommitdiffstats
path: root/server/responder/nss
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2009-09-18 12:35:34 +0200
committerStephen Gallagher <sgallagh@redhat.com>2009-09-21 10:35:10 -0400
commit8c50bd085c0efe5fde354deee2c8118887aae29d (patch)
treeb3968a8878c533438aef689b79825915e2720ef2 /server/responder/nss
parent9570ca098cd0e92d1eb6aabc00fb8cac9fddd442 (diff)
downloadsssd-8c50bd085c0efe5fde354deee2c8118887aae29d.tar.gz
sssd-8c50bd085c0efe5fde354deee2c8118887aae29d.tar.xz
sssd-8c50bd085c0efe5fde354deee2c8118887aae29d.zip
Use syslog for logging error conditions in SSSD
This is just a band-aid until ELAPI is fully functional and ready to use.
Diffstat (limited to 'server/responder/nss')
-rw-r--r--server/responder/nss/nsssrv.c28
-rw-r--r--server/responder/nss/nsssrv_cmd.c52
2 files changed, 44 insertions, 36 deletions
diff --git a/server/responder/nss/nsssrv.c b/server/responder/nss/nsssrv.c
index 3920189af..e0bdcdd32 100644
--- a/server/responder/nss/nsssrv.c
+++ b/server/responder/nss/nsssrv.c
@@ -46,6 +46,8 @@
#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[] = {
@@ -113,13 +115,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) {
- DEBUG(0,("Configuration error: EntryCacheNoWaitRefreshTimeout exceeds"
- "EntryCacheTimeout. Disabling feature.\n"));
+ SYSLOG_ERROR("Configuration error: EntryCacheNoWaitRefreshTimeout exceeds"
+ "EntryCacheTimeout. Disabling feature.\n");
nctx->cache_refresh_timeout = 0;
}
if (nctx->cache_refresh_timeout < 0) {
- DEBUG(0,("Configuration error: EntryCacheNoWaitRefreshTimeout is"
- "invalid. Disabling feature.\n"));
+ SYSLOG_ERROR("Configuration error: EntryCacheNoWaitRefreshTimeout is"
+ "invalid. Disabling feature.\n");
nctx->cache_refresh_timeout = 0;
}
@@ -239,7 +241,7 @@ static void nss_dp_reconnect_init(struct sbus_connection *conn,
}
/* Failed to reconnect */
- DEBUG(0, ("Could not reconnect to data provider.\n"));
+ SYSLOG_ERROR("Could not reconnect to data provider.\n");
/* Kill the backend and let the monitor restart it */
nss_shutdown(rctx);
}
@@ -254,13 +256,13 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
nctx = talloc_zero(mem_ctx, struct nss_ctx);
if (!nctx) {
- DEBUG(0, ("fatal error initializing nss_ctx\n"));
+ SYSLOG_ERROR("fatal error initializing nss_ctx\n");
return ENOMEM;
}
ret = nss_ncache_init(nctx, &nctx->ncache);
if (ret != EOK) {
- DEBUG(0, ("fatal error initializing negative cache\n"));
+ SYSLOG_ERROR("fatal error initializing negative cache\n");
return ret;
}
@@ -285,7 +287,7 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
ret = nss_get_config(nctx, nctx->rctx, cdb);
if (ret != EOK) {
- DEBUG(0, ("fatal error getting nss config\n"));
+ SYSLOG_ERROR("fatal error getting nss config\n");
return ret;
}
@@ -294,7 +296,7 @@ int nss_process_init(TALLOC_CTX *mem_ctx,
SERVICE_CONF_ENTRY,
"reconnection_retries", 3, &max_retries);
if (ret != EOK) {
- DEBUG(0, ("Failed to set up automatic reconnection\n"));
+ SYSLOG_ERROR("Failed to set up automatic reconnection\n");
return ret;
}
@@ -333,8 +335,11 @@ 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("sssd[nss]", 0, NSS_SRV_CONFIG, &main_ctx);
+ ret = server_setup(PRG_NAME, 0, NSS_SRV_CONFIG, &main_ctx);
if (ret != EOK) return 2;
ret = die_if_parent_died();
@@ -351,6 +356,9 @@ 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 8ca0be682..87886a309 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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("No matching domain found for [%lu], fail!\n",
- (unsigned long)cmdctx->id));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("No matching domain found for [%lu], fail!\n",
- (unsigned long)cmdctx->id));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("Fatal: Sysdb CTX not found for this domain!\n");
ret = EFAULT;
goto done;
}