Check if a host argument is a IPv6 presentation format address before

going to gethostbyname2(3).

PR:		bin/31632
MFC after:	3 days
This commit is contained in:
cjc 2002-08-25 05:44:13 +00:00
parent 5a147d55be
commit 31e6f776be

View File

@ -548,13 +548,13 @@ lookup_host (host, addr, family)
char *host;
u_char *addr;
{
struct hostent *he = gethostbyname2(host, family);
if (!he)
return(-1);
memcpy(addr, he->h_addr_list[0], he->h_length);
struct hostent *he;
if (inet_pton(family, host, addr) != 1) {
if ((he = gethostbyname2(host, family)) == NULL)
return(-1);
memcpy(addr, he->h_addr_list[0], he->h_length);
}
return(0);
}