Package: nss-updatedb
Version: 7-1.1
Severity: important

Hi there,

In updatedb.c, the logic is this:

        status = vtable->setent();
        if (status != NSS_STATUS_SUCCESS) {
                return status;
        }

tryagain:
        do {
                status = vtable->getent((void *)&result, buffer, buflen, 
&errnop);
                if (status != NSS_STATUS_SUCCESS) {
                        break;
                }
                status = callback(handle, (void *)&result, private);
        } while (status == NSS_STATUS_SUCCESS);

        if (status == NSS_STATUS_TRYAGAIN) {
                buflen *= 2;
                buffer = realloc(buffer, buflen);
                if (buffer == NULL) {
                        vtable->endent();
                        return NSS_STATUS_TRYAGAIN;
                }
                status = NSS_STATUS_SUCCESS; /* enter the loop again */
                goto tryagain;
        }

        vtable->endent();

Which looks really good, until you spot the subtle flaw: the goto does
not actually retry the group that returned NSS_STATUS_TRYAGAIN, it tries
to grab the next group off the list.  getgrent always returns the next
group in the list each time it's called - it doesn't notice that the
last call failed and try again a second time.  I don't see a simple
patch, sadly.  The only thing I can think of at the moment is to rewind
to the beginning and try again, but that seems really wasteful.  I
suppose I can take a look at how glibc handles NSS_STATUS_TRYAGAIN and
try to port some of that over.

Oh, and the version is a bit screwy because this is on alioth, where we
were bitten by this bug (group Debian needs a buffer of 22k) and I
temporarily rebuilt the package with a stupidly large buffer as a
workaround.

Thanks,

-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-4-xen-amd64
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8) (ignored: LC_ALL 
set to en_US.utf8)

Versions of packages nss-updatedb depends on:
ii  libc6                       2.3.6.ds1-13 GNU C Library: Shared libraries
ii  libdb4.3                    4.3.29-8     Berkeley v4.3 Database Libraries [

Versions of packages nss-updatedb recommends:
ii  libnss-db                    2.2.3pre1-2 NSS module for using Berkeley Data

-- no debconf information


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to