get_domain_user_groups() improvement.

Luke Mewburn lukem-samba at
Sun Oct 10 23:30:41 GMT 2004

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[]);

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url :

More information about the samba-technical mailing list