]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
checkpoint
authorMark Andrews <marka@isc.org>
Fri, 31 Mar 2006 00:12:24 +0000 (00:12 +0000)
committerMark Andrews <marka@isc.org>
Fri, 31 Mar 2006 00:12:24 +0000 (00:12 +0000)
lib/dns/resolver.c

index 6f803eb192f4eb0841292f20a656c27dc46ed6ce..12c68d2c4c0c04d3fcabdd8eae9fca0fdae3b86a 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: resolver.c,v 1.218.2.18.4.56 2005/10/14 01:38:48 marka Exp $ */
+/* $Id: resolver.c,v 1.218.2.18.4.56.2.1 2006/03/31 00:12:24 marka Exp $ */
 
 #include <config.h>
 
@@ -3763,23 +3763,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 are 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
@@ -3791,14 +3796,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);
 }