getgroups() gives wrong result with nss_winbind

tridge at samba.org tridge at samba.org
Thu Sep 16 23:17:09 GMT 2004


Henrik,

 > #include <unistd.h>
 > #include <stdio.h>
 > 
 > int main(int argc, char **argv)
 > {
 >      long ngroups_max;
 >      ngroups_max = sysconf(_SC_NGROUPS_MAX);
 >      printf("ngroups: %ld\n", ngroups_max);
 > }

That limit is not used on all operating systems. For example, glibc on
Linux does not use sysconf for the limit (there are patches to fix
this).

You can find a program that properly tests the max groups limit at:

  http://junkcode.samba.org/ftp/unpacked/junkcode/maxgroups.c

Cheers, Tridge


More information about the samba-technical mailing list