summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-07-12 10:14:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:10:05 -0500
commitdd2d3b082c837ef01803f3a69371992400861a32 (patch)
treefcaef77b07ef229372b701ebce48f81e257f4111 /source4/torture
parent1e5529f9ef6d2b26dd5e562bf838f2c77d4cb4d9 (diff)
downloadsamba-dd2d3b082c837ef01803f3a69371992400861a32.tar.gz
samba-dd2d3b082c837ef01803f3a69371992400861a32.tar.bz2
samba-dd2d3b082c837ef01803f3a69371992400861a32.zip
r16977: do a few more notify tests
metze (This used to be commit 07b27333d5c3bb833d3e9fa5ee99470679a15da9)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/smb2/notify.c74
1 files changed, 70 insertions, 4 deletions
diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c
index 4805a75d68..74cec16b8c 100644
--- a/source4/torture/smb2/notify.c
+++ b/source4/torture/smb2/notify.c
@@ -43,6 +43,8 @@
goto done; \
}} while (0)
+#define FNAME "smb2-notify01.dat"
+
static BOOL test_valid_request(TALLOC_CTX *mem_ctx, struct smb2_tree *tree)
{
BOOL ret = True;
@@ -54,19 +56,83 @@ static BOOL test_valid_request(TALLOC_CTX *mem_ctx, struct smb2_tree *tree)
status = smb2_util_roothandle(tree, &dh);
CHECK_STATUS(status, NT_STATUS_OK);
- n.in.recursive = 0x0001;
- n.in.buffer_size = 0x00000020;
+ n.in.recursive = 0x0000;
+ n.in.buffer_size = 0x00080000;
n.in.file.handle = dh;
- n.in.completion_filter = 0x0000001F;
+ n.in.completion_filter = 0x00000FFF;
n.in.unknown = 0x00000000;
req = smb2_notify_send(tree, &n);
- status = torture_setup_complex_file(tree, "smb2-notify1.dat");
+ status = torture_setup_complex_file(tree, FNAME);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ status = smb2_notify_recv(req, mem_ctx, &n);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ /*
+ * if the change response doesn't fit in the buffer
+ * NOTIFY_ENUM_DIR is returned.
+ */
+ n.in.buffer_size = 0x00000000;
+ req = smb2_notify_send(tree, &n);
+
+ status = torture_setup_complex_file(tree, FNAME);
CHECK_STATUS(status, NT_STATUS_OK);
status = smb2_notify_recv(req, mem_ctx, &n);
CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
+ /*
+ * if the change response fits in the buffer we get
+ * NT_STATUS_OK again
+ */
+ n.in.buffer_size = 0x00080000;
+ req = smb2_notify_send(tree, &n);
+
+ status = torture_setup_complex_file(tree, FNAME);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ status = smb2_notify_recv(req, mem_ctx, &n);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ /* if the first notify returns NOTIFY_ENUM_DIR, all do */
+ status = smb2_util_close(tree, dh);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ status = smb2_util_roothandle(tree, &dh);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ n.in.recursive = 0x0000;
+ n.in.buffer_size = 0x00000001;
+ n.in.file.handle = dh;
+ n.in.completion_filter = 0x00000FFF;
+ n.in.unknown = 0x00000000;
+ req = smb2_notify_send(tree, &n);
+
+ status = torture_setup_complex_file(tree, FNAME);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ status = smb2_notify_recv(req, mem_ctx, &n);
+ CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
+
+ n.in.buffer_size = 0x00080000;
+ req = smb2_notify_send(tree, &n);
+
+ status = torture_setup_complex_file(tree, FNAME);
+ CHECK_STATUS(status, NT_STATUS_OK);
+
+ status = smb2_notify_recv(req, mem_ctx, &n);
+ CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
+
+ /* if the buffer size is too large, we get invalid parameter */
+ n.in.recursive = 0x0000;
+ n.in.buffer_size = 0x00080001;
+ n.in.file.handle = dh;
+ n.in.completion_filter = 0x00000FFF;
+ n.in.unknown = 0x00000000;
+ req = smb2_notify_send(tree, &n);
+ status = smb2_notify_recv(req, mem_ctx, &n);
+ CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
+
done:
return ret;
}