1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00
* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname2_r): If res_search
	fails don't rely on errno value.
	(getanswer_r): Set *ERRNOP in error cases.

	* sysdeps/posix/getaddrinfo.c (gaih_local): Test protocol and socktype.
	(gaih_inet_serv): Return EIA_NODATA if name is known but has no
	associated data.  Test for matching numeric address and family.
	(getaddrinfo): Remember EAI_NODATA result and return this in case
	everything fails.
	Reported by Arkadiusz Miskiewicz <misiek@misiek.eu.org>.
This commit is contained in:
Ulrich Drepper
1999-09-12 19:24:42 +00:00
parent 9e5dcaa88c
commit a0bf6ac732
3 changed files with 81 additions and 42 deletions

View File

@ -163,7 +163,7 @@ _nss_dns_gethostbyname2_r (const char *name, int af, struct hostent *result,
if (n < 0)
{
*h_errnop = h_errno;
*errnop = errno;
*errnop = *h_errnop == TRY_AGAIN ? EAGAIN : ENOENT;
return errno == ECONNREFUSED ? NSS_STATUS_UNAVAIL : NSS_STATUS_NOTFOUND;
}
@ -342,6 +342,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
name_ok = res_dnok;
break;
default:
*errnop = ENOENT;
return NSS_STATUS_UNAVAIL; /* XXX should be abort(); */
}
@ -356,6 +357,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (qdcount != 1)
{
*h_errnop = NO_RECOVERY;
*errnop = ENOENT;
return NSS_STATUS_UNAVAIL;
}
@ -390,6 +392,7 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
if (n >= MAXHOSTNAMELEN)
{
*h_errnop = NO_RECOVERY;
*errnop = ENOENT;
return NSS_STATUS_TRYAGAIN;
}
result->h_name = bp;
@ -660,5 +663,6 @@ getanswer_r (const querybuf *answer, int anslen, const char *qname, int qtype,
}
no_recovery:
*h_errnop = NO_RECOVERY;
*errnop = ENOENT;
return NSS_STATUS_TRYAGAIN;
}