- Subject: libc/1625: resolver ignores "multi on" in /etc/host.conf
- From: bill at kayhay dot com
- Date: Fri Mar 3 09:26:05 2000
Topics:
libc/1625: resolver ignores "multi on" in /etc/host.conf
----------------------------------------------------------------------
Date: Fri, 3 Mar 2000 01:15:54 -0500
From: bill@kayhay.com
To: bugs@gnu.org
Subject: libc/1625: resolver ignores "multi on" in /etc/host.conf
Message-Id: <200003030615.BAA20008@delysid.gnu.org>
>Number: 1625
>Category: libc
>Synopsis: resolver ignores "multi on" in /etc/host.conf
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: libc-gnats
>State: open
>Class: sw-bug
>Submitter-Id: unknown
>Arrival-Date: Fri Mar 03 01:20:01 EST 2000
>Last-Modified:
>Originator: bill@kayhay.com
>Organization:
net
>Release: 2.1.2
>Environment:
RedHat 6.1
>Description:
If my /etc/hosts file contains two entries for one host, eg.:
10.0.0.2 bar
10.0.0.3 bar
then, if /etc/host.conf contains the line "multi on", gethostbyname(bar)
returns only the first entry. That is, if ptr = gethostbyname(bar), then
ptr->h_addr_list[1] == NULL.
>How-To-Repeat:
Insert the above entries (or equivalent) in /etc/hosts, then run the
following small program.
/* Test the resolver's "multi" option */
#include <stdio.h>
#include <netdb.h>
#include <arpa/inet.h>
int main (void) {
struct hostent *myptr;
int i;
if ( (myptr = gethostbyname ("bar")) != NULL) {
for (i=0; myptr->h_addr_list[i] != NULL; i++) {
printf("%s: %s\n", myptr->h_name,
inet_ntoa (*(struct in_addr*)myptr->h_addr_list[i]));
}
}
return 0;
}%0
>Fix:
>Audit-Trail:
>Unformatted:
------------------------------
End of forwardmvElKi Digest
***************************