From a7705f38e91cc6afaba0426f6b452c9ae5a4efea Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Fri, 18 Aug 2000 22:51:36 +0000 Subject: [PATCH] 399. [bug] When reloading the server with a config file containing a syntax error, it could catch an assertion failure trying to perform zone maintenance on, or sending notifies from, tentatively created zones whose views were never fully configured and lacked an address database and request manager. --- CHANGES | 8 ++++++++ lib/dns/zone.c | 26 +++++++++++++++++--------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index 7253fea4fb..7d347e5b40 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,12 @@ + 399. [bug] When reloading the server with a config file + containing a syntax error, it could catch an + assertion failure trying to perform zone + maintenance on, or sending notifies from, + tentatively created zones whose views were + never fully configured and lacked an address + database and request manager. + 398. [bug] "dig" sometimes caught an assertion failure when using TSIG, depending on the key length. diff --git a/lib/dns/zone.c b/lib/dns/zone.c index b9e18e3c58..d8a501abdd 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.189 2000/08/18 02:34:29 bwelling Exp $ */ +/* $Id: zone.c,v 1.190 2000/08/18 22:51:36 gson Exp $ */ #include @@ -1894,6 +1894,10 @@ notify_find_address(dns_notify_t *notify) { DNS_ADBFIND_INET6 | DNS_ADBFIND_RETURNLAME; dns_zone_iattach(notify->zone, &zone); + + if (zone->view->adb == NULL) + goto destroy; + result = dns_adb_createfind(zone->view->adb, zone->task, process_adb_event, notify, @@ -1902,12 +1906,8 @@ notify_find_address(dns_notify_t *notify) { ¬ify->find); /* Something failed? */ - if (result != ISC_R_SUCCESS) { - LOCK(&zone->lock); - notify_destroy(notify); - UNLOCK(&zone->lock); - goto detach; - } + if (result != ISC_R_SUCCESS) + goto destroy; /* More addresses pending? */ if ((notify->find->options & DNS_ADBFIND_WANTEVENT) != 0) @@ -1917,6 +1917,12 @@ notify_find_address(dns_notify_t *notify) { LOCK(&zone->lock); notify_send(notify); UNLOCK(&zone->lock); + goto detach; + + destroy: + LOCK(&zone->lock); + notify_destroy(notify); + UNLOCK(&zone->lock); detach: dns_zone_idetach(&zone); } @@ -1966,7 +1972,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)) { + DNS_ZONE_FLAG(notify->zone, DNS_ZONEFLG_EXITING) || + zone->view->requestmgr == NULL) { result = ISC_R_CANCELED; goto cleanup; } @@ -2861,7 +2868,8 @@ soa_query(isc_task_t *task, isc_event_t *event) { DNS_ENTER; if (((event->ev_attributes & ISC_EVENTATTR_CANCELED) != 0) || - DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING)) { + DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING) || + zone->view->requestmgr == NULL) { if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_EXITING)) cancel_refresh(zone); isc_event_free(&event);