]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Fix two problems with dns.xfr.make_query():
authorBob Halley <halley@dnspython.org>
Tue, 18 May 2021 13:52:15 +0000 (06:52 -0700)
committerBob Halley <halley@dnspython.org>
Tue, 18 May 2021 13:52:15 +0000 (06:52 -0700)
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

index b07f8b9a3a749f3cb037db6a42e64d21a804cef0..84059a3a5144df66d4fdacc28624ff7322d03611 100644 (file)
@@ -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)