summaryrefslogtreecommitdiff
path: root/src/responder/common
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2011-05-02 10:04:44 -0400
committerStephen Gallagher <sgallagh@redhat.com>2011-05-06 10:24:36 -0400
commit28a410f423bf9bcdf43ed14cd4c50634753b51f3 (patch)
treede0eaa4cb0dccc5147d070ad8b76d8226c27a38b /src/responder/common
parent222072fd4383f742e0a1b1722946d4586fe37de7 (diff)
downloadsssd-28a410f423bf9bcdf43ed14cd4c50634753b51f3.tar.gz
sssd-28a410f423bf9bcdf43ed14cd4c50634753b51f3.tar.bz2
sssd-28a410f423bf9bcdf43ed14cd4c50634753b51f3.zip
Create common sss_monitor_init()
This was implemented almost identically for both the responders and the providers. It is easier to maintain as a single routine. This patch also adds the ability to provide a private context to attach to the sbus_connection for later use.
Diffstat (limited to 'src/responder/common')
-rw-r--r--src/responder/common/responder_common.c37
1 files changed, 3 insertions, 34 deletions
diff --git a/src/responder/common/responder_common.c b/src/responder/common/responder_common.c
index 2a4a5d20..4ddb549c 100644
--- a/src/responder/common/responder_common.c
+++ b/src/responder/common/responder_common.c
@@ -362,39 +362,6 @@ static void accept_fd_handler(struct tevent_context *ev,
return;
}
-static int sss_monitor_init(struct resp_ctx *rctx,
- struct sbus_interface *intf,
- const char *svc_name,
- uint16_t svc_version)
-{
- char *sbus_address;
- int ret;
-
- /* Set up SBUS connection to the monitor */
- ret = monitor_get_sbus_address(rctx, &sbus_address);
- if (ret != EOK) {
- DEBUG(0, ("Could not locate monitor address.\n"));
- return ret;
- }
-
- ret = sbus_client_init(rctx, rctx->ev, sbus_address,
- intf, &rctx->mon_conn,
- NULL, NULL);
- if (ret != EOK) {
- 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) {
- DEBUG(0, ("Failed to identify to the monitor!\n"));
- return ret;
- }
-
- return EOK;
-}
-
static int sss_dp_init(struct resp_ctx *rctx,
struct sbus_interface *intf,
const char *cli_name,
@@ -620,7 +587,9 @@ int sss_process_init(TALLOC_CTX *mem_ctx,
return ret;
}
- ret = sss_monitor_init(rctx, monitor_intf, svc_name, svc_version);
+ ret = sss_monitor_init(rctx, rctx->ev, monitor_intf,
+ svc_name, svc_version, rctx,
+ &rctx->mon_conn);
if (ret != EOK) {
DEBUG(0, ("fatal error setting up message bus\n"));
return ret;