summaryrefslogtreecommitdiff
path: root/server/responder
diff options
context:
space:
mode:
Diffstat (limited to 'server/responder')
-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
9 files changed, 104 insertions, 88 deletions
diff --git a/server/responder/common/responder_common.c b/server/responder/common/responder_common.c
index 57c8678b..119a1dd4 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) {
- DEBUG(0, ("Failed to read request, aborting client!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Failed to alloc request, aborting client!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Failed to alloc request, aborting client!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Failed to execute request, aborting client!\n"));
+ SYSLOG_ERROR("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;
- DEBUG(0, ("Out of memory trying to setup client context on privileged pipe!\n"));
+ SYSLOG_ERROR("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;
- DEBUG(0, ("Out of memory trying to setup client context!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Could not locate monitor address.\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Failed to connect to monitor services.\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Failed to identify to the monitor!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Could not locate DP address.\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Failed to connect to monitor services.\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Failed to identify to the DP!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0,("Unable to bind on socket '%s'\n", rctx->sock_name));
+ SYSLOG_ERROR("Unable to bind on socket '%s'\n", rctx->sock_name);
goto failed;
}
if (listen(rctx->lfd, 10) != 0) {
- DEBUG(0,("Unable to listen on socket '%s'\n", rctx->sock_name));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Failed to queue handler on pipe\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0,("Unable to bind on socket '%s'\n", rctx->priv_sock_name));
+ SYSLOG_ERROR("Unable to bind on socket '%s'\n", rctx->priv_sock_name);
goto failed;
}
if (listen(rctx->priv_lfd, 10) != 0) {
- DEBUG(0,("Unable to listen on socket '%s'\n", rctx->priv_sock_name));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Failed to queue handler on privileged pipe\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("fatal error initializing resp_ctx\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("fatal error setting up domain map\n"));
+ SYSLOG_ERROR("fatal error setting up domain map\n");
return ret;
}
ret = sss_monitor_init(rctx, monitor_intf, svc_name, svc_version);
if (ret != EOK) {
- DEBUG(0, ("fatal error setting up message bus\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("fatal error setting up backend connector\n"));
+ SYSLOG_ERROR("fatal error setting up backend connector\n");
return ret;
}
else if (!rctx->dp_conn) {
- DEBUG(0, ("Data Provider is not yet available. Retrying.\n"));
+ SYSLOG_ERROR("Data Provider is not yet available. Retrying.\n");
return EIO;
}
ret = sysdb_init(rctx, ev, cdb, NULL, false, &rctx->db_list);
if (ret != EOK) {
- DEBUG(0, ("fatal error initializing resp_ctx\n"));
+ SYSLOG_ERROR("fatal error initializing resp_ctx\n");
return ret;
}
ret = sss_names_init(rctx, rctx->cdb, &rctx->names);
if (ret != EOK) {
- DEBUG(0, ("fatal error initializing regex data\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("fatal error initializing socket\n"));
+ SYSLOG_ERROR("fatal error initializing socket\n");
return ret;
}
diff --git a/server/responder/common/responder_dp.c b/server/responder/common/responder_dp.c
index a6365186..a51fc5e4 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) {
- DEBUG(0, ("Could not clear entry from request queue\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Could not retrieve DP request context\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Could not store request query (%s)",
- hash_error_string(hret)));
+ SYSLOG_ERROR("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:
- DEBUG(0,("Could not query request list (%s)\n",
- hash_error_string(hret)));
+ SYSLOG_ERROR("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) {
- DEBUG(0,("Out of memory?!\n"));
+ SYSLOG_ERROR("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.
*/
- DEBUG(0, ("D-BUS send failed.\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Could not queue up pending request!"));
+ SYSLOG_ERROR("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.
*/
- DEBUG(0, ("Severe error. A reply callback was called but no reply was received and no timeout occurred\n"));
+ SYSLOG_ERROR("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;
}
- DEBUG(0,("The Data Provider returned an error [%s]\n",
- dbus_message_get_error_name(reply)));
+ SYSLOG_ERROR("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 3920189a..e0bdcdd3 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 8ca0be68..87886a30 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;
}
diff --git a/server/responder/pam/pam_LOCAL_domain.c b/server/responder/pam/pam_LOCAL_domain.c
index 41d64b3e..25a5aed4 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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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 c751528f..4e0bf83e 100644
--- a/server/responder/pam/pamsrv.c
+++ b/server/responder/pam/pamsrv.c
@@ -48,6 +48,8 @@
#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[] = {
@@ -117,7 +119,7 @@ static void pam_dp_reconnect_init(struct sbus_connection *conn, int status, void
}
/* Handle failure */
- 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 */
pam_shutdown(rctx);
}
@@ -155,7 +157,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) {
- DEBUG(0, ("Failed to set up automatic reconnection\n"));
+ SYSLOG_ERROR("Failed to set up automatic reconnection\n");
return ret;
}
@@ -191,8 +193,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[pam]", 0, PAM_SRV_CONFIG, &main_ctx);
+ ret = server_setup(PRG_NAME, 0, PAM_SRV_CONFIG, &main_ctx);
if (ret != EOK) return 2;
ret = die_if_parent_died();
@@ -209,6 +214,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/pam/pamsrv_cache.c b/server/responder/pam/pamsrv_cache.c
index 9c5c209f..51e8354d 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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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 671dc087..874ff201 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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Fatal: Sysdb CTX not found for this domain!\n"));
+ SYSLOG_ERROR("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 7ea2b7e4..3f2a9bce 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) {
- DEBUG(0, ("Severe error. A reply callback was called but no reply was received and no timeout occurred\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0, ("Failed to parse reply.\n"));
+ SYSLOG_ERROR("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:
- DEBUG(0, ("Reply error.\n"));
+ SYSLOG_ERROR("Reply error.\n");
preq->pd->pam_status = PAM_SYSTEM_ERR;
break;
default:
- DEBUG(0, ("Default... what now?.\n"));
+ SYSLOG_ERROR("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) {
- DEBUG(0,("Out of memory?!\n"));
+ SYSLOG_ERROR("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.
*/
- DEBUG(0, ("D-BUS send failed.\n"));
+ SYSLOG_ERROR("D-BUS send failed.\n");
dbus_message_unref(msg);
return EIO;
}