On Apr 7, 2011, at 10:15 AM, Finney, Sean wrote: > Hi Jim, > > On Thu, 2011-04-07 at 08:22 -0400, Jim Rees wrote: > >> I was going to suggest you first call getgrouplist with groups set to 0 so >> you can always alloc() the correct size list, but then I found this in the >> man page: >> >> BUGS >> In glibc versions before 2.3.3, the implementation of this function >> contains a buffer-overrun bug: it returns the complete list of groups >> for user in the array groups, even when the number of groups exceeds >> *ngroups. > > Yuck. The function is also not in POSIX or any other standards, so > maybe it's worth discussing at a later point whether getgroups(2) would > be a better interface to use, even if it means an extra step or two. The standard RPC library function authunix_create_default() uses getgroups(2). Take a look at the glibc version of this function to see the preferred method for using getgroups(2). -- Chuck Lever chuck[dot]lever[at]oracle[dot]com -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html