sambauser at katehok.ac93.org
Mon Oct 11 02:52:10 GMT 2004
Luke Mewburn wrote:
> On Sat, Oct 09, 2004 at 11:51:03AM +1000, Andrew Bartlett wrote:
> | 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);
From /usr/include/grp.h (which is part of glibc):
/* Store at most *NGROUPS members of the group set for USER into
*GROUPS. Also include GROUP. The actual number of groups found is
returned in *NGROUPS. Return -1 if the if *NGROUPS is too small.
This function is not part of POSIX and therefore no official
cancellation point. But due to similarity with an POSIX interface
or due to the implementation it is a cancellation point and
therefore not marked with __THROW. */
extern int getgrouplist (__const char *__user, __gid_t __group,
__gid_t *__groups, int *__ngroups);
I hope it is portable across different platforms but it's definitely not
a POSIX function.
More information about the samba-technical