summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--src/providers/ipa/ipa_subdomains.c8
-rw-r--r--src/providers/ldap/ldap_common.c15
-rw-r--r--src/providers/ldap/ldap_common.h17
-rw-r--r--src/providers/ldap/ldap_id_enum.c21
7 files changed, 52 insertions, 36 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;
diff --git a/src/providers/ipa/ipa_subdomains.c b/src/providers/ipa/ipa_subdomains.c
index d9c204451..88b6ba525 100644
--- a/src/providers/ipa/ipa_subdomains.c
+++ b/src/providers/ipa/ipa_subdomains.c
@@ -183,10 +183,12 @@ ipa_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;
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c
index f1a2ed97e..1eb848a9d 100644
--- a/src/providers/ldap/ldap_common.c
+++ b/src/providers/ldap/ldap_common.c
@@ -986,16 +986,18 @@ void sdap_mark_offline(struct sdap_id_ctx *ctx)
int ldap_id_setup_tasks(struct sdap_id_ctx *ctx)
{
- return sdap_id_setup_tasks(ctx, ctx->conn, ctx->opts->sdom,
+ return sdap_id_setup_tasks(ctx->be, ctx, ctx->opts->sdom,
ldap_enumeration_send,
- ldap_enumeration_recv);
+ ldap_enumeration_recv,
+ ctx);
}
-int sdap_id_setup_tasks(struct sdap_id_ctx *ctx,
- struct sdap_id_conn_ctx *conn,
+int sdap_id_setup_tasks(struct be_ctx *be_ctx,
+ struct sdap_id_ctx *ctx,
struct sdap_domain *sdom,
be_ptask_send_t send_fn,
- be_ptask_recv_t recv_fn)
+ be_ptask_recv_t recv_fn,
+ void *pvt)
{
int ret;
@@ -1003,7 +1005,8 @@ int sdap_id_setup_tasks(struct sdap_id_ctx *ctx,
if (sdom->dom->enumerate) {
DEBUG(SSSDBG_TRACE_FUNC, ("Setting up enumeration for %s\n",
sdom->dom->name));
- ret = ldap_setup_enumeration(ctx, conn, sdom, send_fn, recv_fn);
+ ret = ldap_setup_enumeration(be_ctx, ctx->opts, sdom,
+ send_fn, recv_fn, pvt);
} else {
/* the enumeration task, runs the cleanup process by itself,
* but if enumeration is not running we need to schedule it */
diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h
index b3bd950e1..889d5b118 100644
--- a/src/providers/ldap/ldap_common.h
+++ b/src/providers/ldap/ldap_common.h
@@ -95,11 +95,12 @@ void sdap_handle_account_info(struct be_req *breq, struct sdap_id_ctx *ctx,
/* Set up enumeration and/or cleanup */
int ldap_id_setup_tasks(struct sdap_id_ctx *ctx);
-int sdap_id_setup_tasks(struct sdap_id_ctx *ctx,
- struct sdap_id_conn_ctx *conn,
+int sdap_id_setup_tasks(struct be_ctx *be_ctx,
+ struct sdap_id_ctx *ctx,
struct sdap_domain *sdom,
be_ptask_send_t send_fn,
- be_ptask_recv_t recv_fn);
+ be_ptask_recv_t recv_fn,
+ void *pvt);
struct tevent_req *
sdap_handle_acct_req_send(TALLOC_CTX *mem_ctx,
@@ -177,16 +178,16 @@ int ldap_get_autofs_options(TALLOC_CTX *memctx,
* structure that contains the request data
*/
struct ldap_enum_ctx {
- struct sdap_id_ctx *ctx;
struct sdap_domain *sdom;
- struct sdap_id_conn_ctx *conn;
+ void *pvt;
};
-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);
struct tevent_req *
ldap_enumeration_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
diff --git a/src/providers/ldap/ldap_id_enum.c b/src/providers/ldap/ldap_id_enum.c
index 58ff459c0..368ad9328 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 */