]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
1450. [bug] Fetching expired glue failed under certian
authorMark Andrews <marka@isc.org>
Thu, 27 Feb 2003 02:20:15 +0000 (02:20 +0000)
committerMark Andrews <marka@isc.org>
Thu, 27 Feb 2003 02:20:15 +0000 (02:20 +0000)
                        circumstances.  [RT #5124]
developer: marka
reviewer: explorer

CHANGES
lib/dns/adb.c

diff --git a/CHANGES b/CHANGES
index ebdda8040ab69e811ae7c51f6774be64796a7349..edb2918fda0e149c868f21daf3a2a7d22b4be18e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+1450.  [bug]           Fetching expired glue failed under certian
+                       circumstances.  [RT #5124]
+
 1449.  [bug]           query_addbestns() didn't handle running out of memory
                        gracefully.
 
index a91a4105b84c7360a2d6d6e0e9d66aa1af20fb4c..539c535ee6262e2aac00406b9c3bc42154bd75e9 100644 (file)
@@ -15,7 +15,7 @@
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: adb.c,v 1.202 2003/02/26 22:54:28 marka Exp $ */
+/* $Id: adb.c,v 1.203 2003/02/27 02:20:15 marka Exp $ */
 
 /*
  * Implementation notes
@@ -476,6 +476,7 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
        isc_result_t result;
        dns_adb_t *adb;
        dns_adbnamehook_t *nh;
+       dns_adbnamehook_t *anh;
        dns_rdata_t rdata = DNS_RDATA_INIT;
        struct in_addr ina;
        struct in6_addr in6a;
@@ -541,17 +542,26 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
 
                        link_entry(adb, addr_bucket, entry);
                } else {
-                       foundentry->refcnt++;
-                       nh->entry = foundentry;
+                       for (anh = ISC_LIST_HEAD(adbname->v4);
+                            anh != NULL;
+                            anh = ISC_LIST_NEXT(anh, plink))
+                               if (anh->entry == foundentry)
+                                       break;
+                       if (anh == NULL) {
+                               foundentry->refcnt++;
+                               nh->entry = foundentry;
+                       } else
+                               free_adbnamehook(adb, &nh);
                }
 
                new_addresses_added = ISC_TRUE;
-               if (rdtype == dns_rdatatype_a)
-                       ISC_LIST_APPEND(adbname->v4, nh, plink);
-               else
-                       ISC_LIST_APPEND(adbname->v6, nh, plink);
+               if (nh != NULL) {
+                       if (rdtype == dns_rdatatype_a)
+                               ISC_LIST_APPEND(adbname->v4, nh, plink);
+                       else
+                               ISC_LIST_APPEND(adbname->v6, nh, plink);
+               }
                nh = NULL;
-
                result = dns_rdataset_next(rdataset);
        }
 
@@ -2380,8 +2390,7 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
         * start fetches.  First try looking for an A record
         * in the database.
         */
-       if (!NAME_HAS_V4(adbname) && !NAME_FETCH_V4(adbname)
-           && EXPIRE_OK(adbname->expire_v4, now)
+       if (!NAME_HAS_V4(adbname) && EXPIRE_OK(adbname->expire_v4, now)
            && WANT_INET(wanted_addresses)) {
                result = dbfind_name(adbname, now, dns_rdatatype_a);
                if (result == ISC_R_SUCCESS) {
@@ -2416,12 +2425,12 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
                else if (NXRRSET_RESULT(result))
                        goto v6;
 
-               wanted_fetches |= DNS_ADBFIND_INET;
+               if (!NAME_FETCH_V4(adbname))
+                       wanted_fetches |= DNS_ADBFIND_INET;
        }
 
  v6:
-       if (!NAME_HAS_V6(adbname) && !NAME_FETCH_V6(adbname)
-           && EXPIRE_OK(adbname->expire_v6, now)
+       if (!NAME_HAS_V6(adbname) && EXPIRE_OK(adbname->expire_v6, now)
            && WANT_INET6(wanted_addresses)) {
                result = dbfind_name(adbname, now, dns_rdatatype_aaaa);
                if (result == ISC_R_SUCCESS) {
@@ -2449,7 +2458,8 @@ dns_adb_createfind(dns_adb_t *adb, isc_task_t *task, isc_taskaction_t action,
                if (NCACHE_RESULT(result) || AUTH_NX(result))
                        goto fetch;
 
-               wanted_fetches |= DNS_ADBFIND_INET6;
+               if (!NAME_FETCH_V6(adbname))
+                       wanted_fetches |= DNS_ADBFIND_INET6;
        }
 
  fetch: