|
|
2fc102 |
From f7a7a583c475eb22a6d762e74c67ffcfa7ba32d0 Mon Sep 17 00:00:00 2001
|
|
|
2fc102 |
From: Lukas Slebodnik <lslebodn@redhat.com>
|
|
|
2fc102 |
Date: Wed, 12 Feb 2014 14:33:49 +0100
|
|
|
2fc102 |
Subject: [PATCH 91/92] LDAP: Setup periodic task only once.
|
|
|
2fc102 |
|
|
|
2fc102 |
If id provider is {ipa, ad} periodic task will be stared in sssm_{ipa,ad}_init
|
|
|
2fc102 |
If you enable enumeration and use different providers for id and sudo(autofs)
|
|
|
2fc102 |
then another periodic task will be scheduled.
|
|
|
2fc102 |
This can cause weird behaviour (e.g. missing members of group)
|
|
|
2fc102 |
|
|
|
2fc102 |
Perodic tasks will be started only by id_provider.
|
|
|
2fc102 |
|
|
|
2fc102 |
Resolves:
|
|
|
2fc102 |
https://fedorahosted.org/sssd/ticket/2153
|
|
|
2fc102 |
|
|
|
2fc102 |
Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
|
|
|
2fc102 |
(cherry picked from commit 057cb583f02bf47678c393cb8f1f74861c2b960b)
|
|
|
2fc102 |
---
|
|
|
2fc102 |
src/providers/ldap/ldap_init.c | 54 ++++++++++++++++++++++++++++++++----------
|
|
|
2fc102 |
1 file changed, 41 insertions(+), 13 deletions(-)
|
|
|
2fc102 |
|
|
|
2fc102 |
diff --git a/src/providers/ldap/ldap_init.c b/src/providers/ldap/ldap_init.c
|
|
|
2fc102 |
index 15615b2891f2e3104c11e8610c081adcd1d1ee8e..cf4ab5598e2b6eb00c188edabb61e22605e7dc82 100644
|
|
|
2fc102 |
--- a/src/providers/ldap/ldap_init.c
|
|
|
2fc102 |
+++ b/src/providers/ldap/ldap_init.c
|
|
|
2fc102 |
@@ -84,9 +84,9 @@ errno_t check_order_list_for_duplicates(char **list,
|
|
|
2fc102 |
return EOK;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
-int sssm_ldap_id_init(struct be_ctx *bectx,
|
|
|
2fc102 |
- struct bet_ops **ops,
|
|
|
2fc102 |
- void **pvt_data)
|
|
|
2fc102 |
+static int ldap_id_init_internal(struct be_ctx *bectx,
|
|
|
2fc102 |
+ struct bet_ops **ops,
|
|
|
2fc102 |
+ void **pvt_data)
|
|
|
2fc102 |
{
|
|
|
2fc102 |
struct sdap_id_ctx *ctx = NULL;
|
|
|
2fc102 |
const char *urls;
|
|
|
2fc102 |
@@ -160,11 +160,6 @@ int sssm_ldap_id_init(struct be_ctx *bectx,
|
|
|
2fc102 |
ret = sdap_idmap_init(ctx, ctx, &ctx->opts->idmap_ctx);
|
|
|
2fc102 |
if (ret != EOK) goto done;
|
|
|
2fc102 |
|
|
|
2fc102 |
- ret = ldap_id_setup_tasks(ctx);
|
|
|
2fc102 |
- if (ret != EOK) {
|
|
|
2fc102 |
- goto done;
|
|
|
2fc102 |
- }
|
|
|
2fc102 |
-
|
|
|
2fc102 |
ret = sdap_setup_child();
|
|
|
2fc102 |
if (ret != EOK) {
|
|
|
2fc102 |
DEBUG(1, ("setup_child failed [%d][%s].\n",
|
|
|
2fc102 |
@@ -202,6 +197,39 @@ done:
|
|
|
2fc102 |
return ret;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
+int sssm_ldap_id_init(struct be_ctx *bectx,
|
|
|
2fc102 |
+ struct bet_ops **ops,
|
|
|
2fc102 |
+ void **pvt_data)
|
|
|
2fc102 |
+{
|
|
|
2fc102 |
+ int ret;
|
|
|
2fc102 |
+ struct sdap_id_ctx *ctx = NULL;
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ ret = ldap_id_init_internal(bectx, ops, (void **) &ctx;;
|
|
|
2fc102 |
+ if (ret != EOK) {
|
|
|
2fc102 |
+ DEBUG(SSSDBG_MINOR_FAILURE,
|
|
|
2fc102 |
+ ("ldap_id_init_internal failed [%d][%s].\n",
|
|
|
2fc102 |
+ ret, strerror(ret)));
|
|
|
2fc102 |
+ goto done;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ ret = ldap_id_setup_tasks(ctx);
|
|
|
2fc102 |
+ if (ret != EOK) {
|
|
|
2fc102 |
+ DEBUG(SSSDBG_MINOR_FAILURE,
|
|
|
2fc102 |
+ ("sdap_id_setup_tasks failed [%d][%s].\n",
|
|
|
2fc102 |
+ ret, strerror(ret)));
|
|
|
2fc102 |
+ goto done;
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+ *pvt_data = ctx;
|
|
|
2fc102 |
+ ret = EOK;
|
|
|
2fc102 |
+
|
|
|
2fc102 |
+done:
|
|
|
2fc102 |
+ if (ret != EOK) {
|
|
|
2fc102 |
+ talloc_free(ctx);
|
|
|
2fc102 |
+ }
|
|
|
2fc102 |
+ return ret;
|
|
|
2fc102 |
+}
|
|
|
2fc102 |
+
|
|
|
2fc102 |
int sssm_ldap_auth_init(struct be_ctx *bectx,
|
|
|
2fc102 |
struct bet_ops **ops,
|
|
|
2fc102 |
void **pvt_data)
|
|
|
2fc102 |
@@ -211,7 +239,7 @@ int sssm_ldap_auth_init(struct be_ctx *bectx,
|
|
|
2fc102 |
struct sdap_auth_ctx *ctx;
|
|
|
2fc102 |
int ret;
|
|
|
2fc102 |
|
|
|
2fc102 |
- ret = sssm_ldap_id_init(bectx, ops, &data);
|
|
|
2fc102 |
+ ret = ldap_id_init_internal(bectx, ops, &data);
|
|
|
2fc102 |
if (ret == EOK) {
|
|
|
2fc102 |
id_ctx = talloc_get_type(data, struct sdap_id_ctx);
|
|
|
2fc102 |
|
|
|
2fc102 |
@@ -302,9 +330,9 @@ int sssm_ldap_access_init(struct be_ctx *bectx,
|
|
|
2fc102 |
goto done;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
- ret = sssm_ldap_id_init(bectx, ops, (void **)&access_ctx->id_ctx);
|
|
|
2fc102 |
+ ret = ldap_id_init_internal(bectx, ops, (void **)&access_ctx->id_ctx);
|
|
|
2fc102 |
if (ret != EOK) {
|
|
|
2fc102 |
- DEBUG(1, ("sssm_ldap_id_init failed.\n"));
|
|
|
2fc102 |
+ DEBUG(SSSDBG_CRIT_FAILURE, ("ldap_id_init_internal failed.\n"));
|
|
|
2fc102 |
goto done;
|
|
|
2fc102 |
}
|
|
|
2fc102 |
|
|
|
2fc102 |
@@ -417,7 +445,7 @@ int sssm_ldap_sudo_init(struct be_ctx *be_ctx,
|
|
|
2fc102 |
void *data;
|
|
|
2fc102 |
int ret;
|
|
|
2fc102 |
|
|
|
2fc102 |
- ret = sssm_ldap_id_init(be_ctx, ops, &data);
|
|
|
2fc102 |
+ ret = ldap_id_init_internal(be_ctx, ops, &data);
|
|
|
2fc102 |
if (ret != EOK) {
|
|
|
2fc102 |
DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot init LDAP ID provider [%d]: %s\n",
|
|
|
2fc102 |
ret, strerror(ret)));
|
|
|
2fc102 |
@@ -447,7 +475,7 @@ int sssm_ldap_autofs_init(struct be_ctx *be_ctx,
|
|
|
2fc102 |
void *data;
|
|
|
2fc102 |
int ret;
|
|
|
2fc102 |
|
|
|
2fc102 |
- ret = sssm_ldap_id_init(be_ctx, ops, &data);
|
|
|
2fc102 |
+ ret = ldap_id_init_internal(be_ctx, ops, &data);
|
|
|
2fc102 |
if (ret != EOK) {
|
|
|
2fc102 |
DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot init LDAP ID provider [%d]: %s\n",
|
|
|
2fc102 |
ret, strerror(ret)));
|
|
|
2fc102 |
--
|
|
|
2fc102 |
1.8.5.3
|
|
|
2fc102 |
|