summaryrefslogtreecommitdiff
path: root/source4/torture/smb2/notify.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-07-06 12:03:33 +0200
committerStefan Metzmacher <metze@samba.org>2009-07-06 13:28:12 +0200
commit9216b2040c8af5699a7d3e484addfcda41142641 (patch)
tree02637f396cee9e0e95a0e73b418f3a5f7d09405f /source4/torture/smb2/notify.c
parent5d4d9d333d2bac8ec8ae882cdfd19e1d79c898b4 (diff)
downloadsamba-9216b2040c8af5699a7d3e484addfcda41142641.tar.gz
samba-9216b2040c8af5699a7d3e484addfcda41142641.tar.bz2
samba-9216b2040c8af5699a7d3e484addfcda41142641.zip
SMB2-NOTIFY: windows7 uses a different maximum buffer size
metze
Diffstat (limited to 'source4/torture/smb2/notify.c')
-rw-r--r--source4/torture/smb2/notify.c33
1 files changed, 21 insertions, 12 deletions
diff --git a/source4/torture/smb2/notify.c b/source4/torture/smb2/notify.c
index 574136ab3f..f8def193b2 100644
--- a/source4/torture/smb2/notify.c
+++ b/source4/torture/smb2/notify.c
@@ -55,19 +55,28 @@
#define FNAME "smb2-notify01.dat"
-static bool test_valid_request(TALLOC_CTX *mem_ctx, struct smb2_tree *tree)
+#define TARGET_IS_WIN7(_tctx) (torture_setting_bool(_tctx, "win7", false))
+
+static bool test_valid_request(struct torture_context *tctx, struct smb2_tree *tree)
{
bool ret = true;
NTSTATUS status;
struct smb2_handle dh;
struct smb2_notify n;
struct smb2_request *req;
+ uint32_t max_buffer_size = 0x00080000;
+
+ if (TARGET_IS_WIN7(tctx)) {
+ max_buffer_size = 0x00010000;
+ }
+
+ smb2_util_unlink(tree, FNAME);
status = smb2_util_roothandle(tree, &dh);
CHECK_STATUS(status, NT_STATUS_OK);
n.in.recursive = 0x0000;
- n.in.buffer_size = 0x00080000;
+ n.in.buffer_size = max_buffer_size;
n.in.file.handle = dh;
n.in.completion_filter = 0x00000FFF;
n.in.unknown = 0x00000000;
@@ -82,10 +91,10 @@ static bool test_valid_request(TALLOC_CTX *mem_ctx, struct smb2_tree *tree)
status = torture_setup_complex_file(tree, FNAME);
CHECK_STATUS(status, NT_STATUS_OK);
- status = smb2_notify_recv(req, mem_ctx, &n);
+ status = smb2_notify_recv(req, tctx, &n);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(n.out.num_changes, 1);
- CHECK_VALUE(n.out.changes[0].action, NOTIFY_ACTION_REMOVED);
+ CHECK_VALUE(n.out.changes[0].action, NOTIFY_ACTION_ADDED);
CHECK_WIRE_STR(n.out.changes[0].name, FNAME);
/*
@@ -104,14 +113,14 @@ static bool test_valid_request(TALLOC_CTX *mem_ctx, struct smb2_tree *tree)
status = torture_setup_complex_file(tree, FNAME);
CHECK_STATUS(status, NT_STATUS_OK);
- status = smb2_notify_recv(req, mem_ctx, &n);
+ status = smb2_notify_recv(req, tctx, &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;
+ n.in.buffer_size = max_buffer_size;
req = smb2_notify_send(tree, &n);
while (!req->cancel.can_cancel && req->state <= SMB2_REQUEST_RECV) {
@@ -123,7 +132,7 @@ static bool test_valid_request(TALLOC_CTX *mem_ctx, struct smb2_tree *tree)
status = torture_setup_complex_file(tree, FNAME);
CHECK_STATUS(status, NT_STATUS_OK);
- status = smb2_notify_recv(req, mem_ctx, &n);
+ status = smb2_notify_recv(req, tctx, &n);
CHECK_STATUS(status, NT_STATUS_OK);
CHECK_VALUE(n.out.num_changes, 3);
CHECK_VALUE(n.out.changes[0].action, NOTIFY_ACTION_REMOVED);
@@ -155,10 +164,10 @@ static bool test_valid_request(TALLOC_CTX *mem_ctx, struct smb2_tree *tree)
status = torture_setup_complex_file(tree, FNAME);
CHECK_STATUS(status, NT_STATUS_OK);
- status = smb2_notify_recv(req, mem_ctx, &n);
+ status = smb2_notify_recv(req, tctx, &n);
CHECK_STATUS(status, STATUS_NOTIFY_ENUM_DIR);
- n.in.buffer_size = 0x00080000;
+ n.in.buffer_size = max_buffer_size;
req = smb2_notify_send(tree, &n);
while (!req->cancel.can_cancel && req->state <= SMB2_REQUEST_RECV) {
if (event_loop_once(req->transport->socket->event.ctx) != 0) {
@@ -169,17 +178,17 @@ static bool test_valid_request(TALLOC_CTX *mem_ctx, struct smb2_tree *tree)
status = torture_setup_complex_file(tree, FNAME);
CHECK_STATUS(status, NT_STATUS_OK);
- status = smb2_notify_recv(req, mem_ctx, &n);
+ status = smb2_notify_recv(req, tctx, &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.buffer_size = max_buffer_size + 1;
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);
+ status = smb2_notify_recv(req, tctx, &n);
CHECK_STATUS(status, NT_STATUS_INVALID_PARAMETER);
done: