summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2014-01-21 23:40:17 +0100
committerJakub Hrozek <jhrozek@redhat.com>2014-01-29 14:08:51 +0100
commit12213ca982ee3ad58f08e145532b500d7c4678d1 (patch)
tree03619246deccad12190d7b7dd2e77ec0658d58eb /src
parentdde2f0b4fcabc7093ddfcdda3dbacff00b82df46 (diff)
downloadsssd-12213ca982ee3ad58f08e145532b500d7c4678d1.tar.gz
sssd-12213ca982ee3ad58f08e145532b500d7c4678d1.tar.xz
sssd-12213ca982ee3ad58f08e145532b500d7c4678d1.zip
LDAP: Don't clobber original_member during enumeration
Diffstat (limited to 'src')
-rw-r--r--src/providers/ldap/sdap_async_groups.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c
index 4ae772636..f203bc962 100644
--- a/src/providers/ldap/sdap_async_groups.c
+++ b/src/providers/ldap/sdap_async_groups.c
@@ -804,6 +804,7 @@ static int sdap_save_groups(TALLOC_CTX *memctx,
int num_groups,
bool populate_members,
hash_table_t *ghosts,
+ bool save_orig_member,
char **_usn_value)
{
TALLOC_CTX *tmpctx;
@@ -862,7 +863,8 @@ static int sdap_save_groups(TALLOC_CTX *memctx,
/* if 2 pass savemembers = false */
ret = sdap_save_group(tmpctx, opts, dom, groups[i],
- populate_members, has_nesting,
+ populate_members,
+ has_nesting && save_orig_member,
ghosts, &usn_value, now);
/* Do not fail completely on errors.
@@ -1828,7 +1830,7 @@ static void sdap_get_groups_process(struct tevent_req *subreq)
"to allow unrolling of nested groups.\n"));
ret = sdap_save_groups(state, state->sysdb, state->dom, state->opts,
state->groups, state->count, false,
- NULL, NULL);
+ NULL, true, NULL);
if (ret) {
DEBUG(2, ("Failed to store groups.\n"));
tevent_req_error(req, ret);
@@ -1880,10 +1882,14 @@ static void sdap_get_groups_done(struct tevent_req *subreq)
/* If ignore_group_members is set for the domain, don't update
* group memberships in the cache.
+ *
+ * If enumeration is on, don't overwrite orig_members as they've been
+ * saved earlier.
*/
ret = sdap_save_groups(state, state->sysdb, state->dom, state->opts,
state->groups, state->count,
!state->dom->ignore_group_members, NULL,
+ !state->enumeration,
&state->higher_usn);
if (ret) {
DEBUG(2, ("Failed to store groups.\n"));
@@ -2007,7 +2013,7 @@ static void sdap_ad_match_rule_members_process(struct tevent_req *subreq)
/* Now save the group, users and ghosts to the cache */
ret = sdap_save_groups(tmp_ctx, state->sysdb, state->dom,
state->opts, state->groups, 1,
- false, ghosts, NULL);
+ false, ghosts, true, NULL);
if (ret != EOK) {
DEBUG(SSSDBG_MINOR_FAILURE,
("Could not save group to the cache: [%s]\n",
@@ -2083,7 +2089,7 @@ static void sdap_nested_done(struct tevent_req *subreq)
}
ret = sdap_save_groups(state, state->sysdb, state->dom, state->opts,
- groups, group_count, false, ghosts,
+ groups, group_count, false, ghosts, true,
&state->higher_usn);
if (ret != EOK) {
goto fail;