diff options
author | Jan Zeleny <jzeleny@redhat.com> | 2011-10-12 09:27:56 -0400 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-11-23 14:19:53 -0500 |
commit | 46d41cf95d520a1aab48dad2d577c885e69ef9f8 (patch) | |
tree | f31c9f58d674707e7d00d32b32aaf0e3f060a654 | |
parent | 544de543ee88961272e9b9c5baa2c0d296162965 (diff) | |
download | sssd-46d41cf95d520a1aab48dad2d577c885e69ef9f8.tar.gz sssd-46d41cf95d520a1aab48dad2d577c885e69ef9f8.tar.bz2 sssd-46d41cf95d520a1aab48dad2d577c885e69ef9f8.zip |
New IPA ID context
-rw-r--r-- | src/providers/ipa/ipa_common.h | 7 | ||||
-rw-r--r-- | src/providers/ipa/ipa_dyndns.c | 18 | ||||
-rw-r--r-- | src/providers/ipa/ipa_init.c | 34 |
3 files changed, 37 insertions, 22 deletions
diff --git a/src/providers/ipa/ipa_common.h b/src/providers/ipa/ipa_common.h index 5b959c8c..6c33e870 100644 --- a/src/providers/ipa/ipa_common.h +++ b/src/providers/ipa/ipa_common.h @@ -84,6 +84,11 @@ struct ipa_auth_ctx { struct dp_option *ipa_options; }; +struct ipa_id_ctx { + struct sdap_id_ctx *sdap_id_ctx; + struct ipa_options *ipa_options; +}; + struct ipa_options { struct dp_option *basic; @@ -92,7 +97,7 @@ struct ipa_options { /* id provider */ struct sdap_options *id; - struct sdap_id_ctx *id_ctx; + struct ipa_id_ctx *id_ctx; struct resolv_ctx *resolv; /* auth and chpass provider */ diff --git a/src/providers/ipa/ipa_dyndns.c b/src/providers/ipa/ipa_dyndns.c index 946fa390..e579e1d9 100644 --- a/src/providers/ipa/ipa_dyndns.c +++ b/src/providers/ipa/ipa_dyndns.c @@ -263,7 +263,7 @@ ipa_dyndns_update_send(struct ipa_options *ctx) else { /* Detect DYNDNS interface from LDAP connection */ - state->sdap_op = sdap_id_op_create(state, state->ipa_ctx->id_ctx->conn_cache); + state->sdap_op = sdap_id_op_create(state, state->ipa_ctx->id_ctx->sdap_id_ctx->conn_cache); if (!state->sdap_op) { DEBUG(1, ("sdap_id_op_create failed\n")); ret = ENOMEM; @@ -430,11 +430,11 @@ static int ipa_dyndns_gss_tsig_update_step(struct tevent_req *req) static errno_t ipa_dyndns_gss_tsig_update_setup_check(struct ipa_dyndns_ctx *state) { + struct sdap_id_ctx *id_ctx = state->ipa_ctx->id_ctx->sdap_id_ctx; errno_t ret; if (dp_opt_get_string(state->ipa_ctx->basic, IPA_DYNDNS_IFACE)) { - ret = resolv_get_family_order(state->ipa_ctx->id_ctx->be->cdb, - state->ipa_ctx->id_ctx->be->conf_path, + ret = resolv_get_family_order(id_ctx->be->cdb, id_ctx->be->conf_path, &state->family_order); if (ret != EOK) { return ret; @@ -573,6 +573,7 @@ ipa_dyndns_update_get_addrs_send(TALLOC_CTX *mem_ctx, errno_t ret; struct tevent_req *req; struct ipa_dyndns_update_get_addrs_state *state; + struct sdap_id_ctx *id_ctx = ctx->ipa_ctx->id_ctx->sdap_id_ctx; req = tevent_req_create(mem_ctx, &state, struct ipa_dyndns_update_get_addrs_state); @@ -598,7 +599,7 @@ ipa_dyndns_update_get_addrs_send(TALLOC_CTX *mem_ctx, immediate: if (ret != EOK) { tevent_req_error(req, ret); - tevent_req_post(req, ctx->ipa_ctx->id_ctx->be->ev); + tevent_req_post(req, id_ctx->be->ev); } return req; } @@ -609,9 +610,10 @@ ipa_dyndns_update_get_addrs_step(struct tevent_req *req) struct tevent_req *subreq; struct ipa_dyndns_update_get_addrs_state *state = tevent_req_data(req, struct ipa_dyndns_update_get_addrs_state); + struct ipa_id_ctx *ipa_id_ctx = state->dctx->ipa_ctx->id_ctx; subreq = resolv_gethostbyname_send(state, - state->dctx->ipa_ctx->id_ctx->be->ev, + ipa_id_ctx->sdap_id_ctx->be->ev, state->dctx->ipa_ctx->resolv, state->dctx->hostname, state->family_order, @@ -995,7 +997,7 @@ fork_nsupdate_send(struct ipa_nsupdate_ctx *ctx) /* Write the update message to the nsupdate child */ subreq = write_pipe_send(req, - ctx->dyndns_ctx->ipa_ctx->id_ctx->be->ev, + ctx->dyndns_ctx->ipa_ctx->id_ctx->sdap_id_ctx->be->ev, (uint8_t *)ctx->update_msg, strlen(ctx->update_msg)+1, ctx->pipefd_to_child); @@ -1005,7 +1007,7 @@ fork_nsupdate_send(struct ipa_nsupdate_ctx *ctx) tevent_req_set_callback(subreq, ipa_dyndns_stdin_done, req); /* Set up SIGCHLD handler */ - ret = child_handler_setup(ctx->dyndns_ctx->ipa_ctx->id_ctx->be->ev, + ret = child_handler_setup(ctx->dyndns_ctx->ipa_ctx->id_ctx->sdap_id_ctx->be->ev, pid, ipa_dyndns_child_handler, req); if (ret != EOK) { return NULL; @@ -1014,7 +1016,7 @@ fork_nsupdate_send(struct ipa_nsupdate_ctx *ctx) /* Set up timeout handler */ tv = tevent_timeval_current_ofs(IPA_DYNDNS_TIMEOUT, 0); ctx->timeout_handler = tevent_add_timer( - ctx->dyndns_ctx->ipa_ctx->id_ctx->be->ev, + ctx->dyndns_ctx->ipa_ctx->id_ctx->sdap_id_ctx->be->ev, req, tv, ipa_dyndns_timeout, req); if(ctx->timeout_handler == NULL) { return NULL; diff --git a/src/providers/ipa/ipa_init.c b/src/providers/ipa/ipa_init.c index df22535d..eaf2115a 100644 --- a/src/providers/ipa/ipa_init.c +++ b/src/providers/ipa/ipa_init.c @@ -89,7 +89,8 @@ int sssm_ipa_id_init(struct be_ctx *bectx, struct bet_ops **ops, void **pvt_data) { - struct sdap_id_ctx *ctx; + struct ipa_id_ctx *ipa_ctx; + struct sdap_id_ctx *sdap_ctx; struct stat stat_buf; errno_t err; int ret; @@ -108,17 +109,24 @@ int sssm_ipa_id_init(struct be_ctx *bectx, return EOK; } - ctx = talloc_zero(ipa_options, struct sdap_id_ctx); - if (!ctx) { + ipa_ctx = talloc_zero(ipa_options, struct ipa_id_ctx); + if (!ipa_ctx) { return ENOMEM; } - ctx->be = bectx; - ctx->service = ipa_options->service->sdap; - ipa_options->id_ctx = ctx; + ipa_options->id_ctx = ipa_ctx; + ipa_ctx->ipa_options = ipa_options; + + sdap_ctx = talloc_zero(ipa_options, struct sdap_id_ctx); + if (!sdap_ctx) { + return ENOMEM; + } + sdap_ctx->be = bectx; + sdap_ctx->service = ipa_options->service->sdap; + ipa_ctx->sdap_id_ctx = sdap_ctx; ret = ipa_get_id_options(ipa_options, bectx->cdb, bectx->conf_path, - &ctx->opts); + &sdap_ctx->opts); if (ret != EOK) { goto done; } @@ -149,7 +157,7 @@ int sssm_ipa_id_init(struct be_ctx *bectx, /* nsupdate is available. Dynamic updates * are supported */ - ret = ipa_dyndns_init(ctx->be, ipa_options); + ret = ipa_dyndns_init(sdap_ctx->be, ipa_options); if (ret != EOK) { DEBUG(1, ("Failure setting up automatic DNS update\n")); /* We will continue without DNS updating */ @@ -159,24 +167,24 @@ int sssm_ipa_id_init(struct be_ctx *bectx, - ret = setup_tls_config(ctx->opts->basic); + ret = setup_tls_config(sdap_ctx->opts->basic); if (ret != EOK) { DEBUG(1, ("setup_tls_config failed [%d][%s].\n", ret, strerror(ret))); goto done; } - ret = sdap_id_conn_cache_create(ctx, ctx, &ctx->conn_cache); + ret = sdap_id_conn_cache_create(sdap_ctx, sdap_ctx, &sdap_ctx->conn_cache); if (ret != EOK) { goto done; } - ret = sdap_id_setup_tasks(ctx); + ret = sdap_id_setup_tasks(sdap_ctx); if (ret != EOK) { goto done; } - ret = setup_child(ctx); + ret = setup_child(sdap_ctx); if (ret != EOK) { DEBUG(1, ("setup_child failed [%d][%s].\n", ret, strerror(ret))); @@ -184,7 +192,7 @@ int sssm_ipa_id_init(struct be_ctx *bectx, } *ops = &ipa_id_ops; - *pvt_data = ctx; + *pvt_data = ipa_ctx; ret = EOK; done: |