mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
1753. [bug] Don't serve a slave zone which has no NS records.
[RT #12894]
This commit is contained in:
3
CHANGES
3
CHANGES
@@ -1,3 +1,6 @@
|
||||
1753. [bug] Don't serve a slave zone which has no NS records.
|
||||
[RT #12894]
|
||||
|
||||
1752. [port] Move isc_app_start() to after ns_os_daemonise()
|
||||
as some fork() implementations unblock the signals
|
||||
that are blocked by isc_app_start(). [RT #12810]
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: zone.h,v 1.126 2004/03/05 05:09:47 marka Exp $ */
|
||||
/* $Id: zone.h,v 1.127 2004/10/26 02:01:19 marka Exp $ */
|
||||
|
||||
#ifndef DNS_ZONE_H
|
||||
#define DNS_ZONE_H 1
|
||||
@@ -971,6 +971,13 @@ dns_zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump);
|
||||
*
|
||||
* Requires:
|
||||
* 'zone' to be a valid zone.
|
||||
*
|
||||
* Returns:
|
||||
* DNS_R_SUCCESS
|
||||
* DNS_R_BADZONE zone failed basic consistancy checks:
|
||||
* * a single SOA must exist
|
||||
* * some NS records must exist.
|
||||
* Others
|
||||
*/
|
||||
|
||||
isc_uint32_t
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: zone.c,v 1.421 2004/10/06 05:56:29 marka Exp $ */
|
||||
/* $Id: zone.c,v 1.422 2004/10/26 02:01:19 marka Exp $ */
|
||||
|
||||
#include <config.h>
|
||||
|
||||
@@ -2200,7 +2200,6 @@ zone_expire(dns_zone_t *zone) {
|
||||
zone->refresh = DNS_ZONE_DEFAULTREFRESH;
|
||||
zone->retry = DNS_ZONE_DEFAULTRETRY;
|
||||
DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_HAVETIMERS);
|
||||
DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NEEDDUMP);
|
||||
zone_unload(zone);
|
||||
}
|
||||
|
||||
@@ -2555,6 +2554,7 @@ zone_unload(dns_zone_t *zone) {
|
||||
|
||||
dns_db_detach(&zone->db);
|
||||
DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_LOADED);
|
||||
DNS_ZONE_CLRFLAG(zone, DNS_ZONEFLG_NEEDDUMP);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -5213,6 +5213,8 @@ static isc_result_t
|
||||
zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) {
|
||||
dns_dbversion_t *ver;
|
||||
isc_result_t result;
|
||||
unsigned int soacount = 0;
|
||||
unsigned int nscount = 0;
|
||||
|
||||
/*
|
||||
* 'zone' locked by caller.
|
||||
@@ -5220,6 +5222,22 @@ zone_replacedb(dns_zone_t *zone, dns_db_t *db, isc_boolean_t dump) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
REQUIRE(LOCKED_ZONE(zone));
|
||||
|
||||
result = zone_get_from_db(db, &zone->origin, &nscount, &soacount,
|
||||
NULL, NULL, NULL, NULL, NULL);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
if (soacount != 1) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"has %d SOA records", soacount);
|
||||
result = DNS_R_BADZONE;
|
||||
}
|
||||
if (nscount == 0) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR, "has no NS records");
|
||||
result = DNS_R_BADZONE;
|
||||
}
|
||||
}
|
||||
if (result != ISC_R_SUCCESS)
|
||||
return (result);
|
||||
|
||||
ver = NULL;
|
||||
dns_db_currentversion(db, &ver);
|
||||
|
||||
@@ -5369,10 +5387,19 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
|
||||
"transferred zone "
|
||||
"has %d SOA record%s", soacount,
|
||||
(soacount != 0) ? "s" : "");
|
||||
if (nscount == 0)
|
||||
if (nscount == 0) {
|
||||
dns_zone_log(zone, ISC_LOG_ERROR,
|
||||
"transferred zone "
|
||||
"has no NS records");
|
||||
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;
|
||||
}
|
||||
zone->serial = serial;
|
||||
zone->refresh = RANGE(refresh, zone->minrefresh,
|
||||
zone->maxrefresh);
|
||||
@@ -5447,6 +5474,7 @@ zone_xfrdone(dns_zone_t *zone, isc_result_t result) {
|
||||
goto same_master;
|
||||
|
||||
default:
|
||||
next_master:
|
||||
zone->curmaster++;
|
||||
same_master:
|
||||
if (zone->curmaster >= zone->masterscnt) {
|
||||
|
Reference in New Issue
Block a user