BIND 10 trac1414, updated. bdd00552a920331dc3cf1f2e6a7644112caa4b72 [1414] added class check as well, and test for case-insensitivity

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Dec 15 09:56:56 UTC 2011


The branch, trac1414 has been updated
       via  bdd00552a920331dc3cf1f2e6a7644112caa4b72 (commit)
      from  23350205fb9b09ed188be0898b3f95efb34f74b1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit bdd00552a920331dc3cf1f2e6a7644112caa4b72
Author: Jelte Jansen <jelte at isc.org>
Date:   Thu Dec 15 10:56:37 2011 +0100

    [1414] added class check as well, and test for case-insensitivity

-----------------------------------------------------------------------

Summary of changes:
 src/bin/zonemgr/tests/zonemgr_test.py |   19 +++++++++++++++++++
 src/bin/zonemgr/zonemgr.py.in         |   14 ++++++++++----
 2 files changed, 29 insertions(+), 4 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/zonemgr/tests/zonemgr_test.py b/src/bin/zonemgr/tests/zonemgr_test.py
index ec2ced6..9d60211 100644
--- a/src/bin/zonemgr/tests/zonemgr_test.py
+++ b/src/bin/zonemgr/tests/zonemgr_test.py
@@ -569,6 +569,14 @@ class TestZonemgrRefresh(unittest.TestCase):
         self.zone_refresh.update_config_data(config, self.cc_session)
         self.assertTrue(("example.net.", "IN") in
                         self.zone_refresh._zonemgr_refresh_info)
+
+        # and with case-insensitive checking
+        config['secondary_zones'] = \
+            zone_list_from_name_classes([("Example.NeT.", "IN")])
+        self.zone_refresh.update_config_data(config, self.cc_session)
+        self.assertTrue(("example.net.", "IN") in
+                        self.zone_refresh._zonemgr_refresh_info)
+
         # Try some bad names
         config['secondary_zones'] = \
             zone_list_from_name_classes([("example..net", "IN")])
@@ -580,6 +588,17 @@ class TestZonemgrRefresh(unittest.TestCase):
         self.assertRaises(ZonemgrException,
                           self.zone_refresh.update_config_data,
                           config, self.cc_session)
+        # Try a bad class
+        config['secondary_zones'] = \
+            zone_list_from_name_classes([("example.net", "BADCLASS")])
+        self.assertRaises(ZonemgrException,
+                          self.zone_refresh.update_config_data,
+                          config, self.cc_session)
+        config['secondary_zones'] = \
+            zone_list_from_name_classes([("example.net", "")])
+        self.assertRaises(ZonemgrException,
+                          self.zone_refresh.update_config_data,
+                          config, self.cc_session)
 
     def tearDown(self):
         sys.stderr= self.stderr_backup
diff --git a/src/bin/zonemgr/zonemgr.py.in b/src/bin/zonemgr/zonemgr.py.in
index 161a5ca..f1ee238 100755
--- a/src/bin/zonemgr/zonemgr.py.in
+++ b/src/bin/zonemgr/zonemgr.py.in
@@ -483,11 +483,17 @@ class ZonemgrRefresh:
                     # (then this entire method can be simplified a lot, and we
                     # wouldn't need direct access to the ccsession object)
                     if 'class' in secondary_zone:
-                        name_class = (name, secondary_zone['class'])
+                        rr_class = secondary_zone['class']
                     else:
-                        name_class = (name,
-                                      module_cc_session.get_default_value(
-                                        'secondary_zones/class'))
+                        rr_class = module_cc_session.get_default_value(
+                                        'secondary_zones/class')
+                    # Convert rr_class to and from RRClass to check its value
+                    try:
+                        name_class = (name, isc.dns.RRClass(rr_class).to_text())
+                    except isc.dns.InvalidRRClass as irce:
+                        raise ZonemgrException("Bad RR class '" +
+                                               rr_class +
+                                               "' for zone " + name)
                     required[name_class] = True
                     # Add it only if it isn't there already
                     if not name_class in self._zonemgr_refresh_info:




More information about the bind10-changes mailing list