summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Wuerthner <ralph.wuerthner@de.ibm.com>2019-09-12 11:16:50 +0200
committerJeremy Allison <jra@samba.org>2019-09-12 17:36:50 +0000
commitb730f350c2209236641d0423d4d0c00d43a24929 (patch)
tree55a5da1011f93714b0d8acd5cbe5abc2b2e70bd0
parentaa5b2333283871cc573b3013669c64c3edd3684c (diff)
downloadsamba-b730f350c2209236641d0423d4d0c00d43a24929.tar.gz
s4:torture: fix file cleanup in smb2.create.delete
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
-rw-r--r--source4/torture/smb2/create.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source4/torture/smb2/create.c b/source4/torture/smb2/create.c
index e35bf179ba5..09bdd5aa6cd 100644
--- a/source4/torture/smb2/create.c
+++ b/source4/torture/smb2/create.c
@@ -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);