*/
NTSTATUS smb2_util_setatr(struct smb2_tree *tree, const char *name, uint32_t attrib)
{
- union smb_setfileinfo io;
-
- ZERO_STRUCT(io);
- io.basic_info.level = RAW_SFILEINFO_BASIC_INFORMATION;
- io.basic_info.in.file.path = name;
- io.basic_info.in.attrib = attrib;
+ struct smb2_create cr = {0};
+ struct smb2_handle h1 = {{0}};
+ union smb_setfileinfo setinfo;
+ NTSTATUS status;
+
+ cr = (struct smb2_create) {
+ .in.desired_access = SEC_FILE_WRITE_ATTRIBUTE,
+ .in.share_access = NTCREATEX_SHARE_ACCESS_MASK,
+ .in.create_disposition = FILE_OPEN,
+ .in.fname = name,
+ };
+ status = smb2_create(tree, tree, &cr);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ h1 = cr.out.file.handle;
- return smb2_composite_setpathinfo(tree, &io);
+ setinfo = (union smb_setfileinfo) {
+ .basic_info.level = RAW_SFILEINFO_BASIC_INFORMATION,
+ .basic_info.in.file.handle = h1,
+ .basic_info.in.attrib = attrib,
+ };
+
+ status = smb2_setinfo_file(tree, &setinfo);
+ if (!NT_STATUS_IS_OK(status)) {
+ smb2_util_close(tree, h1);
+ return status;
+ }
+
+ smb2_util_close(tree, h1);
+ return NT_STATUS_OK;
}
h1 = io.smb2.out.file.handle;
CHECK_VAL(io.smb2.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH);
- torture_comment(tctx, "changing the file attribute info should trigger "
- "a break and a violation\n");
-
status = smb2_util_setatr(tree1, fname, FILE_ATTRIBUTE_HIDDEN);
- torture_assert_ntstatus_equal(tctx, status, NT_STATUS_SHARING_VIOLATION,
- "Incorrect status");
-
- torture_wait_for_oplock_break(tctx);
- CHECK_VAL(break_info.count, 1);
+ torture_assert_ntstatus_ok(tctx, status, "Setting attributes "
+ "shouldn't trigger an oplock break");
smb2_util_close(tree1, h1);
smb2_util_close(tree1, h);