Commit ecd7d9fd71 for bind
commit ecd7d9fd71838296ee6ae0ed662ccd53e281e6a9
Author: Michal Nowak <mnowak@isc.org>
Date: Fri Oct 9 15:41:31 2026 +0000
Copy rdata with Rdata.replace()
Since dnspython 2.0.0, rdata is immutable and Rdata.replace() makes a
copy with selected fields changed. Use it where tests rebuilt an
RRSIG or a DNSKEY field by field only to alter its original TTL, key
tag or flags.
Assisted-by: Claude:claude-opus-5-5
diff --git a/bin/tests/system/dnssec/tests_signing.py b/bin/tests/system/dnssec/tests_signing.py
index a0f252eb78..18afaee9b4 100644
--- a/bin/tests/system/dnssec/tests_signing.py
+++ b/bin/tests/system/dnssec/tests_signing.py
@@ -299,9 +299,7 @@ def test_cds_signing():
# check that a non-matching CDS record is accepted with a
# matching CDS record. first, generate a DNSKEY with different flags:
- badksk = type(ksk)(
- ksk.rdclass, ksk.rdtype, ksk.flags + 1, ksk.protocol, ksk.algorithm, ksk.key
- )
+ badksk = ksk.replace(flags=ksk.flags + 1)
up = update.UpdateMessage("cds-update.secure.")
badds = dnssec.make_ds("cds-update.secure.", badksk, 2)
up.delete("cds-update.secure.", "CDS")
@@ -379,9 +377,7 @@ def test_cdnskey_signing():
# check that a non-matching CDNSKEY record is accepted with a
# matching CDNSKEY record. first, generate a DNSKEY with different flags:
- badksk = type(ksk)(
- ksk.rdclass, ksk.rdtype, ksk.flags + 1, ksk.protocol, ksk.algorithm, ksk.key
- )
+ badksk = ksk.replace(flags=ksk.flags + 1)
up = update.UpdateMessage("cdnskey-update.secure.")
up.delete("cdnskey-update.secure.", "CDNSKEY")
up.add("cdnskey-update.secure.", 1, "CDNSKEY", str(ksk))
diff --git a/bin/tests/system/dnssec_py/tests_dnskey_malformed.py b/bin/tests/system/dnssec_py/tests_dnskey_malformed.py
index 9f86d4c99c..27b5f4c246 100644
--- a/bin/tests/system/dnssec_py/tests_dnskey_malformed.py
+++ b/bin/tests/system/dnssec_py/tests_dnskey_malformed.py
@@ -21,7 +21,6 @@ import dns.dnssec
import dns.name
import dns.rdataclass
import dns.rdatatype
-import dns.rdtypes.ANY.RRSIG
import dns.zone
import pytest
@@ -54,20 +53,10 @@ MALFORMED_ZSK_KEY_TAG = 20071
def create_malformed_rr(rr, n=0):
- malformed_rr = dns.rdtypes.ANY.RRSIG.RRSIG(
- rdclass=rr.rdclass,
- rdtype=rr.rdtype,
- type_covered=rr.type_covered,
- algorithm=rr.algorithm,
- labels=rr.labels,
+ return rr.replace(
original_ttl=rr.original_ttl - n, # edit TTL so multiple RRSIGs can be added
- expiration=rr.expiration,
- inception=rr.inception,
key_tag=MALFORMED_ZSK_KEY_TAG, # overwrite with the malformed ZSKs
- signer=rr.signer,
- signature=rr.signature,
)
- return malformed_rr
def bootstrap():
diff --git a/bin/tests/system/nsec/tests_excessive_rrsigs.py b/bin/tests/system/nsec/tests_excessive_rrsigs.py
index d54f0914ce..b209982eab 100644
--- a/bin/tests/system/nsec/tests_excessive_rrsigs.py
+++ b/bin/tests/system/nsec/tests_excessive_rrsigs.py
@@ -11,7 +11,6 @@
import dns.rdataclass
import dns.rdatatype
-import dns.rdtypes.ANY.RRSIG
import dns.zone
from isctest.run import EnvCmd
@@ -20,20 +19,8 @@ import isctest
def duplicate_rrsig(rdata, i):
- return dns.rdtypes.ANY.RRSIG.RRSIG(
- rdclass=rdata.rdclass,
- rdtype=rdata.rdtype,
- type_covered=rdata.type_covered,
- algorithm=rdata.algorithm,
- labels=rdata.labels,
- # increment orig TTL so the rdataset isn't treated as identical record by dnspython
- original_ttl=rdata.original_ttl + i,
- expiration=rdata.expiration,
- inception=rdata.inception,
- key_tag=rdata.key_tag,
- signer=rdata.signer,
- signature=rdata.signature,
- )
+ # increment orig TTL so the rdataset isn't treated as identical record by dnspython
+ return rdata.replace(original_ttl=rdata.original_ttl + i)
def bootstrap():