summaryrefslogtreecommitdiff
path: root/source4/torture/torture_util.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-08-13 22:23:18 +0000
committerAndrew Tridgell <tridge@samba.org>2003-08-13 22:23:18 +0000
commit4b3d329ca21e731729af0a305386bee5d748ae92 (patch)
tree8a8a63dfb52dedd131e750b6fd81543913c741f2 /source4/torture/torture_util.c
parenta33f57077686a096917c7e7433852d320a593348 (diff)
downloadsamba-4b3d329ca21e731729af0a305386bee5d748ae92.tar.gz
samba-4b3d329ca21e731729af0a305386bee5d748ae92.tar.bz2
samba-4b3d329ca21e731729af0a305386bee5d748ae92.zip
- added a raw smb scanner
- its not a root_fid in ntrename (This used to be commit 74be55efdc77d4ba7e70d0554cbd72472522abff)
Diffstat (limited to 'source4/torture/torture_util.c')
-rw-r--r--source4/torture/torture_util.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/source4/torture/torture_util.c b/source4/torture/torture_util.c
index c8fb8a84b2..7fa8e1133b 100644
--- a/source4/torture/torture_util.c
+++ b/source4/torture/torture_util.c
@@ -35,6 +35,41 @@ double end_timer(void)
(tp2.tv_usec - tp1.tv_usec)*1.0e-6);
}
+
+/*
+ create a directory, returning a handle to it
+*/
+int create_directory_handle(struct cli_state *cli, const char *dname)
+{
+ NTSTATUS status;
+ union smb_open io;
+ TALLOC_CTX *mem_ctx;
+
+ mem_ctx = talloc_init("create_directory_handle");
+
+ io.generic.level = RAW_OPEN_NTCREATEX;
+ io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.flags = 0;
+ io.ntcreatex.in.access_mask = SA_RIGHT_FILE_ALL_ACCESS;
+ io.ntcreatex.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
+ io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
+ io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ | NTCREATEX_SHARE_ACCESS_WRITE;
+ io.ntcreatex.in.alloc_size = 0;
+ io.ntcreatex.in.open_disposition = NTCREATEX_DISP_CREATE;
+ io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
+ io.ntcreatex.in.security_flags = 0;
+ io.ntcreatex.in.fname = dname;
+
+ status = smb_raw_open(cli->tree, mem_ctx, &io);
+ if (!NT_STATUS_IS_OK(status)) {
+ talloc_destroy(mem_ctx);
+ return -1;
+ }
+
+ talloc_destroy(mem_ctx);
+ return io.ntcreatex.out.fnum;
+}
+
/*
sometimes we need a fairly complex file to work with, so we can test
all possible attributes.