getgroups() gives wrong result with nss_winbind

Andreas andreas at conectiva.com.br
Fri Sep 17 01:17:18 GMT 2004


On Fri, Sep 17, 2004 at 12:43:02AM +0200, Henrik Nordstrom wrote:
> 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);
> }

[root at pandora 1]# ./test andreas
Number of groups for andreas: 4

[root at pandora 1]# ./test DOMAIN\\marcia
Number of groups for DOMAIN\marcia: 64

"testando" is a local user which is a member of 100 local
supplementary groups:

[root at pandora 1]# ./test testando
Number of groups for testando: 101



More information about the samba-technical mailing list