sssd/0013-nested-groups-allocate-more-space-if-deref-returns-m.patch
Jakub Hrozek ba06c0ac1d Apply a number of patches from upstream to fix issues found post-beta
In particular:
-- segfault with a high DEBUG level
-- Fix IPA password migration (upstream #1873)
-- Fix fail over when retrying SRV resolution (upstream #1886)
2013-06-16 13:12:37 +02:00

54 lines
2.0 KiB
Diff

From 354febd0c5647e16c9ce5d3985600baa4b8a86ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pavel=20B=C5=99ezina?= <pbrezina@redhat.com>
Date: Fri, 14 Jun 2013 13:49:47 +0200
Subject: [PATCH] nested groups: allocate more space if deref returns more
members
https://fedorahosted.org/sssd/ticket/1894
---
src/providers/ldap/sdap_async_nested_groups.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/providers/ldap/sdap_async_nested_groups.c b/src/providers/ldap/sdap_async_nested_groups.c
index e8d5295cc31319599212f96d7b58c8f5bd38245a..4f8dca9f50cdd150bacc14b1e834847e940b5e75 100644
--- a/src/providers/ldap/sdap_async_nested_groups.c
+++ b/src/providers/ldap/sdap_async_nested_groups.c
@@ -2048,6 +2048,18 @@ sdap_nested_group_deref_direct_process(struct tevent_req *subreq)
DEBUG(SSSDBG_TRACE_INTERNAL, ("Received %d dereference results, "
"about to process them\n", num_entries));
+ if (num_entries != members->num_values) {
+ /* Dereference returned more values than obtained earlier. We need
+ * to adjust group array size. */
+ state->nested_groups = talloc_realloc(state, state->nested_groups,
+ struct sysdb_attrs *,
+ num_entries);
+ if (state->nested_groups == NULL) {
+ ret = ENOMEM;
+ goto done;
+ }
+ }
+
for (i = 0; i < num_entries; i++) {
ret = sysdb_attrs_get_string(entries[i]->attrs,
SYSDB_ORIG_DN, &orig_dn);
@@ -2155,6 +2167,15 @@ sdap_nested_group_deref_direct_process(struct tevent_req *subreq)
}
}
+ /* adjust size of nested groups array */
+ state->nested_groups = talloc_realloc(state, state->nested_groups,
+ struct sysdb_attrs *,
+ state->num_groups);
+ if (state->nested_groups == NULL) {
+ ret = ENOMEM;
+ goto done;
+ }
+
ret = EOK;
done:
--
1.7.11.7