1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

python:tests/dns_base: let verify_packet() work against Windows

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>
This commit is contained in:
Stefan Metzmacher 2024-05-29 13:17:54 +02:00 committed by Andrew Bartlett
parent de4ed363d3
commit 8324d0739d
2 changed files with 12 additions and 1 deletions

View File

@ -353,6 +353,15 @@ class DNSTKeyTest(DNSTest):
self.assertEqual(response.arcount, 1)
self.assertEqual(response.additional[0].rr_type, dns.DNS_QTYPE_TSIG)
if self.tkey['algorithm'] == "gss-tsig":
gss_tsig = True
else:
gss_tsig = False
request_mac_len = b""
if len(request_mac) > 0 and gss_tsig:
request_mac_len = struct.pack('!H', len(request_mac))
tsig_record = response.additional[0].rdata
mac = bytes(tsig_record.mac)
@ -378,7 +387,7 @@ class DNSTKeyTest(DNSTest):
fake_tsig.other_data = tsig_record.other_data
fake_tsig_packet = ndr.ndr_pack(fake_tsig)
data = request_mac + response_packet_wo_tsig + fake_tsig_packet
data = request_mac_len + request_mac + response_packet_wo_tsig + fake_tsig_packet
try:
self.tkey['gensec'].check_packet(data, data, mac)
except NTSTATUSError as nt:

View File

@ -9,3 +9,5 @@
^samba.tests.dns_tkey.__main__.TestDNSUpdates.test_update_tsig_bad_algorithm.fl2008r2dc
^samba.tests.dns_tkey.__main__.TestDNSUpdates.test_update_tsig_changed_algorithm1.fl2008r2dc
^samba.tests.dns_tkey.__main__.TestDNSUpdates.test_update_tsig_changed_algorithm2.fl2008r2dc
^samba.tests.dns_tkey.__main__.TestDNSUpdates.test_update_gss_tsig_tkey_req_additional.fl2008r2dc
^samba.tests.dns_tkey.__main__.TestDNSUpdates.test_update_tsig_windows.fl2008r2dc