]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2928. [bug] Be more selective about the non-authoritative
authorMark Andrews <marka@isc.org>
Sun, 4 Jul 2010 00:48:57 +0000 (00:48 +0000)
committerMark Andrews <marka@isc.org>
Sun, 4 Jul 2010 00:48:57 +0000 (00:48 +0000)
                        answer we apply change 2748 to. [RT #21594]

CHANGES
lib/dns/resolver.c

diff --git a/CHANGES b/CHANGES
index 4f135cfbf6511f1cf71192bf7618f5eb09e9e780..f88798aec4065a8f2ed9905459cf63cfc6e1a627 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+2928.  [bug]           Be more selective about the non-authoritative
+                       answer we apply change 2748 to. [RT #21594]
+
 2927.  [placeholder]
 
 2926.  [placeholder]
index 1d07975eb84d9de760ad86d584b6358175fe3823..f14b713abc97b51041962382e64135f5ae5d4ad5 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: resolver.c,v 1.423 2010/06/23 23:46:58 tbox Exp $ */
+/* $Id: resolver.c,v 1.424 2010/07/04 00:48:57 marka Exp $ */
 
 /*! \file */
 
@@ -5628,7 +5628,7 @@ noanswer_response(fetchctx_t *fctx, dns_name_t *oqname,
                 * trying other servers.
                 */
                if (dns_name_equal(ns_name, &fctx->domain)) {
-                       log_formerr(fctx, "sideways referral");
+                       log_formerr(fctx, "non-improving referral");
                        return (DNS_R_FORMERR);
                }
 
@@ -6450,6 +6450,29 @@ iscname(fetchctx_t *fctx) {
        return (result == ISC_R_SUCCESS ? ISC_TRUE : ISC_FALSE);
 }
 
+static isc_boolean_t
+betterreferral(fetchctx_t *fctx) {
+       isc_result_t result;
+       dns_name_t *name;
+       dns_rdataset_t *rdataset;
+       dns_message_t *message = fctx->rmessage;
+
+       for (result = dns_message_firstname(message, DNS_SECTION_AUTHORITY);
+            result == ISC_R_SUCCESS;
+            result = dns_message_nextname(message, DNS_SECTION_AUTHORITY)) {
+               name = NULL;
+               dns_message_currentname(message, DNS_SECTION_AUTHORITY, &name);
+               if (!dns_name_issubdomain(name, &fctx->domain))
+                       continue;
+               for (rdataset = ISC_LIST_HEAD(name->list);
+                    rdataset != NULL;
+                    rdataset = ISC_LIST_NEXT(rdataset, link))
+                       if (rdataset->type == dns_rdatatype_ns)
+                               return (ISC_TRUE);
+       }
+       return (ISC_FALSE);
+}
+
 static void
 resquery_response(isc_task_t *task, isc_event_t *event) {
        isc_result_t result = ISC_R_SUCCESS;
@@ -6929,6 +6952,12 @@ resquery_response(isc_task_t *task, isc_event_t *event) {
                         * it as a valid answer.
                         */
                        result = answer_response(fctx);
+               } else if (fctx->type != dns_rdatatype_ns &&
+                          !betterreferral(fctx)) {
+                       /*
+                        * Lame response !!!.
+                        */
+                       result = answer_response(fctx);
                } else {
                        if (fctx->type == dns_rdatatype_ns) {
                                /*