]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture/vfs/fruit: expand existing test "setinfo delete-on-close AFP_AfpInfo"...
authorRalph Boehme <slow@samba.org>
Tue, 9 Oct 2018 16:48:08 +0000 (18:48 +0200)
committerKarolin Seeger <kseeger@samba.org>
Tue, 6 Nov 2018 08:10:23 +0000 (09:10 +0100)
Add a check that verifies a create on a stream gets
NT_STATUS_DELETE_PENDING after delete-on-close has been set.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 0d9a80b6b2e3f51cad122ee0dc78c2f4dfdebcb5)

source4/torture/vfs/fruit.c

index 83b19d4694cd3c2a39b55ca377e300ce0e46f95c..ac7b6682e6d7d5f427236d22934f3ccc0e661382 100644 (file)
@@ -3450,6 +3450,10 @@ static bool test_setinfo_delete_on_close(struct torture_context *tctx,
        const char *sname = BASEDIR "\\file" AFPINFO_STREAM_NAME;
        const char *type_creator = "SMB,OLE!";
        AfpInfo *info = NULL;
+       const char *streams[] = {
+               AFPINFO_STREAM,
+               "::$DATA"
+       };
        const char *streams_basic[] = {
                "::$DATA"
        };
@@ -3491,6 +3495,19 @@ static bool test_setinfo_delete_on_close(struct torture_context *tctx,
        status = smb2_setinfo_file(tree, &sfinfo);
        torture_assert_ntstatus_ok_goto(tctx, status, ret, done, "set delete-on-close failed");
 
+       ret = check_stream_list(tree, tctx, fname, 2, streams, false);
+       torture_assert_goto(tctx, ret == true, ret, done, "Bad streams");
+
+       ZERO_STRUCT(create);
+       create.in.create_disposition = NTCREATEX_DISP_OPEN;
+       create.in.desired_access = SEC_FILE_ALL;
+       create.in.fname = sname;
+       create.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
+       create.in.impersonation_level = NTCREATEX_IMPERSONATION_IMPERSONATION;
+       status = smb2_create(tree, mem_ctx, &create);
+       torture_assert_ntstatus_equal_goto(tctx, status, NT_STATUS_DELETE_PENDING,
+                                          ret, done, "Got unexpected AFP_AfpInfo stream");
+
        smb2_util_close(tree, h1);
 
        ret = check_stream_list(tree, tctx, fname, 1, streams_basic, false);