s3:winbind:idmap_ldap: fix a crash bug in idmap_ldap_unixids_to_sids (#6387)
authorMichael Adam <obnox@samba.org>
Fri, 22 May 2009 09:58:00 +0000 (11:58 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 11 Aug 2009 10:10:35 +0000 (12:10 +0200)
commit5750b8d6e1f8ff93276bb422e8e1ffe44dfbcf3c
treefb4af56abb3ab849b261e656a671374a0ca24bec
parentdd1e92e99786b98c60e5b0ebbe1b7edaae924fb8
s3:winbind:idmap_ldap: fix a crash bug in idmap_ldap_unixids_to_sids (#6387)

This fixes a crash bug hit when multiple mappings were found by
the ldap search. This crash was caused by an ldap asssertion
in ldap_next_entry because was set to NULL in each iteration.

The corresponding fix was applied to the idmap_ldap_sids_to_unixids()
by Jerry in 2007 (b066668b74768d9ed547f16bf7b6ba6aea5df20a).

This fixes the crash part of bug #6387.

There is a logic part, too:
The problem currently only occurs when multiple mappings are found
for one given unixid. Now winbindd does not crash any more but
it does not correctly handle this situation. It just returns the
last mapping from the ldap search results.
This needs fixing.

Michael
(cherry picked from commit e9010fa366746ec1ae948dbcf3493d446e23b14c)

Signed-off-by: Michael Adam <obnox@samba.org>
(cherry picked from commit 15652ee4259201a6d794c735d7e81631338f1050)
source/winbindd/idmap_ldap.c