[Bug nscd/22342] NSCD not properly caching netgroup
cvs-commit at gcc dot gnu.org
sourceware-bugzilla@sourceware.org
Fri Mar 2 04:25:00 GMT 2018
https://sourceware.org/bugzilla/show_bug.cgi?id=22342
--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via 1c81d55fc4b07b51adf68558ba74ce975153e580 (commit)
from b717c14fb1b2b51373d8d0f0217bb53caad59495 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=1c81d55fc4b07b51adf68558ba74ce975153e580
commit 1c81d55fc4b07b51adf68558ba74ce975153e580
Author: DJ Delorie <dj@redhat.com>
Date: Thu Mar 1 23:20:45 2018 -0500
[BZ #22342] Fix netgroup cache keys.
Unlike other nscd caches, the netgroup cache contains two types of
records - those for "iterate through a netgroup" (i.e. setnetgrent())
and those for "is this user in this netgroup" (i.e. innetgr()),
i.e. full and partial records. The timeout code assumes these records
have the same key for the group name, so that the collection of records
that is "this netgroup" can be expired as a unit.
However, the keys are not the same, as the in-netgroup key is generated
by nscd rather than being passed to it from elsewhere, and is generated
without the trailing NUL. All other keys have the trailing NUL, and as
noted in the linked BZ, debug statements confirm that two keys for the
same netgroup are added to the cache with two different lengths.
The result of this is that as records in the cache expire, the purge
code only cleans out one of the two types of entries, resulting in
stale, possibly incorrect, and possibly inconsistent cache data.
The patch simply includes the existing NUL in the computation for the
key length ('key' points to the char after the NUL, and 'group' to the
first char of the group, so 'key-group' includes the first char to the
NUL, inclusive).
[BZ #22342]
* nscd/netgroupcache.c (addinnetgrX): Include trailing NUL in
key value.
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 6 ++++++
nscd/netgroupcache.c | 2 +-
2 files changed, 7 insertions(+), 1 deletions(-)
--
You are receiving this mail because:
You are on the CC list for the bug.
More information about the Glibc-bugs
mailing list