Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jul 2010 10:21:48 +0000
From:      Jens Rehsack <rehsack@googlemail.com>
To:        Ashish SHUKLA <ashish@freebsd.org>
Cc:        Dan Nelson <dnelson@allantgroup.com>, freebsd-questions@freebsd.org
Subject:   Re: getpwent bug?
Message-ID:  <4C4032BC.90608@netbsd.org>
In-Reply-To: <86wrsvpx0v.fsf@chateau.d.if>
References:  <AANLkTin5RGYfu_Xt5HWxKFO8GMTOi3YWQ8dyr95ZDW-Y@mail.gmail.com>	<20100715172615.GC5485@dan.emsphone.com> <86tyo0qd19.fsf@chateau.d.if>	<20100716043056.GF5485@dan.emsphone.com>	<AANLkTilSum3vumQhv4qtOQhCaSHo832Ub3b9bEhP0zSt@mail.gmail.com>	<86d3unrfgu.fsf@chateau.d.if> <4C401B31.4000402@netbsd.org>	<8639vjrdru.fsf@chateau.d.if> <4C402689.7070005@netbsd.org> <86wrsvpx0v.fsf@chateau.d.if>

next in thread | previous in thread | raw e-mail | index | archive | help
On 07/16/10 09:59, Ashish SHUKLA wrote:
> Jens Rehsack writes:
>> On 07/16/10 09:12, Ashish SHUKLA wrote:
>>> Jens Rehsack writes:
>>>
>>> [...]
>>>
>>>> I cached the entires - I rate setpwent as to dangerous.
>>>
>>> dangerous ? why ?
>
>> Because it modifies something - and I might not know the source.
>> getpwent(3) delivers entries from yp, too (or LDAP) etc. - and
>> when I call setpwent(3) for such an entry, what happens then?
>
>> Long explanation for: I do not know the consequences - and that's
>> why I rate it dangerous as workaround.
>
> ,---- an excerpt from getpwent(3)
[...]
> `----
>
> I can't see anything which says about modifying NSS database. AFAIK none of
> the NSS routines allow you to write on database, you've to use the database
> specific method to modify the database.

You're absolutely right - I never took a deeper look, because I always
was only interested to read the (user|group) data and expected setpwent
to modify such an entry.

A quick look into Stevens "Advanced Programming in the UNIX environment"
could had enlighten myself. Sorry that I didn't RTFM carefully.

Best regards and many, many thanks,
Jens



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4C4032BC.90608>