summaryrefslogtreecommitdiff
path: root/src/providers
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2013-08-22 11:03:01 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-08-28 18:06:57 +0200
commit1c4144a6ce68dbd54c7c08a517d1f982ea57f19a (patch)
treec81298a84cd4160834999821a179faf666fd4cc9 /src/providers
parent66edf42c51f8591c93204b6490c103fa51346f47 (diff)
downloadsssd-1c4144a6ce68dbd54c7c08a517d1f982ea57f19a.tar.gz
sssd-1c4144a6ce68dbd54c7c08a517d1f982ea57f19a.tar.bz2
sssd-1c4144a6ce68dbd54c7c08a517d1f982ea57f19a.zip
LDAP: Make sdap_id_setup_tasks reusable for subdomains
Instead of always performing the setup for the main domain, the setup can now be performed for subdomains as well.
Diffstat (limited to 'src/providers')
-rw-r--r--src/providers/ad/ad_init.c2
-rw-r--r--src/providers/ipa/ipa_init.c2
-rw-r--r--src/providers/ldap/ldap_common.c17
-rw-r--r--src/providers/ldap/ldap_common.h7
-rw-r--r--src/providers/ldap/ldap_init.c2
5 files changed, 21 insertions, 9 deletions
diff --git a/src/providers/ad/ad_init.c b/src/providers/ad/ad_init.c
index 816d12f0..f181afe6 100644
--- a/src/providers/ad/ad_init.c
+++ b/src/providers/ad/ad_init.c
@@ -204,7 +204,7 @@ sssm_ad_id_init(struct be_ctx *bectx,
goto done;
}
- ret = sdap_id_setup_tasks(ad_ctx->sdap_id_ctx);
+ ret = ldap_id_setup_tasks(ad_ctx->sdap_id_ctx);
if (ret != EOK) {
goto done;
}
diff --git a/src/providers/ipa/ipa_init.c b/src/providers/ipa/ipa_init.c
index cdcae5e6..a5ab8818 100644
--- a/src/providers/ipa/ipa_init.c
+++ b/src/providers/ipa/ipa_init.c
@@ -226,7 +226,7 @@ int sssm_ipa_id_init(struct be_ctx *bectx,
ret = ipa_idmap_init(sdap_ctx, sdap_ctx, &sdap_ctx->opts->idmap_ctx);
if (ret != EOK) goto done;
- ret = sdap_id_setup_tasks(sdap_ctx);
+ ret = ldap_id_setup_tasks(sdap_ctx);
if (ret != EOK) {
goto done;
}
diff --git a/src/providers/ldap/ldap_common.c b/src/providers/ldap/ldap_common.c
index ffa8aae5..f7ad7118 100644
--- a/src/providers/ldap/ldap_common.c
+++ b/src/providers/ldap/ldap_common.c
@@ -936,16 +936,23 @@ void sdap_mark_offline(struct sdap_id_ctx *ctx)
be_mark_offline(ctx->be);
}
-int sdap_id_setup_tasks(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);
+}
+
+int sdap_id_setup_tasks(struct sdap_id_ctx *ctx,
+ struct sdap_id_conn_ctx *conn,
+ struct sdap_domain *sdom)
{
struct timeval tv;
int ret = EOK;
int delay;
/* set up enumeration task */
- if (ctx->be->domain->enumerate) {
- DEBUG(SSSDBG_TRACE_FUNC, ("Setting up enumeration for %s\n", ctx->be->domain->name));
- ret = ldap_setup_enumeration(ctx, ctx->conn, ctx->opts->sdom);
+ if (sdom->dom->enumerate) {
+ DEBUG(SSSDBG_TRACE_FUNC, ("Setting up enumeration for %s\n", sdom->dom->name));
+ ret = ldap_setup_enumeration(ctx, conn, sdom);
} else {
/* the enumeration task, runs the cleanup process by itself,
* but if enumeration is not running we need to schedule it */
@@ -960,7 +967,7 @@ int sdap_id_setup_tasks(struct sdap_id_ctx *ctx)
/* run the first one in a couple of seconds so that we have time to
* finish initializations first*/
tv = tevent_timeval_current_ofs(10, 0);
- ret = ldap_id_cleanup_create_timer(ctx, ctx->opts->sdom, tv);
+ ret = ldap_id_cleanup_create_timer(ctx, sdom, tv);
}
return ret;
diff --git a/src/providers/ldap/ldap_common.h b/src/providers/ldap/ldap_common.h
index fb45845e..e5b7f115 100644
--- a/src/providers/ldap/ldap_common.h
+++ b/src/providers/ldap/ldap_common.h
@@ -90,7 +90,12 @@ errno_t sdap_reinit_cleanup_recv(struct tevent_req *req);
void sdap_account_info_handler(struct be_req *breq);
void sdap_handle_account_info(struct be_req *breq, struct sdap_id_ctx *ctx,
struct sdap_id_conn_ctx *conn);
-int sdap_id_setup_tasks(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,
+ struct sdap_domain *sdom);
struct tevent_req *
sdap_handle_acct_req_send(TALLOC_CTX *mem_ctx,
diff --git a/src/providers/ldap/ldap_init.c b/src/providers/ldap/ldap_init.c
index 38d4fa71..341338ca 100644
--- a/src/providers/ldap/ldap_init.c
+++ b/src/providers/ldap/ldap_init.c
@@ -160,7 +160,7 @@ int sssm_ldap_id_init(struct be_ctx *bectx,
ret = sdap_idmap_init(ctx, ctx, &ctx->opts->idmap_ctx);
if (ret != EOK) goto done;
- ret = sdap_id_setup_tasks(ctx);
+ ret = ldap_id_setup_tasks(ctx);
if (ret != EOK) {
goto done;
}