]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
[master] disallow delzone on policiy zones
authorEvan Hunt <each@isc.org>
Mon, 1 Feb 2016 17:33:14 +0000 (09:33 -0800)
committerEvan Hunt <each@isc.org>
Mon, 1 Feb 2016 17:49:49 +0000 (09:49 -0800)
4311. [bug] Prevent "rndc delzone" from being used on
response-policy zones. [RT #41593]

CHANGES
bin/named/server.c
bin/tests/system/addzone/ns2/named2.conf
bin/tests/system/addzone/tests.sh

diff --git a/CHANGES b/CHANGES
index 276391de9747dd95195d597f2c13142899bc42d0..689d283673bec7cc461c4a86b9cb0d738699b031 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+4311.  [bug]           Prevent "rndc delzone" from being used on
+                       response-policy zones. [RT #41593]
+
 4310.  [performance]   Use __builtin_expect() where available to annotate
                        conditions with known behavior. [RT #41411]
 
index 3d38b4edbcd12aca71afd5322c4aa533ec72ef09..e5954aa0fc945c61612dca2b48d7df53f8216c31 100644 (file)
@@ -10211,6 +10211,16 @@ ns_server_delzone(ns_server_t *server, isc_lex_t *lex, isc_buffer_t **text) {
 
        INSIST(zonename != NULL);
 
+       /* Is this a policy zone? */
+       if (dns_zone_get_rpz_num(zone) != DNS_RPZ_INVALID_NUM) {
+               TCHECK(putstr(text, "zone '"));
+               TCHECK(putstr(text, zonename));
+               TCHECK(putstr(text,
+                             "' cannot be deleted: response-policy zone."));
+               result = ISC_R_FAILURE;
+               goto cleanup;
+       }
+
        result = isc_task_beginexclusive(server->task);
        RUNTIME_CHECK(result == ISC_R_SUCCESS);
        exclusive = ISC_TRUE;
index 2669aa08560db939f11db0cbbc9311396c1b29a7..6d52f14f1d20e769bcfa0d2913d40474c0383a50 100644 (file)
@@ -14,8 +14,6 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: named2.conf,v 1.5 2011/06/17 23:47:49 tbox Exp $ */
-
 controls { /* empty */ };
 
 include "../../common/controls.conf";
@@ -33,10 +31,17 @@ view internal {
        allow-new-zones no;
         recursion yes;
 
+       response-policy { zone "policy"; };
+
        zone "." {
                type hint;
                file "../../common/root.hint";
        };
+
+       zone "policy" {
+               type master;
+               file "normal.db";
+       };
 };
 
 view external {
@@ -54,9 +59,9 @@ view external {
 acl match { none; };
 acl nobody { none; };
 view extra {
-        match-clients { match; };
-        allow-new-zones yes;
-        allow-transfer { nobody; };
-        allow-query { nobody; };
-        allow-recursion { nobody; };
+       match-clients { match; };
+       allow-new-zones yes;
+       allow-transfer { nobody; };
+       allow-query { nobody; };
+       allow-recursion { nobody; };
 };
index ffa934ef57d548e591cdb9019a540344c4ea2858..010619e1fcc82e381b50c541affc3559797d212b 100755 (executable)
@@ -14,8 +14,6 @@
 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-# $Id: tests.sh,v 1.6 2011/06/17 23:47:49 tbox Exp $
-
 SYSTEMTESTTOP=..
 . $SYSTEMTESTTOP/conf.sh
 
@@ -356,6 +354,13 @@ n=`expr $n + 1`
 if [ $ret != 0 ]; then echo "I:failed"; fi
 status=`expr $status + $ret`
 
+echo "I:attempting to delete a policy zone ($n)"
+ret=0
+$RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 delzone 'policy in internal' 2>&1 | grep 'cannot be deleted' > /dev/null || ret=1
+n=`expr $n + 1`
+if [ $ret != 0 ]; then echo "I:failed"; fi
+status=`expr $status + $ret`
+
 echo "I:ensure the configuration context is cleaned up correctly ($n)"
 ret=0
 $RNDC -c ../common/rndc.conf -s 10.53.0.2 -p 9953 reconfig > /dev/null 2>&1 || ret=1