diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2012-11-15 07:33:30 +0100 |
---|---|---|
committer | Jakub Hrozek <jhrozek@redhat.com> | 2012-11-19 14:36:19 +0100 |
commit | 4f6657502d32ebe8c9bd7f97a4d2a189d63bc410 (patch) | |
tree | c6c0d7b961c95a4200f01a29348244ef247d374a /src/providers | |
parent | 84f06af2ef1ad15a42e666881fdea11e8ca6607d (diff) | |
download | sssd-4f6657502d32ebe8c9bd7f97a4d2a189d63bc410.tar.gz sssd-4f6657502d32ebe8c9bd7f97a4d2a189d63bc410.tar.xz sssd-4f6657502d32ebe8c9bd7f97a4d2a189d63bc410.zip |
LDAP: Fix saving empty groups
https://fedorahosted.org/sssd/ticket/1647
A logic bug in the LDAP provider causes an attempt to allocate a zero-length
array for group members while processing an empty group. The allocation
would return NULL and saving the empty group would fail.
Diffstat (limited to 'src/providers')
-rw-r--r-- | src/providers/ldap/sdap_async_groups.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/providers/ldap/sdap_async_groups.c b/src/providers/ldap/sdap_async_groups.c index 5fea0b474..32dd5020a 100644 --- a/src/providers/ldap/sdap_async_groups.c +++ b/src/providers/ldap/sdap_async_groups.c @@ -379,9 +379,11 @@ static int sdap_save_group(TALLOC_CTX *memctx, el->values = gh->values; el->num_values = gh->num_values; + cnt = el->num_values + el1->num_values; + DEBUG(SSSDBG_TRACE_FUNC, ("Group %s has %d members\n", name, cnt)); + /* Now process RFC2307bis ghost hash table */ - if (ghosts != NULL) { - cnt = el->num_values + el1->num_values; + if (ghosts && cnt > 0) { el->values = talloc_realloc(attrs, el->values, struct ldb_val, cnt); if (el->values == NULL) { |