diff --git a/CHANGES b/CHANGES index fbd65581b0..973037a00d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ + 413. [bug] notify could attempt to use the zone database after + it had been unloaded. (RT#267) 412. [bug] named -v didn't print the version. diff --git a/lib/dns/zone.c b/lib/dns/zone.c index f1db5b425e..c1e04b5be3 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: zone.c,v 1.199 2000/08/31 00:31:38 marka Exp $ */ +/* $Id: zone.c,v 1.200 2000/08/31 06:16:42 marka Exp $ */ #include @@ -276,6 +276,7 @@ static void ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub); static int message_count(dns_message_t *msg, dns_section_t section, dns_rdatatype_t type); +static void notify_cancel(dns_zone_t *zone); static void notify_find_address(dns_notify_t *notify); static void notify_send(dns_notify_t *notify); #ifdef NOMINUM_PUBLIC @@ -1535,6 +1536,7 @@ zone_expire(dns_zone_t *zone) { */ REQUIRE(ISLOCKED(&zone->lock)); + zone_log(zone, "zone_expire", ISC_LOG_WARNING, "expired"); if (DNS_ZONE_FLAG(zone, DNS_ZONEFLG_NEEDDUMP)) { result = zone_dump(zone); @@ -1690,6 +1692,24 @@ dns_zone_unload(dns_zone_t *zone) { UNLOCK(&zone->lock); } +static void +notify_cancel(dns_zone_t *zone) { + dns_notify_t *notify; + + /* + * Locked by caller. + */ + + for (notify = ISC_LIST_HEAD(zone->notifies); + notify != NULL; + notify = ISC_LIST_NEXT(notify, link)) { + if (notify->find != NULL) + dns_adb_cancelfind(notify->find); + if (notify->request != NULL) + dns_request_cancel(notify->request); + } +} + static void zone_unload(dns_zone_t *zone) { @@ -1984,7 +2004,8 @@ notify_send_toaddr(isc_task_t *task, isc_event_t *event) { if ((event->ev_attributes & ISC_EVENTATTR_CANCELED) != 0 || DNS_ZONE_FLAG(notify->zone, DNS_ZONEFLG_EXITING) || - zone->view->requestmgr == NULL) { + zone->view->requestmgr == NULL || + zone->db == NULL) { result = ISC_R_CANCELED; goto cleanup; } @@ -3061,7 +3082,6 @@ ns_query(dns_zone_t *zone, dns_rdataset_t *soardataset, dns_stub_t *stub) { static void zone_shutdown(isc_task_t *task, isc_event_t *event) { dns_zone_t *zone = (dns_zone_t *) event->ev_arg; - dns_notify_t *notify; isc_result_t result; UNUSED(task); @@ -3091,14 +3111,7 @@ zone_shutdown(isc_task_t *task, isc_event_t *event) { if (zone->request != NULL) dns_request_cancel(zone->request); - for (notify = ISC_LIST_HEAD(zone->notifies); - notify != NULL; - notify = ISC_LIST_NEXT(notify, link)) { - if (notify->find != NULL) - dns_adb_cancelfind(notify->find); - if (notify->request != NULL) - dns_request_cancel(notify->request); - } + notify_cancel(zone); if (zone->timer != NULL) { result = isc_timer_reset(zone->timer, isc_timertype_inactive,