]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fixed some problems from change #3084 that turned up after committing it;
authorEvan Hunt <each@isc.org>
Mon, 21 Mar 2011 18:38:40 +0000 (18:38 +0000)
committerEvan Hunt <each@isc.org>
Mon, 21 Mar 2011 18:38:40 +0000 (18:38 +0000)
"freeze" and "thaw" weren't working quite right when used without a
specific zone name.

bin/named/server.c
bin/tests/system/rndc/tests.sh
lib/dns/include/dns/zone.h
lib/dns/zone.c
lib/dns/zt.c

index ba6afb8d087b40132e9c058f6478b05f6eb1f346..1006ca16824db9bd3e108d0103baf66d614cf494 100644 (file)
@@ -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);
        }
index 0852f202c22e25bd7f850aa1ba44435140c32454..68a7f4c3d5e4d400cfa76661e949e5f1626e69ab 100644 (file)
@@ -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
index 35ca8efaa9aab7ce509ea803ea5c998b30fc5233..2914ce4579e232e1be73e48a233a84aa23a0e8ba 100644 (file)
@@ -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.
  */
index eb5917977034bbf4f1ff4e97254f59cfc745fcd7..2b114c2984940ca0fa3c8465db4315edced33866 100644 (file)
@@ -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);
index 8b4b1abf4e3f963f22165283962014d74e2a7e0c..85b6d3852de27ed23ee147383a8cd97d0e27c49b 100644 (file)
@@ -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);