[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#468378: libc6: functions that require *errnop, shouldn't receive it as &errno (e.g. _nss_*_getgrnam_r)



Package: libc6
Version: 2.7-6
Severity: normal


Functions that require *errnop for the error, sometimes restores the errno to
it's original state before returning. If they are given errnop = &errno, then
they reset errno, and thus errnop also gets reset and no error is reported.

My example is getgrnam with hesiod. getgrnam calls getgrnam_r with initial
buffer of 1024. If it gets ERANGE it doubles the buffer. The problem is that
_nss_hesiod_getgrnam_r is (eventually) called with errnop = &errno. So errnop
is set to ERANGE as it should, but before it returns, it calls
__set_errno(olderr) (hesiod/nss_hesiod/hesiod-grp.c:92) which also sets errnop
to olderr. As a result errnop != ERANGE, and getgrnam_r (and later getgrnam)
fails with errno = SUCCESS (or, in other words, users that belong to large
groups, can't login).

To locally fix the problem, I conditioned the __set_errno to:

if (errnop != &errno) __set_errno(olderr);

This is a local fix, and though it works, I really think that functions that
get *errnop as a parameter, shouldn't get it as &errno.


-- System Information:
Debian Release: lenny/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (500, 'stable'), (1, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.24.2mos-2 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages libc6 depends on:
ii  libgcc1                 1:4.3-20080202-1 GCC support library

libc6 recommends no packages.

-- no debconf information



Reply to: