r15698: An attempt to make the winbind lookup_usergroups() call in security=ads
commit7d766b5505e4099ef7dd4e88bb000ebe38d71bd0
authorGünther Deschner <gd@samba.org>
Thu, 18 May 2006 19:34:25 +0000 (18 19:34 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:17:08 +0000 (10 11:17 -0500)
tree0b97d20cffacf1d0a8189d0a5abb5d9168584ed6
parent52423e01dc209ba5abde808a446287714ed11567
r15698: An attempt to make the winbind lookup_usergroups() call in security=ads
more scalable:

The most efficient way is to use the "tokenGroups" attribute which gives
the nested group membership. As this attribute can not always be
retrieved when binding with the machine account (the only garanteed way
to get the tokenGroups I could find is when the machine account is a
member of the "Pre Win2k Access" builtin group).

Our current fallback when "tokenGroups" failed is looking for all groups
where the userdn was in the "member" attribute. This behaves not very
well in very large AD domains.

The patch first tries the "memberOf" attribute on the user's dn in that
case and directly retrieves the group's sids by using the LDAP Extended
DN control from the user's object.

The way to pass down the control to the ldap search call is rather
painfull and probably will be rearranged later on.

Successfully tested on win2k sp0, win2k sp4, wink3 sp1 and win2k3 r2.

Guenther
source/include/ads.h
source/libads/ldap.c
source/libads/ldap_utils.c
source/nsswitch/winbindd_ads.c
source/nsswitch/winbindd_util.c