summaryrefslogtreecommitdiff
path: root/source4/torture/raw/notify.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2006-03-30 02:25:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:59:19 -0500
commit8e7078e14964f6332f2d786baa1bb9bb6b4b1717 (patch)
treeab08782d91b9280cb3afe1f26765b1bba4cb2c17 /source4/torture/raw/notify.c
parent8a95fa446e1eca4c9ff332202f23183411b44c04 (diff)
downloadsamba-8e7078e14964f6332f2d786baa1bb9bb6b4b1717.tar.gz
samba-8e7078e14964f6332f2d786baa1bb9bb6b4b1717.tar.bz2
samba-8e7078e14964f6332f2d786baa1bb9bb6b4b1717.zip
r14794: added a test to see what happens when you send a notify request on a
handle that already has a notify request pending. It turns out that they are queued (This used to be commit 15e9302bcd20a91446b19033333b743f1d257a66)
Diffstat (limited to 'source4/torture/raw/notify.c')
-rw-r--r--source4/torture/raw/notify.c66
1 files changed, 66 insertions, 0 deletions
diff --git a/source4/torture/raw/notify.c b/source4/torture/raw/notify.c
index 9f0d0e355d..699d24353a 100644
--- a/source4/torture/raw/notify.c
+++ b/source4/torture/raw/notify.c
@@ -489,6 +489,71 @@ done:
return ret;
}
+
+/*
+ test setting up two change notify requests on one handle
+*/
+static BOOL test_notify_double(struct smbcli_state *cli, TALLOC_CTX *mem_ctx)
+{
+ BOOL ret = True;
+ NTSTATUS status;
+ struct smb_notify notify;
+ union smb_open io;
+ int fnum;
+ struct smbcli_request *req1, *req2;
+
+ printf("TESTING CHANGE NOTIFY TWICE ON ONE DIRECTORY\n");
+
+ /*
+ get a handle on the directory
+ */
+ io.generic.level = RAW_OPEN_NTCREATEX;
+ io.ntcreatex.in.root_fid = 0;
+ io.ntcreatex.in.flags = 0;
+ io.ntcreatex.in.access_mask = SEC_FILE_ALL;
+ 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_OPEN;
+ io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
+ io.ntcreatex.in.security_flags = 0;
+ io.ntcreatex.in.fname = BASEDIR;
+
+ status = smb_raw_open(cli->tree, mem_ctx, &io);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ fnum = io.ntcreatex.out.file.fnum;
+
+ /* ask for a change notify,
+ on file or directory name changes */
+ notify.in.buffer_size = 1000;
+ notify.in.completion_filter = FILE_NOTIFY_CHANGE_NAME;
+ notify.in.file.fnum = fnum;
+ notify.in.recursive = True;
+
+ req1 = smb_raw_changenotify_send(cli->tree, &notify);
+ req2 = smb_raw_changenotify_send(cli->tree, &notify);
+
+ smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name");
+
+ status = smb_raw_changenotify_recv(req1, mem_ctx, &notify);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_VAL(notify.out.num_changes, 1);
+ CHECK_WSTR(notify.out.changes[0].name, "subdir-name", STR_UNICODE);
+
+ smbcli_mkdir(cli->tree, BASEDIR "\\subdir-name2");
+
+ status = smb_raw_changenotify_recv(req2, mem_ctx, &notify);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ CHECK_VAL(notify.out.num_changes, 1);
+ CHECK_WSTR(notify.out.changes[0].name, "subdir-name2", STR_UNICODE);
+
+
+done:
+ smb_raw_exit(cli->session);
+ return ret;
+}
+
/*
basic testing of change notify
*/
@@ -513,6 +578,7 @@ BOOL torture_raw_notify(struct torture_context *torture)
ret &= test_notify_tdis(mem_ctx);
ret &= test_notify_exit(mem_ctx);
ret &= test_notify_ulogoff(mem_ctx);
+ ret &= test_notify_double(cli, mem_ctx);
smb_raw_exit(cli->session);
smbcli_deltree(cli->tree, BASEDIR);