]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:torture: fix file cleanup in smb2.create.delete
authorRalph Wuerthner <ralph.wuerthner@de.ibm.com>
Thu, 12 Sep 2019 09:16:50 +0000 (11:16 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 12 Sep 2019 17:36:50 +0000 (17:36 +0000)
Cleanup of test files created by smb2.create.delete is broken because
READONLY is set on the test file. Clear READONLY first before doing
the cleanup.

Signed-off-by: Ralph Wuerthner <ralph.wuerthner@de.ibm.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Sep 12 17:36:50 UTC 2019 on sn-devel-184

source4/torture/smb2/create.c

index e35bf179ba5b705ac403870603aa4a1cdb80eda6..09bdd5aa6cdcc4f75335928e5e6c9ac0ae021f2f 100644 (file)
@@ -1135,8 +1135,16 @@ static bool test_smb2_open_for_delete(struct torture_context *tctx,
        io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
        status = smb2_create(tree, tctx, &(io.smb2));
        CHECK_STATUS(status, NT_STATUS_OK);
+       smb2_util_close(tree, io.smb2.out.file.handle);
 
-       smb2_util_unlink(tree, fname);
+       /* Clear readonly flag to allow file deletion */
+       io.smb2.in.desired_access = SEC_FILE_READ_ATTRIBUTE |
+                               SEC_FILE_WRITE_ATTRIBUTE;
+       status = smb2_create(tree, tctx, &(io.smb2));
+       CHECK_STATUS(status, NT_STATUS_OK);
+       h1 = io.smb2.out.file.handle;
+       SET_ATTRIB(FILE_ATTRIBUTE_ARCHIVE);
+       smb2_util_close(tree, h1);
 
        smb2_util_close(tree, h);
        smb2_util_unlink(tree, fname);