Subject: lib/29850: need reentrant API for getpwent_r()
To: None <lib-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <lukem@NetBSD.org>
List: netbsd-bugs
Date: 04/01/2005 00:18:00
>Number: 29850
>Category: lib
>Synopsis: need reentrant API for getpwent_r()
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Apr 01 00:18:00 +0000 2005
>Originator: Luke Mewburn
>Release: NetBSD 3.99.1
>Organization:
TNF
>Environment:
>Description:
We currently don't have the reentrant getpwent_r().
See PR 29849 for a similar issue with getgrent_r().
As per the request for getgrent_r(3) in PR 29849,
I propose we adopt the glibc API for getpwent_r(3):
int
getpwent_r(struct passwd *pw, char *buffer, int buflen,
struct passwd **result)
Note that because the compat mode for getpwent(3)
supports "+@netgroup" and "-@netgroup", there are
numerous other reentrancy issues in getpwnam_r()
and getpwuid_r() because of the use of getnetgrent(3)
(et al), and the need to call setpassent(3) as well...
We need to consider how to address these as a
separate issue.
>How-To-Repeat:
Code inspection of getpwent.c.
(Look for "XXXREENTRANT").
>Fix:
Select an appropriate API for getpwent_r().
Implement getpwent_r().
Change getpwent.c::_passwdcompat_pwscan() to use this.