getgroups() gives wrong result with nss_winbind

Andreas andreas at conectiva.com.br
Sat Sep 18 14:40:26 GMT 2004


On Fri, Sep 17, 2004 at 10:40:43PM -0700, Jeremy Allison wrote:
> On Fri, Sep 17, 2004 at 09:30:07PM -0300, Andreas wrote:
> 
> > I looked through other nss modules and it seems they all handle this situation
> > themselves. nss-compat, for example, will arbitrarily double the buffer each
> > time it gets an NSS_STATUS_TRYAGAIN with an ERANGE error and call the function again.
> 
> Can you point me to the area in the glibc source code that
> does that ? I downloaded the src rpm for glibc2-3.2 and I
> can see it retuning NSS_STATUS_TRYAGAIN and errno = ERANGE
> but I don't see the loop trying again.
> 
> Where is this code ?

I looked here:
nis/nss_compat/compat-initgroups.c:418

  tmpbuf = __alloca (buflen);

  do
    {
      while ((status = internal_getgrent_r (&intern, tmpbuf, buflen,
                                            user, group, start, size,
                                            groupsp, limit, errnop))
             == NSS_STATUS_TRYAGAIN && *errnop == ERANGE)
        tmpbuf = extend_alloca (tmpbuf, buflen, 2 * buflen);
    }
  while (status == NSS_STATUS_SUCCESS);



More information about the samba-technical mailing list