summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2012-08-16 17:35:53 -0400
committerJakub Hrozek <jhrozek@redhat.com>2012-08-17 15:52:48 +0200
commit2e7b982a762f02c957e5bad88802245fe27c079c (patch)
tree6ddeb4251c82977bbc9741a5e88c6e9d03b9bfce
parent4d90a42f5c3aa2956393d0bf21c22416ba01e03e (diff)
downloadsssd-2e7b982a762f02c957e5bad88802245fe27c079c.tar.gz
sssd-2e7b982a762f02c957e5bad88802245fe27c079c.tar.xz
sssd-2e7b982a762f02c957e5bad88802245fe27c079c.zip
Process all groups from a single nesting level
https://bugzilla.redhat.com/show_bug.cgi?id=846664 If the first group was cached when processing the nested group membership, we would call tevent_req_done, effectivelly marking the whole nesting level as done.
-rw-r--r--src/providers/ldap/sdap_async_accounts.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/providers/ldap/sdap_async_accounts.c b/src/providers/ldap/sdap_async_accounts.c
index 39caf9518..54170195a 100644
--- a/src/providers/ldap/sdap_async_accounts.c
+++ b/src/providers/ldap/sdap_async_accounts.c
@@ -4693,9 +4693,8 @@ struct tevent_req *rfc2307bis_nested_groups_send(
if ((num_groups == 0) ||
(nesting > dp_opt_get_int(opts->basic, SDAP_NESTING_LEVEL))) {
/* No parent groups to process or too deep*/
- tevent_req_done(req);
- tevent_req_post(req, ev);
- return req;
+ ret = EOK;
+ goto done;
}
state->ev = ev;
@@ -4709,9 +4708,22 @@ struct tevent_req *rfc2307bis_nested_groups_send(
state->nesting_level = nesting;
state->group_hash = group_hash;
- ret = rfc2307bis_nested_groups_step(req);
+ while (state->group_iter < state->num_groups) {
+ ret = rfc2307bis_nested_groups_step(req);
+ if (ret == EOK) {
+ /* This group had already been looked up. Continue to
+ * another group in the same level
+ */
+ state->group_iter++;
+ continue;
+ } else {
+ goto done;
+ }
+ }
+
+done:
if (ret == EOK) {
- /* All parent groups were already processed */
+ /* All groups on that level had been processed. Quit. */
tevent_req_done(req);
tevent_req_post(req, ev);
} else if (ret != EAGAIN) {
@@ -4762,6 +4774,7 @@ static errno_t rfc2307bis_nested_groups_step(struct tevent_req *req)
DEBUG(6, ("Processing group [%s]\n", state->primary_name));
if (hash_has_key(state->group_hash, &key)) {
+ DEBUG(6, ("Group was already processed, taking a shortcut\n"));
talloc_free(key.str);
talloc_free(tmp_ctx);
return EOK;