From 98e3a0ddfe89ece6f510205d46a62c718de6c8f0 Mon Sep 17 00:00:00 2001 From: ume Date: Mon, 28 Dec 2015 03:26:16 +0000 Subject: MFC r292539: If we end up following a CNAME chain that does not find any data return that instead of internal error. PR: 156684 --- lib/libc/net/getaddrinfo.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'lib/libc/net/getaddrinfo.c') diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c index 4d1972d..4733e51 100644 --- a/lib/libc/net/getaddrinfo.c +++ b/lib/libc/net/getaddrinfo.c @@ -2166,7 +2166,11 @@ getanswer(const querybuf *answer, int anslen, const char *qname, int qtype, return sentinel.ai_next; } - RES_SET_H_ERRNO(res, NO_RECOVERY); + /* + * We could have walked a CNAME chain, but the ultimate target + * may not have what we looked for. + */ + RES_SET_H_ERRNO(res, ntohs(hp->ancount) > 0 ? NO_DATA : NO_RECOVERY); return NULL; } @@ -2343,6 +2347,7 @@ _dns_getaddrinfo(void *rv, void *cb_data, va_list ap) if (sentinel.ai_next == NULL) switch (res->res_h_errno) { case HOST_NOT_FOUND: + case NO_DATA: return NS_NOTFOUND; case TRY_AGAIN: return NS_TRYAGAIN; -- cgit v1.1