BIND 10 trac2439, updated. 97953d08e3259263743138dcc81ef4332e585e39 [2439] Invalid zone data isn't protocol error

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Jan 24 16:51:15 UTC 2013


The branch, trac2439 has been updated
       via  97953d08e3259263743138dcc81ef4332e585e39 (commit)
      from  9859c1d73774b09bab6aee9dc8082428097aeae9 (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 97953d08e3259263743138dcc81ef4332e585e39
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Thu Jan 24 17:49:07 2013 +0100

    [2439] Invalid zone data isn't protocol error
    
    Use separate error message and exception for the case when received zone
    data doesn't pass basic validation.

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

Summary of changes:
 src/bin/xfrin/tests/xfrin_test.py |    3 +--
 src/bin/xfrin/xfrin.py.in         |   16 +++++++++++++++-
 src/bin/xfrin/xfrin_messages.mes  |    5 +++++
 3 files changed, 21 insertions(+), 3 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/xfrin/tests/xfrin_test.py b/src/bin/xfrin/tests/xfrin_test.py
index 4000c5b..6b78026 100644
--- a/src/bin/xfrin/tests/xfrin_test.py
+++ b/src/bin/xfrin/tests/xfrin_test.py
@@ -1335,8 +1335,7 @@ class TestAXFR(TestXfrinConnection):
             answers=[begin_soa_rrset, a_rr, soa_rrset])
         # Make it fail the validation
         self._check_zone_result = False
-        self.assertRaises(XfrinProtocolError,
-                          self.conn._handle_xfrin_responses)
+        self.assertRaises(XfrinZoneError, self.conn._handle_xfrin_responses)
         self.assertEqual(type(XfrinAXFREnd()), type(self.conn.get_xfrstate()))
         self.assertEqual([], self.conn._datasrc_client.committed_diffs)
         # Check the validation is called with the correct parameters
diff --git a/src/bin/xfrin/xfrin.py.in b/src/bin/xfrin/xfrin.py.in
index a9258b9..f73e966 100755
--- a/src/bin/xfrin/xfrin.py.in
+++ b/src/bin/xfrin/xfrin.py.in
@@ -94,6 +94,12 @@ class XfrinProtocolError(Exception):
     '''
     pass
 
+class XfrinZoneError(Exception):
+    '''
+    An exception raised when the received zone contain invalid data.
+    '''
+    pass
+
 class XfrinZoneUptodate(Exception):
     '''TBD
     '''
@@ -817,7 +823,7 @@ class XfrinConnection(asyncore.dispatcher):
         if not check_zone(self._zone_name, self._rrclass,
                           self._diff.get_rrset_collection(),
                           (self.__validate_error, self.__validate_warning)):
-            raise XfrinProtocolError('Validation of the new zone failed')
+            raise XfrinZoneError('Validation of the new zone failed')
         self._diff.commit()
 
     def __parse_soa_response(self, msg, response_data):
@@ -965,7 +971,15 @@ class XfrinConnection(asyncore.dispatcher):
             # of trying another primary server, etc, but for now we treat it
             # as "success".
             pass
+        except XfrinZoneError:
+            # The log message doesn't contain the exception text, since there's
+            # only one place where the exception is thrown now and it'd be the
+            # same generic message every time.
+            logger.error(XFRIN_INVALID_ZONE_DATA, self.zone_str(),
+                         format_addrinfo(self._master_addrinfo))
+            ret = XFRIN_FAIL
         except XfrinProtocolError as e:
+            # FIXME: Why is this .info? Even the messageID contains "ERROR".
             logger.info(XFRIN_XFR_TRANSFER_PROTOCOL_ERROR, req_str,
                         self.zone_str(),
                         format_addrinfo(self._master_addrinfo), str(e))
diff --git a/src/bin/xfrin/xfrin_messages.mes b/src/bin/xfrin/xfrin_messages.mes
index 9f8af59..6f3e464 100644
--- a/src/bin/xfrin/xfrin_messages.mes
+++ b/src/bin/xfrin/xfrin_messages.mes
@@ -77,6 +77,11 @@ is not equal to the requested SOA serial.
 There was an error importing the python DNS module pydnspp. The most
 likely cause is a PYTHONPATH problem.
 
+% XFRIN_INVALID_ZONE_DATA zone %2 received from %3 contains invalid data
+The zone was received, but it failed sanity validation. The previous version
+of zone (if any is available) will be used. Look for previous
+XFRIN_ZONE_INVALID messages to see the exact problem(s).
+
 % XFRIN_IXFR_TRANSFER_SUCCESS incremental IXFR transfer of zone %1 succeeded (messages: %2, changesets: %3, deletions: %4, additions: %5, bytes: %6, run time: %7 seconds, %8 bytes/second)
 The IXFR transfer for the given zone was successful.
 The provided information contains the following values:



More information about the bind10-changes mailing list