summaryrefslogtreecommitdiffstats
path: root/src/providers/ldap/ldap_id_enum.c
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 17:27:55 +0100
commite0502a6c5bc30415c372e9e6e835b94b04d5195a (patch)
tree25dd92863492fe6f5e6924daf643cfd2ec63ccf6 /src/providers/ldap/ldap_id_enum.c
parent02abb93af0c81da869766c8302aecf3d08aa47e0 (diff)
downloadsssd-e0502a6c5bc30415c372e9e6e835b94b04d5195a.tar.gz
sssd-e0502a6c5bc30415c372e9e6e835b94b04d5195a.tar.xz
sssd-e0502a6c5bc30415c372e9e6e835b94b04d5195a.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/ldap/ldap_id_enum.c')
-rw-r--r--src/providers/ldap/ldap_id_enum.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/providers/ldap/ldap_id_enum.c b/src/providers/ldap/ldap_id_enum.c
index 8cccaa916..c791496a6 100644
--- a/src/providers/ldap/ldap_id_enum.c
+++ b/src/providers/ldap/ldap_id_enum.c
@@ -27,11 +27,12 @@
#include "providers/ldap/ldap_common.h"
#include "providers/ldap/sdap_async_enum.h"
-errno_t ldap_setup_enumeration(struct sdap_id_ctx *ctx,
- struct sdap_id_conn_ctx *conn,
+errno_t ldap_setup_enumeration(struct be_ctx *be_ctx,
+ struct sdap_options *opts,
struct sdap_domain *sdom,
be_ptask_send_t send_fn,
- be_ptask_recv_t recv_fn)
+ be_ptask_recv_t recv_fn,
+ void *pvt)
{
errno_t ret;
time_t first_delay;
@@ -60,17 +61,16 @@ errno_t ldap_setup_enumeration(struct sdap_id_ctx *ctx,
first_delay = 0;
}
- period = dp_opt_get_int(ctx->opts->basic, SDAP_ENUM_REFRESH_TIMEOUT);
+ period = dp_opt_get_int(opts->basic, SDAP_ENUM_REFRESH_TIMEOUT);
ectx = talloc(sdom, struct ldap_enum_ctx);
if (ectx == NULL) {
return ENOMEM;
}
- ectx->ctx = ctx;
ectx->sdom = sdom;
- ectx->conn = conn;
+ ectx->pvt = pvt;
- ret = be_ptask_create(sdom, ctx->be,
+ ret = be_ptask_create(sdom, be_ctx,
period, /* period */
first_delay, /* first_delay */
5, /* enabled delay */
@@ -91,6 +91,7 @@ errno_t ldap_setup_enumeration(struct sdap_id_ctx *ctx,
struct ldap_enumeration_state {
struct ldap_enum_ctx *ectx;
+ struct sdap_id_ctx *id_ctx;
struct sss_domain_info *dom;
};
@@ -118,14 +119,16 @@ ldap_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;
}
state->ectx = ectx;
state->dom = ectx->sdom->dom;
+ state->id_ctx = talloc_get_type_abort(ectx->pvt, struct sdap_id_ctx);
- subreq = sdap_dom_enum_send(ectx, ev, ectx->ctx, ectx->sdom,
- ectx->conn);
+ subreq = sdap_dom_enum_send(ectx, ev, state->id_ctx, ectx->sdom,
+ state->id_ctx->conn);
if (subreq == NULL) {
/* The ptask API will reschedule the enumeration on its own on
* failure */