1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-05 09:14:03 +00:00

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
This commit is contained in:
Hajimu UMEMOTO 2015-12-21 11:24:14 +00:00
parent c094330345
commit e85324c92f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=292539

View File

@ -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;