Browse Source

[trac955] xfrin checks tsig before checking other DNS message values

chenzhengzhang 14 years ago
parent
commit
479cab63fd
1 changed files with 6 additions and 4 deletions
  1. 6 4
      src/bin/xfrin/xfrin.py.in

+ 6 - 4
src/bin/xfrin/xfrin.py.in

@@ -243,13 +243,13 @@ class XfrinConnection(asyncore.dispatcher):
         msg = Message(Message.PARSE)
         msg = Message(Message.PARSE)
         msg.from_wire(soa_response)
         msg.from_wire(soa_response)
 
 
+        # TSIG related checks, including an unexpected signed response
+        self._check_response_tsig(msg, soa_response)
+
         # perform some minimal level validation.  It's an open issue how
         # perform some minimal level validation.  It's an open issue how
         # strict we should be (see the comment in _check_response_header())
         # strict we should be (see the comment in _check_response_header())
         self._check_response_header(msg)
         self._check_response_header(msg)
 
 
-        # TSIG related checks, including an unexpected signed response
-        self._check_response_tsig(msg, soa_response)
-
         # TODO, need select soa record from data source then compare the two
         # TODO, need select soa record from data source then compare the two
         # serial, current just return OK, since this function hasn't been used
         # serial, current just return OK, since this function hasn't been used
         # now.
         # now.
@@ -362,11 +362,13 @@ class XfrinConnection(asyncore.dispatcher):
             recvdata = self._get_request_response(msg_len)
             recvdata = self._get_request_response(msg_len)
             msg = Message(Message.PARSE)
             msg = Message(Message.PARSE)
             msg.from_wire(recvdata)
             msg.from_wire(recvdata)
-            self._check_response_status(msg)
 
 
             # TSIG related checks, including an unexpected signed response
             # TSIG related checks, including an unexpected signed response
             self._check_response_tsig(msg, recvdata)
             self._check_response_tsig(msg, recvdata)
 
 
+            # Perform response status validation
+            self._check_response_status(msg)
+
             answer_section = msg.get_section(Message.SECTION_ANSWER)
             answer_section = msg.get_section(Message.SECTION_ANSWER)
             for rr in self._handle_answer_section(answer_section):
             for rr in self._handle_answer_section(answer_section):
                 yield rr
                 yield rr