Fixed some problems from change #3084 that turned up after committing it;
"freeze" and "thaw" weren't working quite right when used without a specific zone name.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: zone.h,v 1.185 2011/03/21 07:22:14 each Exp $ */
|
||||
/* $Id: zone.h,v 1.186 2011/03/21 18:38:40 each Exp $ */
|
||||
|
||||
#ifndef DNS_ZONE_H
|
||||
#define DNS_ZONE_H 1
|
||||
@@ -1854,7 +1854,7 @@ dns_zone_dlzpostload(dns_zone_t *zone, dns_db_t *db);
|
||||
*/
|
||||
|
||||
isc_boolean_t
|
||||
dns_zone_isdynamic(dns_zone_t *zone);
|
||||
dns_zone_isdynamic(dns_zone_t *zone, isc_boolean_t ignore_freeze);
|
||||
/*%
|
||||
* Return true iff the zone is "dynamic", in the sense that the zone's
|
||||
* master file (if any) is written by the server, rather than being
|
||||
@@ -1864,6 +1864,9 @@ dns_zone_isdynamic(dns_zone_t *zone);
|
||||
* allow dynamic updates either by having an update policy ("ssutable")
|
||||
* or an "allow-update" ACL with a value other than exactly "{ none; }".
|
||||
*
|
||||
* If 'ignore_freeze' is true, then the zone which has had updates disabled
|
||||
* will still report itself to be dynamic.
|
||||
*
|
||||
* Requires:
|
||||
* \li 'zone' to be valid.
|
||||
*/
|
||||
|
||||
+18
-12
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: zone.c,v 1.599 2011/03/21 07:22:13 each Exp $ */
|
||||
/* $Id: zone.c,v 1.600 2011/03/21 18:38:40 each Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -1368,17 +1368,23 @@ dns_zone_getjournal(dns_zone_t *zone) {
|
||||
* or an "allow-update" ACL with a value other than exactly "{ none; }".
|
||||
*/
|
||||
isc_boolean_t
|
||||
dns_zone_isdynamic(dns_zone_t *zone) {
|
||||
dns_zone_isdynamic(dns_zone_t *zone, isc_boolean_t ignore_freeze) {
|
||||
REQUIRE(DNS_ZONE_VALID(zone));
|
||||
|
||||
return (ISC_TF(zone->type == dns_zone_slave ||
|
||||
zone->type == dns_zone_stub ||
|
||||
zone->type == dns_zone_key ||
|
||||
(zone->type == dns_zone_redirect &&
|
||||
zone->masters != NULL) ||
|
||||
(!zone->update_disabled && zone->ssutable != NULL) ||
|
||||
(!zone->update_disabled && zone->update_acl != NULL &&
|
||||
!dns_acl_isnone(zone->update_acl))));
|
||||
if (zone->type == dns_zone_slave || zone->type == dns_zone_stub ||
|
||||
zone->type == dns_zone_key ||
|
||||
(zone->type == dns_zone_redirect && zone->masters != NULL))
|
||||
return (ISC_TRUE);
|
||||
|
||||
/* If !ignore_freeze, we need check whether updates are disabled. */
|
||||
if (zone->type == dns_zone_master &&
|
||||
(!zone->update_disabled || ignore_freeze) &&
|
||||
((zone->ssutable != NULL) ||
|
||||
(zone->update_acl != NULL && !dns_acl_isnone(zone->update_acl))))
|
||||
return (ISC_TRUE);
|
||||
|
||||
return (ISC_FALSE);
|
||||
|
||||
}
|
||||
|
||||
static isc_result_t
|
||||
@@ -1417,7 +1423,7 @@ zone_load(dns_zone_t *zone, unsigned int flags) {
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (zone->db != NULL && dns_zone_isdynamic(zone)) {
|
||||
if (zone->db != NULL && dns_zone_isdynamic(zone, ISC_FALSE)) {
|
||||
/*
|
||||
* This is a slave, stub, or dynamically updated
|
||||
* zone being reloaded. Do nothing - the database
|
||||
@@ -2601,7 +2607,7 @@ check_nsec3param(dns_zone_t *zone, dns_db_t *db) {
|
||||
isc_result_t result;
|
||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||
isc_boolean_t dynamic = (zone->type == dns_zone_master) ?
|
||||
dns_zone_isdynamic(zone) : ISC_FALSE;
|
||||
dns_zone_isdynamic(zone, ISC_FALSE) : ISC_FALSE;
|
||||
|
||||
dns_rdataset_init(&rdataset);
|
||||
result = dns_db_findnode(db, &zone->origin, ISC_FALSE, &node);
|
||||
|
||||
+2
-8
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: zt.c,v 1.48 2011/03/21 07:22:14 each Exp $ */
|
||||
/* $Id: zt.c,v 1.49 2011/03/21 18:38:40 each Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -292,14 +292,13 @@ freezezones(dns_zone_t *zone, void *uap) {
|
||||
char classstr[DNS_RDATACLASS_FORMATSIZE];
|
||||
char zonename[DNS_NAME_FORMATSIZE];
|
||||
dns_view_t *view;
|
||||
char *journal;
|
||||
const char *vname;
|
||||
const char *sep;
|
||||
int level;
|
||||
|
||||
if (dns_zone_gettype(zone) != dns_zone_master)
|
||||
return (ISC_R_SUCCESS);
|
||||
if (!dns_zone_isdynamic(zone))
|
||||
if (!dns_zone_isdynamic(zone, ISC_TRUE))
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
frozen = dns_zone_getupdatedisabled(zone);
|
||||
@@ -308,11 +307,6 @@ freezezones(dns_zone_t *zone, void *uap) {
|
||||
result = DNS_R_FROZEN;
|
||||
if (result == ISC_R_SUCCESS)
|
||||
result = dns_zone_flush(zone);
|
||||
if (result == ISC_R_SUCCESS) {
|
||||
journal = dns_zone_getjournal(zone);
|
||||
if (journal != NULL)
|
||||
(void)isc_file_remove(journal);
|
||||
}
|
||||
} else {
|
||||
if (frozen) {
|
||||
result = dns_zone_load(zone);
|
||||
|
||||
Reference in New Issue
Block a user