get_domain_user_groups() improvement.
Andrew Bartlett
abartlet at samba.org
Mon Oct 11 10:44:10 GMT 2004
On Mon, 2004-10-11 at 09:30, Luke Mewburn wrote:
> On Sat, Oct 09, 2004 at 11:51:03AM +1000, Andrew Bartlett wrote:
> | On Thu, 2004-09-23 at 10:12, Igor Belyi wrote:
> | > Hi,
> | >
> | > I have the following patch which improves performance of
> | > get_domain_user_groups() function with LDAP backend by asking LDAP for
> | > only groups user belong to instead of for all groups.
> |
> | I finally took a look at this area, and I committed a different patch.
> |
> | I use sys_getgrouplist() to get a list of groups the user is in - that
> | being the 'posix way', and avoids a special case for LDAP (for now, as
> | you know I think such special cases are worthwhile elsewhere).
>
> getgrouplist(3) is not a POSIX function; it's from 4.4BSD (and thus
> NetBSD/FreeBSD/OpenBSD have it):
> int getgrouplist(const char *name, gid_t basegid,
> gid_t *groups, int *ngroups);
> I have no idea if glibc has it or has the same API as 4.4BSD (it's likely).
>
> getgroups(2) is probably the POSIX function you're referring to:
> int getgroups(int gidsetsize, gid_t grouplist[]);
See, this is why I talk about sys_getgrouplist(). If you read the Samba
sources, you will find that we emulate this function via
initgroups()/getgroups() when it is not available.
The pity is that getgrouplist() is broken in glibc <= 2.3.2, but I don't
know a way to detect if it is 'fixed', aside from version numbers (and
only the 2.3 part shows up in the macros).
Andrew Bartlett
--
Andrew Bartlett abartlet at samba.org
Authentication Developer, Samba Team http://samba.org
Student Network Administrator, Hawker College abartlet at hawkerc.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20041011/e6228656/attachment.bin
More information about the samba-technical
mailing list