Skip to content
Snippets Groups Projects
Commit 5c8fedf3 authored by Karel Slaný's avatar Karel Slaný
Browse files

tests: converting algorithm identifier to number in DS records in .rpl

The parsing of *.rpl files failed on reading DS records because the
algorithm identifier is a string rather than a number.
parent 7a13db63
No related merge requests found
import dns.message import dns.message
import dns.rrset import dns.rrset
import dns.rcode import dns.rcode
import dns.dnssec
class Entry: class Entry:
""" """
...@@ -135,6 +136,9 @@ class Entry: ...@@ -135,6 +136,9 @@ class Entry:
rdtype = args.pop(0) rdtype = args.pop(0)
rr = dns.rrset.from_text(owner, ttl, rdclass, rdtype) rr = dns.rrset.from_text(owner, ttl, rdclass, rdtype)
if len(args) > 0: 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) rd = dns.rdata.from_text(rr.rdclass, rr.rdtype, ' '.join(args), origin=dns.name.from_text(self.origin), relativize=False)
rr.add(rd) rr.add(rd)
return rr return rr
......
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