]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
tests: converting algorithm identifier to number in DS records in .rpl
authorKarel Slany <karel.slany@nic.cz>
Thu, 4 Jun 2015 14:49:30 +0000 (16:49 +0200)
committerKarel Slany <karel.slany@nic.cz>
Thu, 4 Jun 2015 14:49:30 +0000 (16:49 +0200)
The parsing of *.rpl files failed on reading DS records because the
algorithm identifier is a string rather than a number.

tests/pydnstest/scenario.py

index cfb04e629085d7f94e35d434a9b60bc9c4163ca0..2a9d05749eb547fe1025eb48783636370ae8291e 100644 (file)
@@ -1,6 +1,7 @@
 import dns.message
 import dns.rrset
 import dns.rcode
+import dns.dnssec
 
 class Entry:
     """
@@ -135,6 +136,9 @@ class Entry:
         rdtype = args.pop(0)
         rr = dns.rrset.from_text(owner, ttl, rdclass, rdtype)
         if len(args) > 0:
+            if (rr.rdtype == dns.rdatatype.DS):
+                # convert textual algorithm identifier to number
+                args[1] = str(dns.dnssec.algorithm_from_text(args[1]))
             rd = dns.rdata.from_text(rr.rdclass, rr.rdtype, ' '.join(args), origin=dns.name.from_text(self.origin), relativize=False)
             rr.add(rd)
         return rr