Commit 97953d08 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[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.
parent 9859c1d7
......@@ -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
......
......@@ -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))
......
......@@ -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:
......
Supports Markdown
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