From 5667348f1ae558333da699efc03b05c367bd4891 Mon Sep 17 00:00:00 2001 From: Pascal Bouchareine Date: Thu, 3 Jun 2021 22:02:55 -0700 Subject: [PATCH] Update for dnspython 2.1.0 --- dnsknife/__init__.py | 2 +- dnsknife/dnssec.py | 3 +-- dnsknife/monkeypatch.py | 25 ------------------------- 3 files changed, 2 insertions(+), 28 deletions(-) diff --git a/dnsknife/__init__.py b/dnsknife/__init__.py index 58a506d..b100db8 100644 --- a/dnsknife/__init__.py +++ b/dnsknife/__init__.py @@ -60,7 +60,7 @@ def query_with_default_name(name='', text=False): return query_with_default_name def __getattribute__(self, name): - if name in dns.rdatatype._by_text.keys(): + if name in dns.rdatatype.RdataType.__members__: return self.partial_query(name) return super(TypeAware, self).__getattribute__(name) diff --git a/dnsknife/dnssec.py b/dnsknife/dnssec.py index 82a2c62..1a03901 100644 --- a/dnsknife/dnssec.py +++ b/dnsknife/dnssec.py @@ -88,5 +88,4 @@ def matching_key(dnskeys, ds): candidate = dns.dnssec.make_ds(dnskeys.name, k, dtype) if candidate.digest == ds.digest: # Special case for CDS alg 0 - k.algorithm = ds.algorithm - return k + return k.replace(algorithm=ds.algorithm) diff --git a/dnsknife/monkeypatch.py b/dnsknife/monkeypatch.py index fd2546c..b8dedef 100644 --- a/dnsknife/monkeypatch.py +++ b/dnsknife/monkeypatch.py @@ -5,31 +5,6 @@ import dns.rdtypes.ANY.DS import dns.rdtypes.ANY.DNSKEY -dns.rdatatype.CDS = 59 -dns.rdatatype._by_text['CDS'] = dns.rdatatype.CDS -dns.rdatatype._by_value[59] = 'CDS' - -dns.rdatatype.CDNSKEY = 60 -dns.rdatatype._by_text['CDNSKEY'] = dns.rdatatype.CDNSKEY -dns.rdatatype._by_value[60] = 'CDNSKEY' - -dns.rdata._rdata_modules[(dns.rdataclass.IN, - dns.rdatatype.CDS)] = dns.rdtypes.ANY.DS -dns.rdtypes.ANY.DS.CDS = dns.rdtypes.ANY.DS.DS - -dns.rdata._rdata_modules[(dns.rdataclass.IN, - dns.rdatatype.CDNSKEY)] = dns.rdtypes.ANY.DNSKEY -dns.rdtypes.ANY.DNSKEY.CDNSKEY = dns.rdtypes.ANY.DNSKEY.DNSKEY - -if not hasattr(dns.rdatatype, 'URI'): - dns.rdatatype.URI = 256 - dns.rdatatype._by_text['URI'] = dns.rdatatype.URI - dns.rdata.GenericRdata.target = property(lambda x: x.data[4:]) - -# For pickle/unpickle - -del dns.name.Name.__setattr__ - # Select.poll is not always available class Poll: