summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2018-10-10 18:45:56 +0200
committerKarolin Seeger <kseeger@samba.org>2018-11-06 09:10:24 +0100
commite38c76eed418c54e089c0442974bfbb900d0ff45 (patch)
tree5403ee7328451735da9860f37799e95070663a2e /source4/torture
parent280722734964afa847280851f6d493e2f987f060 (diff)
downloadsamba-e38c76eed418c54e089c0442974bfbb900d0ff45.tar.gz
s4:torture/util: add torture_smb2_open()
This seems to be missing: a simple wrapper to just open a file without fancy options. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13646 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> (cherry picked from commit 64b28e4a94365092f46052712a38e6fcfbb9f20c)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/smb2/util.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source4/torture/smb2/util.c b/source4/torture/smb2/util.c
index 65090b0e8b7..ac8a0d5df77 100644
--- a/source4/torture/smb2/util.c
+++ b/source4/torture/smb2/util.c
@@ -528,6 +528,36 @@ NTSTATUS torture_smb2_testfile(struct smb2_tree *tree, const char *fname,
}
/*
+ create and return a handle to a test file
+ with a specific access mask
+*/
+NTSTATUS torture_smb2_open(struct smb2_tree *tree,
+ const char *fname,
+ uint32_t desired_access,
+ struct smb2_handle *handle)
+{
+ struct smb2_create io;
+ NTSTATUS status;
+
+ io = (struct smb2_create) {
+ .in.fname = fname,
+ .in.desired_access = desired_access,
+ .in.file_attributes = FILE_ATTRIBUTE_NORMAL,
+ .in.create_disposition = NTCREATEX_DISP_OPEN,
+ .in.share_access = NTCREATEX_SHARE_ACCESS_MASK,
+ };
+
+ status = smb2_create(tree, tree, &io);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ *handle = io.out.file.handle;
+
+ return NT_STATUS_OK;
+}
+
+/*
create and return a handle to a test directory
with specific desired access
*/