Fix gethostent(3) (which was reenabled in rev 1.63) so that it actually
works by allowing _gethtent() to treat host.h_addrtype==0 && host.h_length==0 as "any address family" when parsing.
This commit is contained in:
parent
e38c2f36ba
commit
98a47ed075
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: gethnamaddr.c,v 1.63 2004/08/17 02:29:56 ginsbach Exp $ */
|
||||
/* $NetBSD: gethnamaddr.c,v 1.64 2004/11/23 03:42:13 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* ++Copyright++ 1985, 1988, 1993
|
||||
|
@ -57,7 +57,7 @@
|
|||
static char sccsid[] = "@(#)gethostnamadr.c 8.1 (Berkeley) 6/4/93";
|
||||
static char rcsid[] = "Id: gethnamaddr.c,v 8.21 1997/06/01 20:34:37 vixie Exp ";
|
||||
#else
|
||||
__RCSID("$NetBSD: gethnamaddr.c,v 1.63 2004/08/17 02:29:56 ginsbach Exp $");
|
||||
__RCSID("$NetBSD: gethnamaddr.c,v 1.64 2004/11/23 03:42:13 lukem Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -783,9 +783,9 @@ _gethtent(void)
|
|||
goto again;
|
||||
}
|
||||
/* if this is not something we're looking for, skip it. */
|
||||
if (host.h_addrtype != af)
|
||||
if (host.h_addrtype != 0 && host.h_addrtype != af)
|
||||
goto again;
|
||||
if (host.h_length != len)
|
||||
if (host.h_length != 0 && host.h_length != len)
|
||||
goto again;
|
||||
h_addr_ptrs[0] = (char *)(void *)host_addr;
|
||||
h_addr_ptrs[1] = NULL;
|
||||
|
@ -1067,6 +1067,8 @@ addrsort(char **ap, int num, res_state res)
|
|||
struct hostent *
|
||||
gethostent(void)
|
||||
{
|
||||
host.h_addrtype = 0;
|
||||
host.h_length = 0;
|
||||
return _gethtent();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue