summaryrefslogtreecommitdiffstats
path: root/src/providers/ad
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-12-10 21:49:45 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-01-29 14:59:02 +0100
commit1a5d7f670d94cb5c2b4a727e1e4cb3f1debadaa7 (patch)
treedd513dac6939213bd86e64cd4d438cec96487e3f /src/providers/ad
parentc6808be838567870a251d79baad1080910f6ec4c (diff)
downloadsssd-1a5d7f670d94cb5c2b4a727e1e4cb3f1debadaa7.tar.gz
sssd-1a5d7f670d94cb5c2b4a727e1e4cb3f1debadaa7.tar.xz
sssd-1a5d7f670d94cb5c2b4a727e1e4cb3f1debadaa7.zip
LDAP: Pass a private context to enumeration ptask instead of hardcoded connection
Previously, the sdap-domain enumeration request used a single connection context to download all the data. Now we'd like to use different connections to download different objects, so the ID context is passed in and the request itself decides which connection to use for the sdap-domain enumeration.
Diffstat (limited to 'src/providers/ad')
-rw-r--r--src/providers/ad/ad_id.c12
-rw-r--r--src/providers/ad/ad_init.c7
-rw-r--r--src/providers/ad/ad_subdomains.c8
3 files changed, 17 insertions, 10 deletions
diff --git a/src/providers/ad/ad_id.c b/src/providers/ad/ad_id.c
index 85edcf6d6..99383c13b 100644
--- a/src/providers/ad/ad_id.c
+++ b/src/providers/ad/ad_id.c
@@ -414,6 +414,7 @@ ad_check_online(struct be_req *be_req)
}
struct ad_enumeration_state {
+ struct ad_id_ctx *id_ctx;
struct ldap_enum_ctx *ectx;
struct sdap_id_op *sdap_op;
struct tevent_context *ev;
@@ -443,6 +444,7 @@ ad_enumeration_send(TALLOC_CTX *mem_ctx,
ectx = talloc_get_type(pvt, struct ldap_enum_ctx);
if (ectx == NULL) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot retrieve ldap_enum_ctx!\n"));
ret = EFAULT;
goto fail;
}
@@ -450,8 +452,10 @@ ad_enumeration_send(TALLOC_CTX *mem_ctx,
state->ectx = ectx;
state->ev = ev;
state->sdom = ectx->sdom;
+ state->id_ctx = talloc_get_type(ectx->pvt, struct ad_id_ctx);
- state->sdap_op = sdap_id_op_create(state, ectx->conn->conn_cache);
+ state->sdap_op = sdap_id_op_create(state,
+ state->id_ctx->ldap_ctx->conn_cache);
if (state->sdap_op == NULL) {
DEBUG(SSSDBG_OP_FAILURE, ("sdap_id_op_create failed.\n"));
ret = ENOMEM;
@@ -500,7 +504,7 @@ ad_enumeration_conn_done(struct tevent_req *subreq)
}
subreq = ad_master_domain_send(state, state->ev,
- state->ectx->conn,
+ state->id_ctx->ldap_ctx,
state->sdap_op,
state->sdom->dom->name);
if (subreq == NULL) {
@@ -540,8 +544,8 @@ ad_enumeration_master_done(struct tevent_req *subreq)
return;
}
- subreq = sdap_dom_enum_send(state, state->ev, state->ectx->ctx,
- state->sdom, state->ectx->conn);
+ subreq = sdap_dom_enum_send(state, state->ev, state->id_ctx->sdap_id_ctx,
+ state->sdom, state->id_ctx->ldap_ctx);
if (subreq == NULL) {
/* The ptask API will reschedule the enumeration on its own on
* failure */
diff --git a/src/providers/ad/ad_init.c b/src/providers/ad/ad_init.c
index ed69a7d98..eff6d990d 100644
--- a/src/providers/ad/ad_init.c
+++ b/src/providers/ad/ad_init.c
@@ -205,11 +205,12 @@ sssm_ad_id_init(struct be_ctx *bectx,
goto done;
}
- ret = sdap_id_setup_tasks(ad_ctx->sdap_id_ctx,
- ad_ctx->sdap_id_ctx->conn,
+ ret = sdap_id_setup_tasks(bectx,
+ ad_ctx->sdap_id_ctx,
ad_ctx->sdap_id_ctx->opts->sdom,
ad_enumeration_send,
- ad_enumeration_recv);
+ ad_enumeration_recv,
+ ad_ctx);
if (ret != EOK) {
goto done;
}
diff --git a/src/providers/ad/ad_subdomains.c b/src/providers/ad/ad_subdomains.c
index 348561a85..e7871cc32 100644
--- a/src/providers/ad/ad_subdomains.c
+++ b/src/providers/ad/ad_subdomains.c
@@ -177,10 +177,12 @@ ad_subdom_ad_ctx_new(struct be_ctx *be_ctx,
return EFAULT;
}
- ret = sdap_id_setup_tasks(ad_id_ctx->sdap_id_ctx,
- ad_id_ctx->ldap_ctx, sdom,
+ ret = sdap_id_setup_tasks(be_ctx,
+ ad_id_ctx->sdap_id_ctx,
+ sdom,
ldap_enumeration_send,
- ldap_enumeration_recv);
+ ldap_enumeration_recv,
+ ad_id_ctx->sdap_id_ctx);
if (ret != EOK) {
talloc_free(ad_options);
return ret;