From a8253e123b291e767548bb98cb00a81181076631 Mon Sep 17 00:00:00 2001 From: Bob Halley Date: Tue, 18 May 2021 06:52:15 -0700 Subject: [PATCH] Fix two problems with dns.xfr.make_query(): 1) We always used class IN instead of using the class of the txn manager. 2) We directly appended to the authority section instead of using find_rrset(), which meant that our changes were not indexed and would break if other code tried to use find_rrset() to find what we added. --- dns/xfr.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dns/xfr.py b/dns/xfr.py index b07f8b9a..84059a3a 100644 --- a/dns/xfr.py +++ b/dns/xfr.py @@ -287,9 +287,11 @@ def make_query(txn_manager, serial=0, use_edns, False, ednsflags, payload, request_payload, options) if serial is not None: - rrset = dns.rrset.from_text(zone_origin, 0, 'IN', 'SOA', + rdata = dns.rdata.from_text('IN', 'SOA', f'. . {serial} 0 0 0 0') - q.authority.append(rrset) + rrset = q.find_rrset(q.authority, zone_origin, txn_manager.get_class(), + dns.rdatatype.SOA, create=True) + rrset.add(rdata, 0) if keyring is not None: q.use_tsig(keyring, keyname, algorithm=keyalgorithm) return (q, serial) -- 2.47.3