]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
python:tests/dns_base: let tkey_trans() take tkey_req_in_answers
authorStefan Metzmacher <metze@samba.org>
Wed, 29 May 2024 12:08:13 +0000 (14:08 +0200)
committerJule Anger <janger@samba.org>
Wed, 3 Jul 2024 08:48:11 +0000 (08:48 +0000)
It's possible to put the additional into the answers section,
so we should be able to test that.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13019

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit cd747307d845f3cff723a7916aeeb31458f19202)

python/samba/tests/dns_base.py

index 4a28930406569a968fa7b59e7db209b4fe91ce20..41d34b0da36b34c9159e1d3c72fa690f3dbbda3d 100644 (file)
@@ -248,7 +248,8 @@ class DNSTKeyTest(DNSTest):
         self.creds.set_kerberos_state(credentials.MUST_USE_KERBEROS)
         self.newrecname = "tkeytsig.%s" % self.get_dns_domain()
 
-    def tkey_trans(self, creds=None, algorithm_name="gss-tsig"):
+    def tkey_trans(self, creds=None, algorithm_name="gss-tsig",
+                   tkey_req_in_answers=False):
         "Do a TKEY transaction and establish a gensec context"
 
         if creds is None:
@@ -297,8 +298,12 @@ class DNSTKeyTest(DNSTest):
         r.rdata = rdata
 
         additional = [r]
-        p.arcount = 1
-        p.additional = additional
+        if tkey_req_in_answers:
+            p.ancount = 1
+            p.answers = additional
+        else:
+            p.arcount = 1
+            p.additional = additional
 
         (response, response_packet) =\
             self.dns_transaction_tcp(p, self.server_ip)