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


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 
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.

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 
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.


Yannick Bergeron
yaberger at ca.ibm.com
IT Specialist

More information about the samba-technical mailing list