From 2894a44b40e460fc4112988407818439f2e9672d Mon Sep 17 00:00:00 2001 From: Josiah Worcester Date: Sun, 15 Mar 2015 19:20:53 -0500 Subject: 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/passwd/nscd.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/passwd/nscd.h') diff --git a/src/passwd/nscd.h b/src/passwd/nscd.h index 102f0b4b..9a53c328 100644 --- a/src/passwd/nscd.h +++ b/src/passwd/nscd.h @@ -8,6 +8,7 @@ #define GETPWBYUID 1 #define GETGRBYNAME 2 #define GETGRBYGID 3 +#define GETINITGR 15 #define REQVERSION 0 #define REQTYPE 1 @@ -33,6 +34,11 @@ #define GRMEMCNT 5 #define GR_LEN 6 +#define INITGRVERSION 0 +#define INITGRFOUND 1 +#define INITGRNGRPS 2 +#define INITGR_LEN 3 + FILE *__nscd_query(int32_t req, const char *key, int32_t *buf, size_t len, int *swap); #endif -- cgit v1.2.1