[PATCH] getgroups() gives wrong result with nss_winbind
Andreas
andreas at conectiva.com.br
Sat Sep 18 18:37:06 GMT 2004
On Sat, Sep 18, 2004 at 06:38:36PM +0200, Henrik Nordstrom wrote:
> NSS initgroups function is called with
>
> const char *user; Login name
> gid_t group; Primary group
> long int *start; Number of group entries already populated
> gid_t **bufp; Return of groups
> long int *size; Initial size of the above return buffer, in number
> of entries.
> long int limit; Maximum allowed number of returned entries, <= 0 no
> limit
> int *ettnop; Errno return
>
> And the NSS module is supposed to realloc *bufp while populating the
> entries until limit is reached, and in addition to prune out duplicate
Ah, nice to know
> Samba-3.0.7 even has code for this, but a few minor mistakes relating to
> the limit parameter makes it never trigger.. Attached is a (untested)
> patch which should address this and a few other bugs in the same code is
> attached.
I tried the patch (just had to define MIN) and all my test cases started working.
[DOMAIN\marcia at pandora ~]$ id|wc
1 7 5979
[DOMAIN\marcia at pandora ~]$ id DOMAIN\\marcia|wc
1 7 5970
[DOMAIN\marcia at pandora ~]$ /tmp/getgroups
Result=224
[root at pandora ~]# /tmp/1/initgroups DOMAIN\\marcia
Number of groups for DOMAIN\marcia: 224
[root at pandora ~]#
Nice! :)
More information about the samba-technical
mailing list