2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-04 00:25:29 +00:00

1450. [bug] Fetching expired glue failed under certian

circumstances.  [RT #5124]
developer: marka
reviewer: explorer
This commit is contained in:
Mark Andrews
2003-02-27 02:20:15 +00:00
parent 0c2509b0b9
commit 6bd8cee983
2 changed files with 27 additions and 14 deletions

View File

@@ -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 1449. [bug] query_addbestns() didn't handle running out of memory
gracefully. gracefully.

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * 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 * Implementation notes
@@ -476,6 +476,7 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
isc_result_t result; isc_result_t result;
dns_adb_t *adb; dns_adb_t *adb;
dns_adbnamehook_t *nh; dns_adbnamehook_t *nh;
dns_adbnamehook_t *anh;
dns_rdata_t rdata = DNS_RDATA_INIT; dns_rdata_t rdata = DNS_RDATA_INIT;
struct in_addr ina; struct in_addr ina;
struct in6_addr in6a; struct in6_addr in6a;
@@ -541,17 +542,26 @@ import_rdataset(dns_adbname_t *adbname, dns_rdataset_t *rdataset,
link_entry(adb, addr_bucket, entry); link_entry(adb, addr_bucket, entry);
} else { } else {
foundentry->refcnt++; for (anh = ISC_LIST_HEAD(adbname->v4);
nh->entry = foundentry; 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; new_addresses_added = ISC_TRUE;
if (rdtype == dns_rdatatype_a) if (nh != NULL) {
ISC_LIST_APPEND(adbname->v4, nh, plink); if (rdtype == dns_rdatatype_a)
else ISC_LIST_APPEND(adbname->v4, nh, plink);
ISC_LIST_APPEND(adbname->v6, nh, plink); else
ISC_LIST_APPEND(adbname->v6, nh, plink);
}
nh = NULL; nh = NULL;
result = dns_rdataset_next(rdataset); 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 * start fetches. First try looking for an A record
* in the database. * in the database.
*/ */
if (!NAME_HAS_V4(adbname) && !NAME_FETCH_V4(adbname) if (!NAME_HAS_V4(adbname) && EXPIRE_OK(adbname->expire_v4, now)
&& EXPIRE_OK(adbname->expire_v4, now)
&& WANT_INET(wanted_addresses)) { && WANT_INET(wanted_addresses)) {
result = dbfind_name(adbname, now, dns_rdatatype_a); result = dbfind_name(adbname, now, dns_rdatatype_a);
if (result == ISC_R_SUCCESS) { 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)) else if (NXRRSET_RESULT(result))
goto v6; goto v6;
wanted_fetches |= DNS_ADBFIND_INET; if (!NAME_FETCH_V4(adbname))
wanted_fetches |= DNS_ADBFIND_INET;
} }
v6: v6:
if (!NAME_HAS_V6(adbname) && !NAME_FETCH_V6(adbname) if (!NAME_HAS_V6(adbname) && EXPIRE_OK(adbname->expire_v6, now)
&& EXPIRE_OK(adbname->expire_v6, now)
&& WANT_INET6(wanted_addresses)) { && WANT_INET6(wanted_addresses)) {
result = dbfind_name(adbname, now, dns_rdatatype_aaaa); result = dbfind_name(adbname, now, dns_rdatatype_aaaa);
if (result == ISC_R_SUCCESS) { 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)) if (NCACHE_RESULT(result) || AUTH_NX(result))
goto fetch; goto fetch;
wanted_fetches |= DNS_ADBFIND_INET6; if (!NAME_FETCH_V6(adbname))
wanted_fetches |= DNS_ADBFIND_INET6;
} }
fetch: fetch: