]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1941. [bug] ncache_adderesult() should set eresult even if no
authorMark Andrews <marka@isc.org>
Fri, 28 Jul 2006 04:51:18 +0000 (04:51 +0000)
committerMark Andrews <marka@isc.org>
Fri, 28 Jul 2006 04:51:18 +0000 (04:51 +0000)
                        rdataset is passed to it. [RT #15642]

CHANGES
lib/dns/resolver.c

diff --git a/CHANGES b/CHANGES
index 3c628a6839e1645fe71a38ac7e377ef2bfa86e34..5f35aeaffea4bcd537ee6e55355256cd70e64a2d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,3 @@
-
-       --- 9.2.7rc1 released ---
-
 2057.  [bug]           Make setting "ra" dependent on both allow-query and
                        allow-recursion. [RT #16290]
 
@@ -30,6 +27,8 @@
 
 2034.  [bug]           gcc: set -fno-strict-aliasing. [RT #16124]
 
+1941.  [bug]           ncache_adderesult() should set eresult even if no
+                       rdataset is passed to it. [RT #15642]
 
        --- 9.2.7b1 released ---
 
index ca0205bd569a6eaf21c9b593a9433955aa345516..421375b9ffefc0a30ce7ee008c7bef938e0ec443 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: resolver.c,v 1.218.2.45 2006/01/06 00:48:37 marka Exp $ */
+/* $Id: resolver.c,v 1.218.2.46 2006/07/28 04:51:18 marka Exp $ */
 
 #include <config.h>
 
@@ -3222,23 +3222,28 @@ ncache_adderesult(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
                  isc_result_t *eresultp)
 {
        isc_result_t result;
+       dns_rdataset_t rdataset;
+
+       if (ardataset == NULL) {
+               dns_rdataset_init(&rdataset);
+               ardataset = &rdataset;
+       }
        result = dns_ncache_add(message, cache, node, covers, now,
                                maxttl, ardataset);
-       if (result == DNS_R_UNCHANGED) {
+       if (result == DNS_R_UNCHANGED || result == ISC_R_SUCCESS) {
                /*
-                * The data in the cache is better than the negative cache
-                * entry we're trying to add.
+                * If the cache now contains a negative entry and we
+                * care about whether it is DNS_R_NCACHENXDOMAIN or
+                * DNS_R_NCACHENXRRSET then extract it.
                 */
-               if (ardataset != NULL && ardataset->type == 0) {
+               if (ardataset->type == 0) {
                        /*
-                        * The cache data is also a negative cache
-                        * entry.
+                        * The cache data is a negative cache entry.
                         */
                        if (NXDOMAIN(ardataset))
                                *eresultp = DNS_R_NCACHENXDOMAIN;
                        else
                                *eresultp = DNS_R_NCACHENXRRSET;
-                       result = ISC_R_SUCCESS;
                } else {
                        /*
                         * Either we don't care about the nature of the
@@ -3250,14 +3255,11 @@ ncache_adderesult(dns_message_t *message, dns_db_t *cache, dns_dbnode_t *node,
                         * XXXRTH  There's a CNAME/DNAME problem here.
                         */
                        *eresultp = ISC_R_SUCCESS;
-                       result = ISC_R_SUCCESS;
                }
-       } else if (result == ISC_R_SUCCESS) {
-               if (NXDOMAIN(ardataset))
-                       *eresultp = DNS_R_NCACHENXDOMAIN;
-               else
-                       *eresultp = DNS_R_NCACHENXRRSET;
+               result = ISC_R_SUCCESS;
        }
+       if (ardataset == &rdataset && dns_rdataset_isassociated(ardataset))
+               dns_rdataset_disassociate(ardataset);
 
        return (result);
 }