summaryrefslogtreecommitdiffstats
path: root/lib/libc/net
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2015-12-21 11:24:14 +0000
committerume <ume@FreeBSD.org>2015-12-21 11:24:14 +0000
commit17cf2dee7c4e8009b175da82f34d607b8097696b (patch)
tree47c7af7bbb59d9d0777714d937453e686f783fa4 /lib/libc/net
parent377b186b53b657284ee23b5e3996ed579d67fb9e (diff)
downloadFreeBSD-src-17cf2dee7c4e8009b175da82f34d607b8097696b.zip
FreeBSD-src-17cf2dee7c4e8009b175da82f34d607b8097696b.tar.gz
If we end up following a CNAME chain that does not find
any data return that instead of internal error. PR: 156684 Obtained from: NetBSD MFC after: 1 week
Diffstat (limited to 'lib/libc/net')
-rw-r--r--lib/libc/net/getaddrinfo.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libc/net/getaddrinfo.c b/lib/libc/net/getaddrinfo.c
index ed1a388..e2eb1a0 100644
--- a/lib/libc/net/getaddrinfo.c
+++ b/lib/libc/net/getaddrinfo.c
@@ -2164,7 +2164,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;
}
@@ -2341,6 +2345,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;
OpenPOWER on IntegriCloud