Subject: lib/20145: Hesiod getgrid() should use Hesiod "gid" map
To: None <gnats-bugs@gnats.netbsd.org>
From: None <jdd@efn.org>
List: netbsd-bugs
Date: 01/31/2003 22:41:34
>Number: 20145
>Category: lib
>Synopsis: Hesiod getgrid() should use Hesiod "gid" map
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jan 31 22:42:00 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: John David Duncan
>Release: 1.6
>Organization:
GreatSchools.net
>Environment:
>Description:
Hesiod implementations at MIT use the "gid" map to map group ids to group names.
This is the functionality documented in hesinfo(1) and in Stephen Dyer's 1988 Usenix paper on Hesiod, and the implementation in libbind functions this way. The libc implementation in NetBSD, however, uses the "group" map, a practice that was perhaps introduced in DEC Ultrix (though I don't believe NetBSD's Hesiod is fully compatible with Ultrix Hesiod). I have found an old PR reporting this:
http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=9467
... and also a subsequent e-mail providing some more analysis:
http://mail-index.netbsd.org/tech-net/2000/07/02/0012.html
And I have a one-line patch, below, which I've tested in FreeBSD 5.0.
>How-To-Repeat:
>Fix:
Apply this patch to src/lib/libc/gen/getgrent.c
*** getgrent.c.bsd Wed Jan 22 13:41:43 2003
--- getgrent.c Wed Jan 22 13:42:39 2003
***************
*** 282,288 ****
_gr_hesnum++;
}
! hp = hesiod_resolve(context, line, "group");
if (hp == NULL) {
if (errno == ENOENT) {
if (!search)
--- 282,290 ----
_gr_hesnum++;
}
! hp = hesiod_resolve(context, line,
! search && !name ? "gid" : "group");
!
if (hp == NULL) {
if (errno == ENOENT) {
if (!search)
>Release-Note:
>Audit-Trail:
>Unformatted: