static bool test_doc_find_and_set_doc(struct torture_context *tctx, struct smb2_tree *tree)
{
- struct smb2_create io;
+ struct smb2_handle dir_handle;
struct smb2_find find;
NTSTATUS status;
union smb_search_data *d;
union smb_setfileinfo sfinfo;
unsigned int count;
- uint32_t perms = 0;
-
- perms = SEC_STD_SYNCHRONIZE | SEC_STD_READ_CONTROL | SEC_STD_DELETE |
- SEC_DIR_WRITE_ATTRIBUTE | SEC_DIR_READ_ATTRIBUTE |
- SEC_DIR_WRITE_EA | SEC_FILE_APPEND_DATA |
- SEC_FILE_WRITE_DATA | SEC_DIR_LIST;
/* File should not exist for this first test, so make sure */
set_dir_delete_perms(tctx, tree);
smb2_deltree(tree, DNAME);
- create_dir(tctx, tree);
-
torture_comment(tctx, "FIND and delete directory\n");
torture_comment(tctx, "We expect NT_STATUS_OK\n");
- /* open the directory first */
- ZERO_STRUCT(io);
- io.in.desired_access = perms;
- io.in.file_attributes = FILE_ATTRIBUTE_DIRECTORY;
- io.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
- io.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
- NTCREATEX_SHARE_ACCESS_DELETE;
- io.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
- io.in.fname = DNAME;
-
- status = smb2_create(tree, tctx, &io);
+ /* create and open the directory first*/
+ status = torture_smb2_testdir(tree, DNAME, &dir_handle);
CHECK_STATUS(status, NT_STATUS_OK);
/* list directory */
ZERO_STRUCT(find);
- find.in.file.handle = io.out.file.handle;
+ find.in.file.handle = dir_handle;
find.in.pattern = "*";
find.in.continue_flags = SMB2_CONTINUE_FLAG_SINGLE;
find.in.max_response_size = 0x100;
ZERO_STRUCT(sfinfo);
sfinfo.generic.level = RAW_SFILEINFO_DISPOSITION_INFORMATION;
sfinfo.disposition_info.in.delete_on_close = 1;
- sfinfo.generic.in.file.handle = io.out.file.handle;
+ sfinfo.generic.in.file.handle = dir_handle;
status = smb2_setinfo_file(tree, &sfinfo);
CHECK_STATUS(status, NT_STATUS_OK);
/* close directory */
- status = smb2_util_close(tree, io.out.file.handle);
+ status = smb2_util_close(tree, dir_handle);
CHECK_STATUS(status, NT_STATUS_OK);
return true;
}