summaryrefslogtreecommitdiff
path: root/source4/torture/smb2/dir.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-09-22 04:04:46 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:19:13 -0500
commit8c3b54f01dfc7275c7ff0ec194cd68ea072a8186 (patch)
tree6d34b821a0993372a937c553a723c0cf174917fa /source4/torture/smb2/dir.c
parent4f913d91cb75377555d2858becde0f34ab7f6f49 (diff)
downloadsamba-8c3b54f01dfc7275c7ff0ec194cd68ea072a8186.tar.gz
samba-8c3b54f01dfc7275c7ff0ec194cd68ea072a8186.tar.bz2
samba-8c3b54f01dfc7275c7ff0ec194cd68ea072a8186.zip
r18808: added SMB2-MAXWRITE test and SMB2-DIR tests
expanded size of dangerous level for write in SMB2-CONNECT test (This used to be commit 355c6e78a91f4e934479829e722f873ca7e66baf)
Diffstat (limited to 'source4/torture/smb2/dir.c')
-rw-r--r--source4/torture/smb2/dir.c94
1 files changed, 94 insertions, 0 deletions
diff --git a/source4/torture/smb2/dir.c b/source4/torture/smb2/dir.c
new file mode 100644
index 0000000000..c30adb1e41
--- /dev/null
+++ b/source4/torture/smb2/dir.c
@@ -0,0 +1,94 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ SMB2 dir list test suite
+
+ Copyright (C) Andrew Tridgell 2005
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include "includes.h"
+#include "libcli/smb2/smb2.h"
+#include "libcli/smb2/smb2_calls.h"
+
+#include "torture/torture.h"
+#include "torture/smb2/proto.h"
+
+/*
+ test find continue
+*/
+static BOOL torture_smb2_find_dir(struct smb2_tree *tree)
+{
+ struct smb2_handle handle;
+ NTSTATUS status;
+ int i;
+ struct smb2_find f;
+ BOOL ret = True;
+ union smb_search_data *d;
+ uint_t count;
+
+ status = smb2_util_roothandle(tree, &handle);
+ if (!NT_STATUS_IS_OK(status)) {
+ return False;
+ }
+
+ ZERO_STRUCT(f);
+ f.in.file.handle = handle;
+ f.in.pattern = "*";
+ f.in.continue_flags = SMB2_CONTINUE_FLAG_SINGLE;
+ f.in.max_response_size = 0x100;
+ f.in.level = SMB2_FIND_BOTH_DIRECTORY_INFO;
+
+ do {
+ status = smb2_find_level(tree, tree, &f, &count, &d);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("SMB2_FIND_ID_BOTH_DIRECTORY_INFO failed - %s\n", nt_errstr(status));
+ break;
+ }
+
+ printf("Got %d files\n", count);
+ for (i=0;i<count;i++) {
+ printf("\t'%s'\n",
+ d[i].both_directory_info.name.s);
+ }
+ f.in.continue_flags = 0;
+ f.in.max_response_size = 4096;
+ } while (count != 0);
+
+
+ return ret;
+}
+
+
+/*
+ basic testing of directory listing with continue
+*/
+BOOL torture_smb2_dir(struct torture_context *torture)
+{
+ TALLOC_CTX *mem_ctx = talloc_new(NULL);
+ struct smb2_tree *tree;
+ BOOL ret = True;
+
+ if (!torture_smb2_connection(mem_ctx, &tree)) {
+ return False;
+ }
+
+ ret &= torture_smb2_find_dir(tree);
+
+ talloc_free(mem_ctx);
+
+ return ret;
+}