1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

python:tests/dns_base: let dns_transaction_tcp() handle short receives

With socket_wrapper we only get 1500 byte chunks...

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-31 08:07:24 +02:00 committed by Andrew Bartlett
parent c594cbad4a
commit c741d0f396

View File

@ -151,7 +151,18 @@ class DNSTest(TestCaseInTempDir):
tcp_packet += send_packet
s.sendall(tcp_packet)
recv_packet = s.recv(0xffff + 2, 0)
recv_packet = b''
length = None
for i in range(0, 2 + 0xffff):
if len(recv_packet) >= 2:
length, = struct.unpack('!H', recv_packet[0:2])
remaining = 2 + length
else:
remaining = 2 + 12
remaining -= len(recv_packet)
if remaining == 0:
break
recv_packet += s.recv(remaining, 0)
if dump:
print(self.hexdump(recv_packet))
response = ndr.ndr_unpack(dns.name_packet, recv_packet[2:])