summaryrefslogtreecommitdiff
path: root/tests/test_nsec3.py
diff options
context:
space:
mode:
authorBrian Wellington <bwelling@xbill.org>2020-07-02 15:29:25 -0700
committerBrian Wellington <bwelling@xbill.org>2020-07-02 15:29:25 -0700
commit6d3062b5cd6e2254743f177c54e92def9b9e8a9e (patch)
treea059d952023e26057ba8a3bcf735b96097eba421 /tests/test_nsec3.py
parent5c06d9800914bdf2043b30f8e90dad1cda111915 (diff)
downloaddnspython-6d3062b5cd6e2254743f177c54e92def9b9e8a9e.tar.gz
Consolidate NSEC/NSEC3/CSYNC bitmap handling.
This also fixes several bugs; the NSEC3 code would properly avoid empty windows, but the NSEC and CSYNC code did not. Also, none of the wire parsing routines properly checked to see that the window number was monotonically increasing.
Diffstat (limited to 'tests/test_nsec3.py')
-rw-r--r--tests/test_nsec3.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_nsec3.py b/tests/test_nsec3.py
index 0b75b29..bf7d115 100644
--- a/tests/test_nsec3.py
+++ b/tests/test_nsec3.py
@@ -17,6 +17,7 @@
import unittest
+import dns.exception
import dns.rdata
import dns.rdataclass
import dns.rdatatype
@@ -34,5 +35,14 @@ class NSEC3TestCase(unittest.TestCase):
(255, bitmap)
))
+ def test_NSEC3_bad_bitmaps(self):
+ rdata = dns.rdata.from_text(dns.rdataclass.IN, dns.rdatatype.NSEC3,
+ u"1 0 100 ABCD SCBCQHKU35969L2A68P3AD59LHF30715 A CAA")
+
+ with self.assertRaises(dns.exception.FormError):
+ copy = bytearray(rdata.to_wire())
+ copy[-3] = 0
+ dns.rdata.from_wire('IN', 'NSEC3', copy, 0, len(copy))
+
if __name__ == '__main__':
unittest.main()