From: Bob Halley Date: Tue, 18 May 2021 13:52:15 +0000 (-0700) Subject: Fix two problems with dns.xfr.make_query(): X-Git-Tag: v2.2.0rc1~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8253e123b291e767548bb98cb00a81181076631;p=thirdparty%2Fdnspython.git 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. --- 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)