summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Halley <halley@dnspython.org>2021-05-18 06:52:15 -0700
committerBob Halley <halley@dnspython.org>2021-05-18 06:52:15 -0700
commita8253e123b291e767548bb98cb00a81181076631 (patch)
treeac54376b549798abd37f3469e20138ed5ab6b811
parent99e15f40fb43f11da1064f6dac38b505beeda056 (diff)
downloaddnspython-a8253e123b291e767548bb98cb00a81181076631.tar.gz
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.
-rw-r--r--dns/xfr.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/dns/xfr.py b/dns/xfr.py
index b07f8b9..84059a3 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)