summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Březina <pbrezina@redhat.com>2013-06-14 13:49:47 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-06-17 09:47:06 +0200
commitd9a000b54a23fd4a58481b864175b88a8a3f7949 (patch)
tree025d120880b9fa918b52567727bf4f2116382963
parent47d19d62aaabb9e7f09353ecad9f48aa4054e3b1 (diff)
downloadsssd-d9a000b54a23fd4a58481b864175b88a8a3f7949.tar.gz
sssd-d9a000b54a23fd4a58481b864175b88a8a3f7949.tar.bz2
sssd-d9a000b54a23fd4a58481b864175b88a8a3f7949.zip
nested groups: allocate more space if deref returns more members
https://fedorahosted.org/sssd/ticket/1894
-rw-r--r--src/providers/ldap/sdap_async_nested_groups.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/providers/ldap/sdap_async_nested_groups.c b/src/providers/ldap/sdap_async_nested_groups.c
index e8d5295c..e2071535 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 (members->num_values < num_entries) {
+ /* 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: