getgroups() gives wrong result with nss_winbind
Henrik Nordstrom
hno at squid-cache.org
Thu Sep 16 22:43:02 GMT 2004
On Thu, 16 Sep 2004, Andreas wrote:
> Nope.
> $ ./bla
> ngroups: 65536
Ok.
What do you get if you run the following (as root) giving her unix login
as argument:
#include <grp.h>
#include <pwd.h>
#include <sys/types.h>
#include <assert.h>
#include <stdio.h>
int main(int argc, char **argv)
{
struct passwd *pw = getpwnam(argv[1]);
int rc;
rc = initgroups(argv[1], pw->pw_gid);
assert(rc == 0);
rc = getgroups(0, NULL);
printf("Number of groups for %s: %d\n", argv[1], rc);
}
If this returns the correct number then the culpit is the method of login.
If this returns 64 then winbind, winbind_nss or maybe (but unlikely) the
libc is to blaim..
Regards
Henrik
More information about the samba-technical
mailing list