diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2009-09-18 12:35:34 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2009-09-21 10:35:10 -0400 |
commit | 8c50bd085c0efe5fde354deee2c8118887aae29d (patch) | |
tree | b3968a8878c533438aef689b79825915e2720ef2 /server/responder/pam | |
parent | 9570ca098cd0e92d1eb6aabc00fb8cac9fddd442 (diff) | |
download | sssd-8c50bd085c0efe5fde354deee2c8118887aae29d.tar.gz sssd-8c50bd085c0efe5fde354deee2c8118887aae29d.tar.bz2 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/pam')
-rw-r--r-- | server/responder/pam/pam_LOCAL_domain.c | 2 | ||||
-rw-r--r-- | server/responder/pam/pamsrv.c | 14 | ||||
-rw-r--r-- | server/responder/pam/pamsrv_cache.c | 2 | ||||
-rw-r--r-- | server/responder/pam/pamsrv_cmd.c | 6 | ||||
-rw-r--r-- | server/responder/pam/pamsrv_dp.c | 12 |
5 files changed, 22 insertions, 14 deletions
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; } |