add alternate backend support for getgrouplist
authorJosiah Worcester <josiahw@gmail.com>
Mon, 16 Mar 2015 00:20:53 +0000 (19:20 -0500)
committerRich Felker <dalias@aerifal.cx>
Mon, 16 Mar 2015 02:32:22 +0000 (22:32 -0400)
commit2894a44b40e460fc4112988407818439f2e9672d
treeed88ad3753488b9b1ff43fdbc2a1c67876735f73
parent962cbfbf864a50aaf88bc59e5c7cf0b664ff599a
add alternate backend support for getgrouplist

This completes the alternate backend support that was previously added
to the getpw* and getgr* functions. Unlike those, though, it
unconditionally queries nscd. Any groups from nscd that aren't in the
/etc/groups file are added to the returned list, and any that are
present in the file are ignored. The purpose of this behavior is to
provide a view of the group database consistent with what is observed
by the getgr* functions. If group memberships reported by nscd were
honored when the corresponding group already has a definition in the
/etc/groups file, the user's getgrouplist-based membership in the
group would conflict with their non-membership in the reported
gr_mem[] for the group.

The changes made also make getgrouplist thread-safe and eliminate its
clobbering of the global getgrent state.
src/misc/getgrouplist.c [deleted file]
src/passwd/getgrouplist.c [new file with mode: 0644]
src/passwd/nscd.h