]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4: torture: Tweak the compound padding streamfile test to send 3 reads instead of...
authorJeremy Allison <jra@samba.org>
Fri, 18 Nov 2022 21:30:05 +0000 (13:30 -0800)
committerRalph Boehme <slow@samba.org>
Thu, 1 Dec 2022 15:04:58 +0000 (15:04 +0000)
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 <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source4/torture/smb2/compound.c

index 607ec5d5958bc6066b66d59e28433c93604eda5c..2fb6f11d533b2759ca9325c8e6340889283e77e5 100644 (file)
@@ -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 */