]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Unload a zone if a transfer breaks its SOA record
authorMark Andrews <marka@isc.org>
Thu, 25 Feb 2021 03:11:05 +0000 (14:11 +1100)
committerMichał Kępień <michal@isc.org>
Thu, 29 Apr 2021 09:56:03 +0000 (11:56 +0200)
If a zone transfer results in a zone not having any NS records, named
stops serving it because such a zone is broken.  Do the same if an
incoming zone transfer results in a zone lacking an SOA record at the
apex or containing more than one SOA record.

lib/dns/zone.c

index 9866f8518422e71cf72bbc28d5612ebb8a6b803a..0797d004ae9901a4513cfeaf751ab2f2bcd80ad9 100644 (file)
@@ -15987,11 +15987,20 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
                                          &retry, &expire, &minimum, NULL);
                ZONEDB_UNLOCK(&zone->dblock, isc_rwlocktype_read);
                if (result == ISC_R_SUCCESS) {
-                       if (soacount != 1)
+                       if (soacount != 1) {
                                dns_zone_log(zone, ISC_LOG_ERROR,
                                             "transferred zone "
-                                            "has %d SOA record%s", soacount,
-                                            (soacount != 0) ? "s" : "");
+                                            "has %d SOA records",
+                                            soacount);
+                               if (DNS_ZONE_FLAG(zone,
+                                                 DNS_ZONEFLG_HAVETIMERS)) {
+                                       zone->refresh = DNS_ZONE_DEFAULTREFRESH;
+                                       zone->retry = DNS_ZONE_DEFAULTRETRY;
+                               }
+                               DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_HAVETIMERS);
+                               zone_unload(zone);
+                               goto next_master;
+                       }
                        if (nscount == 0) {
                                dns_zone_log(zone, ISC_LOG_ERROR,
                                             "transferred zone "