From 80129a9b07785ff30c36c64e2823bd8482d3d89c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 16 Nov 2020 15:01:49 +0100 Subject: [PATCH] tests/dcerpc/raw_protocol: run test_neg_xmit_ffff_ffff over tcp and smb BUG: https://bugzilla.samba.org/show_bug.cgi?id=14356 Signed-off-by: Stefan Metzmacher Reviewed-by: Andreas Schneider (cherry picked from commit a2d894fd37aaa9bce64ad95e01412681a08790ea) --- python/samba/tests/dcerpc/raw_protocol.py | 28 ++++++++++++++++++---- selftest/knownfail.d/dcerpc-transport-xmit | 1 + 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 selftest/knownfail.d/dcerpc-transport-xmit diff --git a/python/samba/tests/dcerpc/raw_protocol.py b/python/samba/tests/dcerpc/raw_protocol.py index d10f767371b..6d2220674df 100755 --- a/python/samba/tests/dcerpc/raw_protocol.py +++ b/python/samba/tests/dcerpc/raw_protocol.py @@ -2979,6 +2979,7 @@ class TestDCERPC_BIND(RawDCERPCTest): req_xmit=None, req_recv=None, rep_both=None, + transport_both=5840, alter_xmit=None, alter_recv=None): ndr32 = base.transfer_syntax_ndr() @@ -3001,9 +3002,16 @@ class TestDCERPC_BIND(RawDCERPCTest): self.assertEqual(rep.u.max_xmit_frag, rep_both) self.assertEqual(rep.u.max_recv_frag, rep_both) self.assertNotEqual(rep.u.assoc_group_id, req.u.assoc_group_id) - self.assertEqual(rep.u.secondary_address_size, 4) - self.assertEqual(rep.u.secondary_address, "%d" % self.tcp_port) - self.assertPadding(rep.u._pad1, 2) + sda_str = self.secondary_address + sda_len = len(sda_str) + 1 + mod_len = (2 + sda_len) % 4 + if mod_len != 0: + sda_pad = 4 - mod_len + else: + sda_pad = 0 + self.assertEqual(rep.u.secondary_address_size, sda_len) + self.assertEqual(rep.u.secondary_address, sda_str) + self.assertPadding(rep.u._pad1, sda_pad) self.assertEqual(rep.u.num_results, 1) self.assertEqual(rep.u.ctx_list[0].result, dcerpc.DCERPC_BIND_ACK_RESULT_ACCEPTANCE) @@ -3057,7 +3065,7 @@ class TestDCERPC_BIND(RawDCERPCTest): self.assertEqual(rep.u.cancel_count, 0) self.assertGreaterEqual(len(rep.u.stub_and_verifier), rep.u.alloc_hint) - chunk_size = 5840 - dcerpc.DCERPC_REQUEST_LENGTH + chunk_size = transport_both - dcerpc.DCERPC_REQUEST_LENGTH req = self.generate_request(call_id=2, context_id=ctx1.context_id, opnum=0, @@ -3096,11 +3104,21 @@ class TestDCERPC_BIND(RawDCERPCTest): self.assertIsNone(rep) self.assertNotConnected() - def test_neg_xmit_ffff_ffff(self): + def test_neg_xmit_ffff_ffff_tcp(self): return self._test_neg_xmit_check_values(req_xmit=0xffff, req_recv=0xffff, rep_both=5840) + def test_neg_xmit_ffff_ffff_smb(self): + transport_creds = self.get_anon_creds() + self.reconnect_smb_pipe(primary_address='\\pipe\\lsarpc', + secondary_address='\\pipe\\lsass', + transport_creds=transport_creds) + return self._test_neg_xmit_check_values(req_xmit=0xffff, + req_recv=0xffff, + rep_both=4280, + transport_both=4280) + def test_neg_xmit_0_ffff(self): return self._test_neg_xmit_check_values(req_xmit=0, req_recv=0xffff, diff --git a/selftest/knownfail.d/dcerpc-transport-xmit b/selftest/knownfail.d/dcerpc-transport-xmit new file mode 100644 index 00000000000..e070c151b37 --- /dev/null +++ b/selftest/knownfail.d/dcerpc-transport-xmit @@ -0,0 +1 @@ +^samba.tests.dcerpc.raw_protocol.samba.tests.dcerpc.raw_protocol.TestDCERPC_BIND.test_neg_xmit_ffff_ffff_smb