From f4f3f2cf3499cf6c32f6329aca08b5c557f507f1 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Wed, 10 May 2000 21:51:17 +0000 Subject: [PATCH] 167. [bug] Make lack of masters for a slave zone a soft error. --- CHANGES | 12 +++++++----- lib/dns/zone.c | 22 ++++++++++++++++++---- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index 46541b65a5..4fb010947b 100644 --- a/CHANGES +++ b/CHANGES @@ -1,8 +1,10 @@ - 166. [bug] Keygen was overwriting existing keys if key_id conflicted, - now it will retry, and non-null keys with key_id == 0 - are not generated anymore. - Key was not able to generate NOAUTHCONF DSA key, - increased RSA key size to 2048 bits. + 167. [bug] Make lack of masters for a slave zone a soft error. + + 166. [bug] Keygen was overwriting existing keys if key_id + conflicted, now it will retry, and non-null keys + with key_id == 0 are not generated anymore. Key + was not able to generate NOAUTHCONF DSA key, + increased RSA key size to 2048 bits. 165. [cleanup] Silence "end-of-loop condition not reached" warnings from Solaris compiler. diff --git a/lib/dns/zone.c b/lib/dns/zone.c index a593f5c19c..3c880f8193 100644 --- a/lib/dns/zone.c +++ b/lib/dns/zone.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: zone.c,v 1.107 2000/05/10 04:47:03 marka Exp $ */ +/* $Id: zone.c,v 1.108 2000/05/10 21:51:17 marka Exp $ */ #include @@ -189,6 +189,9 @@ struct dns_zone { * messages */ #define DNS_ZONE_F_DIFFONRELOAD 0x00000800U /* generate a journal diff on * reload */ +#define DNS_ZONE_F_NOMASTERS 0x00001000U /* an attempt to refresh a + * zone with no masters + * occured */ #define DNS_ZONE_OPTION(z,o) (((z)->options & (o)) != 0) @@ -1613,7 +1616,8 @@ dns_zone_setnotifyalso(dns_zone_t *zone, isc_sockaddr_t *notify, isc_sockaddr_t *new; REQUIRE(DNS_ZONE_VALID(zone)); - REQUIRE((notify == NULL) ^ (count != 0)); + REQUIRE((notify == NULL && count == 0) || + (notify != NULL && count != 0)); LOCK(&zone->lock); if (zone->notify != NULL) { @@ -1644,7 +1648,8 @@ dns_zone_setmasters(dns_zone_t *zone, isc_sockaddr_t *masters, isc_sockaddr_t *new; REQUIRE(DNS_ZONE_VALID(zone)); - REQUIRE((masters == NULL) ^ (count != 0)); + REQUIRE((masters == NULL && count == 0) || + (masters != NULL && count != 0)); LOCK(&zone->lock); if (zone->masters != NULL) { @@ -1663,6 +1668,7 @@ dns_zone_setmasters(dns_zone_t *zone, isc_sockaddr_t *masters, memcpy(new, masters, count * sizeof *new); zone->masters = new; zone->masterscnt = count; + zone->flags &= ~DNS_ZONE_F_NOMASTERS; unlock: UNLOCK(&zone->lock); return (ISC_R_SUCCESS); @@ -1852,7 +1858,6 @@ dns_zone_refresh(dns_zone_t *zone) { isc_uint32_t oldflags; REQUIRE(DNS_ZONE_VALID(zone)); - REQUIRE(zone->masterscnt > 0); isc_stdtime_get(&now); @@ -1863,6 +1868,14 @@ dns_zone_refresh(dns_zone_t *zone) { LOCK(&zone->lock); oldflags = zone->flags; + if (zone->masterscnt == 0) { + zone->flags |= DNS_ZONE_F_NOMASTERS; + if ((oldflags & DNS_ZONE_F_NOMASTERS) == 0) + zone_log(zone, "dns_zone_refresh", ISC_LOG_ERROR, + "no masters"); + UNLOCK(&zone->lock); + return; + } zone->flags |= DNS_ZONE_F_REFRESH; UNLOCK(&zone->lock); if ((oldflags & DNS_ZONE_F_REFRESH) != 0) @@ -2761,6 +2774,7 @@ zone_settimer(dns_zone_t *zone, isc_stdtime_t now) { next = now; case dns_zone_stub: if (!DNS_ZONE_FLAG(zone, DNS_ZONE_F_REFRESH) && + !DNS_ZONE_FLAG(zone, DNS_ZONE_F_NOMASTERS) && (zone->refreshtime < next || next == 0)) next = zone->refreshtime; if (DNS_ZONE_FLAG(zone, DNS_ZONE_F_LOADED)) {