From 28a410f423bf9bcdf43ed14cd4c50634753b51f3 Mon Sep 17 00:00:00 2001 From: Stephen Gallagher Date: Mon, 2 May 2011 10:04:44 -0400 Subject: 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. --- src/providers/data_provider_be.c | 38 +++----------------------------------- 1 file changed, 3 insertions(+), 35 deletions(-) (limited to 'src/providers/data_provider_be.c') diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c index 01d285580..0fbf809e5 100644 --- a/src/providers/data_provider_be.c +++ b/src/providers/data_provider_be.c @@ -868,40 +868,6 @@ static int be_srv_init(struct be_ctx *ctx) return EOK; } -/* mon_cli_init - * sbus channel to the monitor daemon */ -static int mon_cli_init(struct be_ctx *ctx) -{ - char *sbus_address; - int ret; - - /* Set up SBUS connection to the monitor */ - ret = monitor_get_sbus_address(ctx, &sbus_address); - if (ret != EOK) { - DEBUG(0, ("Could not locate monitor address.\n")); - return ret; - } - - ret = sbus_client_init(ctx, ctx->ev, sbus_address, - &monitor_be_interface, &ctx->mon_conn, - NULL, ctx); - if (ret != EOK) { - DEBUG(0, ("Failed to connect to monitor services.\n")); - return ret; - } - - /* Identify ourselves to the monitor */ - ret = monitor_common_send_id(ctx->mon_conn, - ctx->identity, - DATA_PROVIDER_VERSION); - if (ret != EOK) { - DEBUG(0, ("Failed to identify to the monitor!\n")); - return ret; - } - - return EOK; -} - static void be_target_access_permit(struct be_req *be_req) { struct pam_data *pd = talloc_get_type(be_req->req_data, struct pam_data); @@ -1138,7 +1104,9 @@ int be_process_init(TALLOC_CTX *mem_ctx, return ret; } - ret = mon_cli_init(ctx); + ret = sss_monitor_init(ctx, ctx->ev, &monitor_be_interface, + ctx->identity, DATA_PROVIDER_VERSION, + ctx, &ctx->mon_conn); if (ret != EOK) { DEBUG(0, ("fatal error setting up monitor bus\n")); return ret; -- cgit