Subject: lib/20145: Hesiod getgrid() should use Hesiod "gid" map
To: None <>
From: None <>
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
>Originator:     John David Duncan
>Release:        1.6
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:

... and also a subsequent e-mail providing some more analysis:

And I have a one-line patch, below, which I've tested in FreeBSD 5.0.  

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 ****
!               hp = hesiod_resolve(context, line, "group");
                if (hp == NULL) {
                        if (errno == ENOENT) {
                                if (!search)
--- 282,290 ----
!               hp = hesiod_resolve(context, line,
!                       search && !name ? "gid" : "group");
                if (hp == NULL) {
                        if (errno == ENOENT) {
                                if (!search)