summaryrefslogtreecommitdiff
path: root/src/providers/ldap
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-08-24 14:43:57 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-09-18 19:06:35 +0200
commit21f749c9300a1a51f3eb83d7f1483ec2fe15b3cc (patch)
treea32d18426c74257badefa0bb62ff4bc2983d0806 /src/providers/ldap
parent31ad608192c24eb56cf7a8294f6bfc080893193c (diff)
downloadsssd-21f749c9300a1a51f3eb83d7f1483ec2fe15b3cc.tar.gz
sssd-21f749c9300a1a51f3eb83d7f1483ec2fe15b3cc.tar.bz2
sssd-21f749c9300a1a51f3eb83d7f1483ec2fe15b3cc.zip
LDAP: sdap_id_setup_tasks accepts a custom enum request
AD provider will override the default with its own.
Diffstat (limited to 'src/providers/ldap')
-rw-r--r--src/providers/ldap/ldap_common.c10
-rw-r--r--src/providers/ldap/ldap_common.h16
-rw-r--r--src/providers/ldap/ldap_id_enum.c17
3 files changed, 26 insertions, 17 deletions
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c
index 0df5afe8..b668a48e 100644
--- a/src/providers/ldap/ldap_common.c
+++ b/src/providers/ldap/ldap_common.c
@@ -938,12 +938,16 @@ 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, ctx->conn, ctx->opts->sdom,
+ ldap_enumeration_send,
+ ldap_enumeration_recv);
}
int sdap_id_setup_tasks(struct sdap_id_ctx *ctx,
struct sdap_id_conn_ctx *conn,
- struct sdap_domain *sdom)
+ struct sdap_domain *sdom,
+ be_ptask_send_t send_fn,
+ be_ptask_recv_t recv_fn)
{
struct timeval tv;
int ret = EOK;
@@ -952,7 +956,7 @@ int sdap_id_setup_tasks(struct sdap_id_ctx *ctx,
/* set up enumeration task */
if (sdom->dom->enumerate) {
DEBUG(SSSDBG_TRACE_FUNC, ("Setting up enumeration for %s\n", sdom->dom->name));
- ret = ldap_setup_enumeration(ctx, conn, sdom);
+ ret = ldap_setup_enumeration(ctx, conn, sdom, send_fn, recv_fn);
} 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 a5f3dee9..b21de002 100644
--- a/src/providers/ldap/ldap_common.h
+++ b/src/providers/ldap/ldap_common.h
@@ -95,7 +95,9 @@ void sdap_handle_account_info(struct be_req *breq, struct sdap_id_ctx *ctx,
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,
- struct sdap_domain *sdom);
+ struct sdap_domain *sdom,
+ be_ptask_send_t send_fn,
+ be_ptask_recv_t recv_fn);
struct tevent_req *
sdap_handle_acct_req_send(TALLOC_CTX *mem_ctx,
@@ -169,7 +171,17 @@ int ldap_get_autofs_options(TALLOC_CTX *memctx,
errno_t ldap_setup_enumeration(struct sdap_id_ctx *ctx,
struct sdap_id_conn_ctx *conn,
- struct sdap_domain *sdom);
+ struct sdap_domain *sdom,
+ be_ptask_send_t send_fn,
+ be_ptask_recv_t recv_fn);
+struct tevent_req *
+ldap_enumeration_send(TALLOC_CTX *mem_ctx,
+ struct tevent_context *ev,
+ struct be_ctx *be_ctx,
+ struct be_ptask *be_ptask,
+ void *pvt);
+errno_t ldap_enumeration_recv(struct tevent_req *req);
+
errno_t ldap_id_cleanup(struct sdap_options *opts,
struct sdap_domain *sdom);
int ldap_id_cleanup_create_timer(struct sdap_id_ctx *ctx,
diff --git a/src/providers/ldap/ldap_id_enum.c b/src/providers/ldap/ldap_id_enum.c
index 961c72f3..2a42fdaf 100644
--- a/src/providers/ldap/ldap_id_enum.c
+++ b/src/providers/ldap/ldap_id_enum.c
@@ -27,14 +27,6 @@
#include "providers/ldap/ldap_common.h"
#include "providers/ldap/sdap_async_enum.h"
-static struct tevent_req *
-ldap_enumeration_send(TALLOC_CTX *mem_ctx,
- struct tevent_context *ev,
- struct be_ctx *be_ctx,
- struct be_ptask *be_ptask,
- void *pvt);
-errno_t ldap_enumeration_recv(struct tevent_req *req);
-
struct ldap_enum_ctx {
struct sdap_id_ctx *ctx;
struct sdap_domain *sdom;
@@ -43,7 +35,9 @@ struct ldap_enum_ctx {
errno_t ldap_setup_enumeration(struct sdap_id_ctx *ctx,
struct sdap_id_conn_ctx *conn,
- struct sdap_domain *sdom)
+ struct sdap_domain *sdom,
+ be_ptask_send_t send_fn,
+ be_ptask_recv_t recv_fn)
{
errno_t ret;
time_t first_delay;
@@ -88,7 +82,7 @@ errno_t ldap_setup_enumeration(struct sdap_id_ctx *ctx,
5, /* enabled delay */
period, /* timeout */
BE_PTASK_OFFLINE_SKIP,
- ldap_enumeration_send, ldap_enumeration_recv,
+ send_fn, recv_fn,
ectx, "enumeration", &sdom->enum_task);
if (ret != EOK) {
DEBUG(SSSDBG_FATAL_FAILURE,
@@ -101,7 +95,6 @@ errno_t ldap_setup_enumeration(struct sdap_id_ctx *ctx,
return EOK;
}
-
struct ldap_enumeration_state {
struct ldap_enum_ctx *ectx;
struct sss_domain_info *dom;
@@ -109,7 +102,7 @@ struct ldap_enumeration_state {
static void ldap_enumeration_done(struct tevent_req *subreq);
-static struct tevent_req *
+struct tevent_req *
ldap_enumeration_send(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct be_ctx *be_ctx,