From: Jeremy Allison Date: Fri, 18 Nov 2022 21:30:05 +0000 (-0800) Subject: s4: torture: Tweak the compound padding streamfile test to send 3 reads instead of... X-Git-Tag: talloc-2.4.0~457 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc6c76e6dabdc20bc7401cc2268baa6edb635ee1;p=thirdparty%2Fsamba.git s4: torture: Tweak the compound padding streamfile test to send 3 reads instead of 2, and check the middle read padding. The protocol allows the last read in a related compound to be split off and possibly go async (and smbd soon will do this). If the last read is split off, then the padding is different. By sending 3 reads and checking the padding on the 2nd read, we cope with the smbd change and are still correctly checking the padding on a compound related read. Do this for the stream filename compound padding test. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source4/torture/smb2/compound.c b/source4/torture/smb2/compound.c index 607ec5d5958..2fb6f11d533 100644 --- a/source4/torture/smb2/compound.c +++ b/source4/torture/smb2/compound.c @@ -1195,7 +1195,7 @@ static bool test_compound_padding(struct torture_context *tctx, smb2_util_close(tree, cr.out.file.handle); /* Check compound read from stream */ - smb2_transport_compound_start(tree->session->transport, 2); + smb2_transport_compound_start(tree->session->transport, 3); ZERO_STRUCT(cr); cr.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS; @@ -1210,6 +1210,14 @@ static bool test_compound_padding(struct torture_context *tctx, smb2_transport_compound_set_related(tree->session->transport, true); + /* + * We send 2 reads in the compound here as the protocol + * allows the last read to be split off and possibly + * go async. Check the padding on the first read returned, + * not the second as the second may not be part of the + * returned compound. + */ + ZERO_STRUCT(r); h.data[0] = UINT64_MAX; h.data[1] = UINT64_MAX; @@ -1219,6 +1227,15 @@ static bool test_compound_padding(struct torture_context *tctx, r.in.min_count = 1; req[1] = smb2_read_send(tree, &r); + ZERO_STRUCT(r2); + h.data[0] = UINT64_MAX; + h.data[1] = UINT64_MAX; + r2.in.file.handle = h; + r2.in.length = 3; + r2.in.offset = 0; + r2.in.min_count = 1; + req[2] = smb2_read_send(tree, &r2); + status = smb2_create_recv(req[0], tree, &cr); CHECK_STATUS(status, NT_STATUS_OK); @@ -1242,6 +1259,10 @@ static bool test_compound_padding(struct torture_context *tctx, status = smb2_read_recv(req[1], tree, &r); CHECK_STATUS(status, NT_STATUS_OK); + /* Pick up the second, possibly async, read. */ + status = smb2_read_recv(req[2], tree, &r2); + CHECK_STATUS(status, NT_STATUS_OK); + h = cr.out.file.handle; /* Check 2 compound (unrelateated) reads from existing stream handle */