From 87b8670b2749d02ffdc6c06506ac692b09db5be2 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Tue, 22 Sep 2009 13:11:29 -0400 Subject: 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. --- server/responder/common/responder_common.c | 52 +++++++++++++++--------------- server/responder/common/responder_dp.c | 24 +++++++------- server/responder/nss/nsssrv.c | 28 ++++++---------- server/responder/nss/nsssrv_cmd.c | 52 +++++++++++++++--------------- server/responder/pam/pam_LOCAL_domain.c | 2 +- server/responder/pam/pamsrv.c | 14 ++------ server/responder/pam/pamsrv_cache.c | 2 +- server/responder/pam/pamsrv_cmd.c | 6 ++-- server/responder/pam/pamsrv_dp.c | 12 +++---- 9 files changed, 88 insertions(+), 104 deletions(-) (limited to 'server/responder') diff --git a/server/responder/common/responder_common.c b/server/responder/common/responder_common.c index 119a1dd4b..57c8678bf 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 a51fc5e4f..a6365186a 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 e0bdcdd32..3920189af 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 87886a309..8ca0be682 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 25a5aed4b..41d64b3e6 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 4e0bf83e5..c751528f7 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 51e8354d6..9c5c209f2 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 874ff201c..671dc0873 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 3f2a9bce7..7ea2b7e44 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; } -- cgit