Author: ume
Date: Mon Dec 21 11:24:14 2015
New Revision: 292539
URL: https://svnweb.freebsd.org/changeset/base/292539

Log:
  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

Modified:
  head/lib/libc/net/getaddrinfo.c

Modified: head/lib/libc/net/getaddrinfo.c
==============================================================================
--- head/lib/libc/net/getaddrinfo.c     Mon Dec 21 11:03:12 2015        
(r292538)
+++ head/lib/libc/net/getaddrinfo.c     Mon Dec 21 11:24:14 2015        
(r292539)
@@ -2164,7 +2164,11 @@ getanswer(const querybuf *answer, int an
                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
        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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to