BIND 10 trac815, updated. afd75a89d7aeba622b53c5b37e3f76572ef68c3a [trac815] explicitly check for tsig related values

BIND 10 source code commits bind10-changes at lists.isc.org
Tue May 10 04:05:57 UTC 2011


The branch, trac815 has been updated
       via  afd75a89d7aeba622b53c5b37e3f76572ef68c3a (commit)
      from  7efc144e0eacc123544507d635630b7949052993 (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 afd75a89d7aeba622b53c5b37e3f76572ef68c3a
Author: chenzhengzhang <jerry.zzpku at gmail.com>
Date:   Tue May 10 12:03:47 2011 +0800

    [trac815] explicitly check for tsig related values

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

Summary of changes:
 src/bin/xfrin/tests/xfrin_test.py |   12 ++++++++++--
 src/bin/xfrin/xfrin.py.in         |    4 ++--
 2 files changed, 12 insertions(+), 4 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/bin/xfrin/tests/xfrin_test.py b/src/bin/xfrin/tests/xfrin_test.py
index 461de00..0ccbbb8 100644
--- a/src/bin/xfrin/tests/xfrin_test.py
+++ b/src/bin/xfrin/tests/xfrin_test.py
@@ -35,6 +35,8 @@ TEST_MASTER_IPV6_ADDRINFO = (socket.AF_INET6, socket.SOCK_STREAM,
 # If some other process uses this port test will fail.
 TEST_MASTER_PORT = '53535'
 
+TSIG_KEY = TSIGKey("example.com:SFuWd/q99SzF8Yzd1QbB9g==")
+
 soa_rdata = Rdata(RRType.SOA(), TEST_RRCLASS,
                   'master.example.com. admin.example.com ' +
                   '1234 3600 1800 2419200 7200')
@@ -223,8 +225,7 @@ class TestXfrinConnection(unittest.TestCase):
         self.assertEqual(self.conn.query_data, b'\x00\x1d\x105\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x07example\x03com\x00\x00\xfc\x00\x01')
 
         # soa request with tsig
-        tsig_key = TSIGKey("example.com:SFuWd/q99SzF8Yzd1QbB9g==")
-        self.conn._tsig_ctx = TSIGContext(tsig_key)
+        self.conn._tsig_ctx = TSIGContext(TSIG_KEY)
         self.conn._send_query(RRType.SOA())
         tsig_soa_data = strip_mutable_tsig_data(self.conn.query_data)
         self.assertEqual(tsig_soa_data, b'\x00n\x105\x00\x00\x00\x01\x00\x00\x00\x00\x00\x01\x07example\x03com\x00\x00\x06\x00\x01\x07example\x03com\x00\x00\xfa\x00\xff\x00\x00\x00\x00\x00:\x08hmac-md5\x07sig-alg\x03reg\x03int\x00\x01,\x00\x10\x105\x00\x00\x00\x00')
@@ -238,6 +239,13 @@ class TestXfrinConnection(unittest.TestCase):
         self.conn.reply_data = b'aaaxxxx'
         self.assertRaises(XfrinTestException, self._handle_xfrin_response)
 
+    def test_response_with_tsig(self):
+        self.conn._tsig_ctx = TSIGContext(TSIG_KEY)
+        # server tsig check fail, return with RCODE 9 (NOTAUTH)
+        self.conn._send_query(RRType.SOA())
+        self.conn.reply_data = self.conn.create_response_data(rcode=Rcode.NOTAUTH())
+        self.assertRaises(XfrinException, self._handle_xfrin_response)
+
     def test_response_without_end_soa(self):
         self.conn._send_query(RRType.AXFR())
         self.conn.reply_data = self.conn.create_response_data()
diff --git a/src/bin/xfrin/xfrin.py.in b/src/bin/xfrin/xfrin.py.in
index eca5b0f..615361b 100755
--- a/src/bin/xfrin/xfrin.py.in
+++ b/src/bin/xfrin/xfrin.py.in
@@ -95,7 +95,7 @@ class XfrinConnection(asyncore.dispatcher):
         self._verbose = verbose
         self._master_address = master_addrinfo[2]
         self._tsig_ctx = None
-        if tsig_key_str:
+        if tsig_key_str is not None:
             self._tsig_ctx = TSIGContext(TSIGKey(tsig_key_str))
 
     def connect_to_master(self):
@@ -134,7 +134,7 @@ class XfrinConnection(asyncore.dispatcher):
 
         msg = self._create_query(query_type)
         render = MessageRenderer()
-        if self._tsig_ctx:
+        if self._tsig_ctx is not None:
             msg.to_wire(render, self._tsig_ctx)
         else:
             msg.to_wire(render)




More information about the bind10-changes mailing list