S3: getgrouplist_internals (source3/lib/system_smbd.c)

yaberger at ca.ibm.com yaberger at ca.ibm.com
Fri Mar 4 07:27:40 MST 2011


Hi,

Currently, if getgrouplist() is not available on the system, 
getgrouplist_internals() is called.
getgrouplist_internals() will call initgroups() and getgroups() to 
retrieve the gid list.
If initgroups() is also not available on the system, it will be replaced 
by rep_initgroups().
rep_initgroups() is using getgrent()
getgrent() only fetch the local groups and is also known to be slow when 
there is hundred of thousand of groups and users.

OpenSSH and ProFTPD are doing it differently.
Instead of using initgroups() and getgroups() combinaison, they are using 
getgrset().
In ProFTPD, if getgrouplist() and getgrset() are not available, getgrent() 
is used as last resort.

See these bug reports for these projects which resulted in the use of 
getgrset() when getgrouplist() is not available.
https://bugzilla.mindrot.org/show_bug.cgi?id=1081
http://bugs.proftpd.org/show_bug.cgi?id=3231



When getgrouplist() is not available, could you use getgrset() if it's 
available instead of the initgroups() and getgroups() ?
If getgrset() is not available, then the old logic could still be used.

I'm pretty sure some of you might not understand the purpose of this 
request.
The reason behind this request is a pretty long story.
Let's just say for now that using getgrset() instead of initgroups() would 
fix an issue probably only present in my rare (if not unique) environment.



Regards,

Yannick Bergeron
yaberger at ca.ibm.com
IT Specialist


More information about the samba-technical mailing list