from collections.abc import AsyncGenerator
+import dns.name
import dns.rcode
import dns.rdatatype
import dns.rrset
version.
"""
- domains = ["xfr-and-reconfig"]
+ domains = ["xfr-and-reconfig", "private-dns-overrun"]
def __init__(self) -> None:
super().__init__()
yield DnsResponseSend(txt_message)
+ if qctx.qname == dns.name.from_text("private-dns-overrun"):
+ # A message where the malformed DNSKEY algorithm identifier
+ # finishes on a 00 byte in the next record. Assumes the
+ # next record starts with a compression pointer which is
+ # followed by the type which starts with 00.
+
+ # Generate malformed PRIVATE DNS DNSKEY
+ dnskey_message = qctx.prepare_new_response()
+ dnskey_rrset = dns.rrset.from_text(
+ qctx.qname,
+ 300,
+ qctx.qclass,
+ dns.rdatatype.DNSKEY,
+ "\\# 12 00 00 00 fd 09 00 00 00 00 00 00 00",
+ )
+ dnskey_message.answer.append(dnskey_rrset)
+ # Generate well formed PRIVATE DNS DNSKEY
+ dnskey_rrset = dns.rrset.from_text(
+ qctx.qname,
+ 300,
+ qctx.qclass,
+ dns.rdatatype.DNSKEY,
+ "\\# 12 00 00 00 fd 06 00 00 00 00 00 00 00",
+ )
+ dnskey_message.answer.append(dnskey_rrset)
+
+ yield DnsResponseSend(dnskey_message)
+
# Finish the AXFR transaction by sending the second SOA RRset.
yield DnsResponseSend(soa_message)
primaries { 10.53.0.11; };
file "ixfr-race.bk";
};
+
+# GL#6004
+zone "private-dns-overrun" {
+ type secondary;
+ primaries { 10.53.0.9; };
+ file "private-dns-overrun.bk";
+ masterfile-format text; # force bug to be exercised
+ request-ixfr no; # ans9 supports only axfr
+};
watcher_transfer_started.wait_for_line("Transfer started")
+def test_malformed_private_dns_identifier_overrun(ns6):
+ isctest.log.info(
+ "Check that a malformed PRIVATEDNS DNSKEY which overruns the record is rejected"
+ )
+ with ns6.watch_log_from_start(timeout=60) as watcher_transfer_completed:
+ watcher_transfer_completed.wait_for_line(
+ "zone private-dns-overrun/IN: zone transfer finished: unexpected end of input"
+ )
+
+
# See #5767
def test_ixfr_race(ns6):
isctest.log.info(