summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2014-02-12 14:33:49 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-03-31 17:18:26 +0200
commit0903af5c1f14c850d6fe4013d6f5f56f3f195c0a (patch)
tree056159cdbe14749692f5f3d041a6fd364e51b862
parent7885e87ae46bf1bba0882d42335587df576272cf (diff)
downloadsssd-0903af5c1f14c850d6fe4013d6f5f56f3f195c0a.tar.gz
sssd-0903af5c1f14c850d6fe4013d6f5f56f3f195c0a.tar.xz
sssd-0903af5c1f14c850d6fe4013d6f5f56f3f195c0a.zip
LDAP: Setup periodic task only once.
If id provider is {ipa, ad} periodic task will be stared in sssm_{ipa,ad}_init If you enable enumeration and use different providers for id and sudo(autofs) then another periodic task will be scheduled. This can cause weird behaviour (e.g. missing members of group) Perodic tasks will be started only by id_provider. Resolves: https://fedorahosted.org/sssd/ticket/2153 Reviewed-by: Jakub Hrozek <jhrozek@redhat.com>
-rw-r--r--src/providers/ldap/ldap_init.c54
1 files changed, 41 insertions, 13 deletions
diff --git a/src/providers/ldap/ldap_init.c b/src/providers/ldap/ldap_init.c
index 976448194..fdf511002 100644
--- a/src/providers/ldap/ldap_init.c
+++ b/src/providers/ldap/ldap_init.c
@@ -83,9 +83,9 @@ errno_t check_order_list_for_duplicates(char **list,
return EOK;
}
-int sssm_ldap_id_init(struct be_ctx *bectx,
- struct bet_ops **ops,
- void **pvt_data)
+static int ldap_id_init_internal(struct be_ctx *bectx,
+ struct bet_ops **ops,
+ void **pvt_data)
{
struct sdap_id_ctx *ctx;
const char *urls;
@@ -161,11 +161,6 @@ int sssm_ldap_id_init(struct be_ctx *bectx,
if (ret != EOK) goto done;
}
- ret = sdap_id_setup_tasks(ctx);
- if (ret != EOK) {
- goto done;
- }
-
ret = setup_child(ctx);
if (ret != EOK) {
DEBUG(1, ("setup_child failed [%d][%s].\n",
@@ -194,6 +189,39 @@ done:
return ret;
}
+int sssm_ldap_id_init(struct be_ctx *bectx,
+ struct bet_ops **ops,
+ void **pvt_data)
+{
+ int ret;
+ struct sdap_id_ctx *ctx = NULL;
+
+ ret = ldap_id_init_internal(bectx, ops, (void **) &ctx);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_MINOR_FAILURE,
+ ("ldap_id_init_internal failed [%d][%s].\n",
+ ret, strerror(ret)));
+ goto done;
+ }
+
+ ret = sdap_id_setup_tasks(ctx);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_MINOR_FAILURE,
+ ("sdap_id_setup_tasks failed [%d][%s].\n",
+ ret, strerror(ret)));
+ goto done;
+ }
+
+ *pvt_data = ctx;
+ ret = EOK;
+
+done:
+ if (ret != EOK) {
+ talloc_free(ctx);
+ }
+ return ret;
+}
+
int sssm_ldap_auth_init(struct be_ctx *bectx,
struct bet_ops **ops,
void **pvt_data)
@@ -203,7 +231,7 @@ int sssm_ldap_auth_init(struct be_ctx *bectx,
struct sdap_auth_ctx *ctx;
int ret;
- ret = sssm_ldap_id_init(bectx, ops, &data);
+ ret = ldap_id_init_internal(bectx, ops, &data);
if (ret == EOK) {
id_ctx = talloc_get_type(data, struct sdap_id_ctx);
@@ -294,9 +322,9 @@ int sssm_ldap_access_init(struct be_ctx *bectx,
goto done;
}
- ret = sssm_ldap_id_init(bectx, ops, (void **)&access_ctx->id_ctx);
+ ret = ldap_id_init_internal(bectx, ops, (void **)&access_ctx->id_ctx);
if (ret != EOK) {
- DEBUG(1, ("sssm_ldap_id_init failed.\n"));
+ DEBUG(SSSDBG_CRIT_FAILURE, ("ldap_id_init_internal failed.\n"));
goto done;
}
@@ -417,7 +445,7 @@ int sssm_ldap_sudo_init(struct be_ctx *be_ctx,
void *data;
int ret;
- ret = sssm_ldap_id_init(be_ctx, ops, &data);
+ ret = ldap_id_init_internal(be_ctx, ops, &data);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot init LDAP ID provider [%d]: %s\n",
ret, strerror(ret)));
@@ -447,7 +475,7 @@ int sssm_ldap_autofs_init(struct be_ctx *be_ctx,
void *data;
int ret;
- ret = sssm_ldap_id_init(be_ctx, ops, &data);
+ ret = ldap_id_init_internal(be_ctx, ops, &data);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE, ("Cannot init LDAP ID provider [%d]: %s\n",
ret, strerror(ret)));