From b730f350c2209236641d0423d4d0c00d43a24929 Mon Sep 17 00:00:00 2001 From: Ralph Wuerthner Date: Thu, 12 Sep 2019 11:16:50 +0200 Subject: 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 Reviewed-by: Volker Lendecke Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Thu Sep 12 17:36:50 UTC 2019 on sn-devel-184 --- source4/torture/smb2/create.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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); -- cgit v1.2.1