diff options
Diffstat (limited to 'server/responder/common')
-rw-r--r-- | server/responder/common/responder.h | 5 | ||||
-rw-r--r-- | server/responder/common/responder_common.c | 25 | ||||
-rw-r--r-- | server/responder/common/responder_dp.c | 20 |
3 files changed, 28 insertions, 22 deletions
diff --git a/server/responder/common/responder.h b/server/responder/common/responder.h index d901704a..408ee4da 100644 --- a/server/responder/common/responder.h +++ b/server/responder/common/responder.h @@ -63,8 +63,9 @@ struct resp_ctx { struct confdb_ctx *cdb; const char *sock_name; const char *priv_sock_name; - struct service_sbus_ctx *ss_ctx; - struct service_sbus_ctx *dp_ctx; + + struct sbus_conn_ctx *conn_ctx; + struct sbus_method_ctx *sm_ctx; struct sss_domain_info *domains; diff --git a/server/responder/common/responder_common.c b/server/responder/common/responder_common.c index 825d77e7..f8744b67 100644 --- a/server/responder/common/responder_common.c +++ b/server/responder/common/responder_common.c @@ -287,10 +287,8 @@ static void accept_fd_handler(struct tevent_context *ev, static int sss_sbus_init(struct resp_ctx *rctx) { - int ret; char *sbus_address; - struct service_sbus_ctx *ss_ctx; - struct sbus_method_ctx *sm_ctx; + int ret; /* Set up SBUS connection to the monitor */ ret = monitor_get_sbus_address(rctx, rctx->cdb, &sbus_address); @@ -299,17 +297,22 @@ static int sss_sbus_init(struct resp_ctx *rctx) return ret; } - ret = monitor_init_sbus_methods(rctx, rctx->sss_sbus_methods, &sm_ctx); + ret = monitor_init_sbus_methods(rctx, rctx->sss_sbus_methods, + &rctx->sm_ctx); if (ret != EOK) { DEBUG(0, ("Could not initialize SBUS methods.\n")); return ret; } - ret = sbus_client_init(rctx, rctx->ev, - sbus_address, sm_ctx, - NULL /* Private Data */, - NULL /* Destructor */, - &ss_ctx); + /* FIXME: remove this */ + if (talloc_reference(rctx, rctx->sm_ctx) == NULL) { + DEBUG(0, ("Failed to take memory reference\n")); + return ENOMEM; + } + + ret = sbus_client_init(rctx, rctx->ev, rctx->sm_ctx, + sbus_address, &rctx->conn_ctx, + NULL, NULL); if (ret != EOK) { DEBUG(0, ("Failed to connect to monitor services.\n")); return ret; @@ -318,8 +321,6 @@ static int sss_sbus_init(struct resp_ctx *rctx) /* Set up NSS-specific listeners */ /* None currently used */ - rctx->ss_ctx = ss_ctx; - return EOK; } @@ -496,7 +497,7 @@ int sss_process_init(TALLOC_CTX *mem_ctx, DEBUG(0, ("fatal error setting up backend connector\n")); return ret; } - else if (!rctx->dp_ctx) { + else if (!rctx->conn_ctx) { DEBUG(0, ("Data Provider is not yet available. Retrying.\n")); return EIO; } diff --git a/server/responder/common/responder_dp.c b/server/responder/common/responder_dp.c index bfc533b9..9083a173 100644 --- a/server/responder/common/responder_dp.c +++ b/server/responder/common/responder_dp.c @@ -25,7 +25,6 @@ static void sss_dp_conn_reconnect(struct sss_dp_pvt_ctx *pvt) struct resp_ctx *rctx; struct tevent_timer *te; struct timeval tv; - struct sbus_method_ctx *sm_ctx; char *sbus_address; time_t now; int ret; @@ -50,16 +49,21 @@ static void sss_dp_conn_reconnect(struct sss_dp_pvt_ctx *pvt) return; } - ret = dp_init_sbus_methods(rctx, pvt->methods, &sm_ctx); + ret = dp_init_sbus_methods(rctx, pvt->methods, &rctx->sm_ctx); if (ret != EOK) { DEBUG(0, ("Could not initialize SBUS methods.\n")); return; } - ret = sbus_client_init(rctx, rctx->ev, - sbus_address, sm_ctx, - pvt, sss_dp_conn_destructor, - &rctx->dp_ctx); + /* FIXME: remove this */ + if (talloc_reference(rctx, rctx->sm_ctx) == NULL) { + DEBUG(0, ("Failed to take memory reference\n")); + return; + } + + ret = sbus_client_init(rctx, rctx->ev, rctx->sm_ctx, + sbus_address, &rctx->conn_ctx, + sss_dp_conn_destructor, pvt); if (ret != EOK) { DEBUG(4, ("Failed to reconnect [%d(%s)]!\n", ret, strerror(ret))); @@ -239,12 +243,12 @@ int nss_dp_send_acct_req(struct resp_ctx *rctx, TALLOC_CTX *memctx, * in some pathological cases it may happen that nss starts up before * dp connection code is actually able to establish a connection. */ - if (!rctx->dp_ctx) { + if (!rctx->conn_ctx) { DEBUG(1, ("The Data Provider connection is not available yet!" " This maybe a bug, it shouldn't happen!\n")); return EIO; } - conn = sbus_get_connection(rctx->dp_ctx->scon_ctx); + conn = sbus_get_connection(rctx->conn_ctx); /* create the message */ msg = dbus_message_new_method_call(NULL, |