This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] nss_db: Fix initialization of iteration position [BZ #20237]
- From: Carlos O'Donell <carlos at redhat dot com>
- To: Florian Weimer <fweimer at redhat dot com>, libc-alpha at sourceware dot org
- Date: Fri, 10 Jun 2016 13:49:08 -0400
- Subject: Re: [PATCH] nss_db: Fix initialization of iteration position [BZ #20237]
- Authentication-results: sourceware.org; auth=none
- References: <20160610085406 dot E6ECF4010A4C9 at oldenburg dot str dot redhat dot com> <355f4261-e8a6-5841-e648-6b218af58d53 at redhat dot com> <1edb10ba-940f-72b5-fdd6-a0464385a473 at redhat dot com>
On 06/10/2016 11:55 AM, Florian Weimer wrote:
> On 06/10/2016 05:44 PM, Carlos O'Donell wrote:
>> On 06/10/2016 04:54 AM, Florian Weimer wrote:
>>> When get*ent is called without a preceding set*ent, we need
>>> to set the initial iteration position in get*ent.
>>>
>>> Reproducer: Add âservices: db filesâ to /etc/nsswitch.conf, then run
>>> âperl -e getserventâ. It will segfault before this change, and exit
>>> silently after it.
>>>
>>> 2016-06-10 Florian Weimer <fweimer@redhat.com>
>>>
>>> [BZ #20237]
>>> * nss/nss_db/db-XXX.c (set*ent): Reset entidx to NULL.
>>> (get*ent): Set entidx to NULL during initialization. If entidx is
>>> NULL, start iteration from the beginning.
>>
>> The fix looks good, but surely this needs a regression test?
>
> The problems are quite similar to nss_files testing:
>
> https://sourceware.org/ml/libc-alpha/2016-04/msg00392.html
>
> Build-time testing is only possible with chroot and (user) namespaces.
I have now reviewed nss_files. I think you should be moving forward
with checking that in, the code is elegant and allows for easy to write
compositional tests that run in a chroot or namespace.
--
Cheers,
Carlos.