summaryrefslogtreecommitdiff
path: root/source4/torture/smb2
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:11:24 +0100
commit0a16d4fc03b903a536581fa15066860a4e0cbb90 (patch)
tree3990b14c9dc1adf593bac8913b8f48599382f4b5 /source4/torture/smb2
parente03f36aac4587e0620a6e3d577c10c111f6137a1 (diff)
downloadsamba-0a16d4fc03b903a536581fa15066860a4e0cbb90.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/smb2')
-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
*/