]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
3311. [bug] Abort the zone dump if zone->db is NULL in
authorMark Andrews <marka@isc.org>
Thu, 26 Apr 2012 01:35:57 +0000 (11:35 +1000)
committerMark Andrews <marka@isc.org>
Thu, 26 Apr 2012 01:35:57 +0000 (11:35 +1000)
                        zone.c:zone_gotwritehandle. [RT #29028]

CHANGES
lib/dns/zone.c

diff --git a/CHANGES b/CHANGES
index 2622d31969c04562324e43cf22df68fbfcb84df9..82510e9b97b1269fcc770394734d27af6143bde8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+3311.  [bug]           Abort the zone dump if zone->db is NULL in
+                       zone.c:zone_gotwritehandle. [RT #29028]
+
 3310.  [test]          Increase table size for mutex profiling. [RT #28809]
 
 3309.  [bug]           resolver.c:fctx_finddone() was not threadsafe.
index 11b7cc336ec6c7b4cf145d58e625618b4bb62d1c..661f7c291647482eddcb36d927f31bc0f1f7ae94 100644 (file)
@@ -1607,12 +1607,16 @@ zone_gotwritehandle(isc_task_t *task, isc_event_t *event) {
 
        LOCK_ZONE(zone);
        ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_read);
-       dns_db_currentversion(zone->db, &version);
-       result = dns_master_dumpinc2(zone->mctx, zone->db, version,
-                                    &dns_master_style_default,
-                                    zone->masterfile, zone->task, dump_done,
-                                    zone, &zone->dctx, zone->masterformat);
-       dns_db_closeversion(zone->db, &version, ISC_FALSE);
+       if (zone->db != NULL) {
+               dns_db_currentversion(zone->db, &version);
+               result = dns_master_dumpinc2(zone->mctx, zone->db, version,
+                                            &dns_master_style_default,
+                                            zone->masterfile, zone->task,
+                                            dump_done, zone, &zone->dctx,
+                                            zone->masterformat);
+               dns_db_closeversion(zone->db, &version, ISC_FALSE);
+       } else
+               result = ISC_R_CANCELED;
        ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_read);
        UNLOCK_ZONE(zone);
        if (result != DNS_R_CONTINUE)
@@ -6541,6 +6545,14 @@ zone_unload(dns_zone_t *zone) {
 
        REQUIRE(LOCKED_ZONE(zone));
 
+       if (!DNS_ZONE_FLAG(zone, DNS_ZONEFLG_FLUSH) ||
+           !DNS_ZONE_FLAG(zone, DNS_ZONEFLG_DUMPING)) {
+               if (zone->writeio != NULL)
+                       zonemgr_cancelio(zone->writeio);
+
+               if (zone->dctx != NULL)
+                       dns_dumpctx_cancel(zone->dctx);
+       }
        ZONEDB_LOCK(&zone->dblock, isc_rwlocktype_write);
        zone_detachdb(zone);
        ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_write);