Commit 1063914c authored by Evan Hunt's avatar Evan Hunt
Browse files

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.
parent 39876b78
......@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.c,v 1.610 2011/03/21 15:39:05 each Exp $ */
/* $Id: server.c,v 1.611 2011/03/21 18:38:39 each Exp $ */
/*! \file */
......@@ -7127,7 +7127,7 @@ ns_server_freeze(ns_server_t *server, isc_boolean_t freeze, char *args,
return (DNS_R_NOTMASTER);
}
if (freeze && !dns_zone_isdynamic(zone)) {
if (freeze && !dns_zone_isdynamic(zone, ISC_TRUE)) {
dns_zone_detach(&zone);
return (DNS_R_NOTDYNAMIC);
}
......
......@@ -14,7 +14,7 @@
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
# $Id: tests.sh,v 1.2 2011/03/21 18:06:06 each Exp $
# $Id: tests.sh,v 1.3 2011/03/21 18:38:40 each Exp $
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
......@@ -42,7 +42,7 @@ if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:rndc freeze"
$RNDCCMD freeze nil | sed 's/^/I:ns2 /'
$RNDCCMD freeze | sed 's/^/I:ns2 /'
echo "I:checking zone was dumped"
ret=0
......@@ -70,7 +70,7 @@ if [ $ret != 0 ]; then echo "I:failed"; fi
status=`expr $status + $ret`
echo "I:rndc thaw"
$RNDCCMD thaw nil | sed 's/^/I:ns2 /'
$RNDCCMD thaw | sed 's/^/I:ns2 /'
echo "I:checking zone now writable"
ret=0
......
......@@ -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.
*/
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment