From: Ralph Wuerthner Date: Thu, 12 Sep 2019 09:16:50 +0000 (+0200) Subject: s4:torture: fix file cleanup in smb2.create.delete X-Git-Tag: talloc-2.3.1~854 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b730f350c2209236641d0423d4d0c00d43a24929;p=thirdparty%2Fsamba.git 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 --- 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);