summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalph Boehme <slow@samba.org>2015-08-12 11:06:15 +0200
committerStefan Metzmacher <metze@samba.org>2015-09-01 01:38:42 +0200
commitc1c5a2e545de0e581fc1966852cea48526df4771 (patch)
tree36b5cf0323ec7fb4b85eef4a2f2f15b71f700401
parent8464dcfa540c5202254e1ccc09eede598e8afc67 (diff)
downloadsamba-c1c5a2e545de0e581fc1966852cea48526df4771.tar.gz
selftest: add a check for disabled change notify
Bug: https://bugzilla.samba.org/show_bug.cgi?id=11444 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Mon Aug 31 15:50:49 CEST 2015 on sn-devel-104 (cherry picked from commit 770fb8cd07bd047b5206a2a7fe01eb14d9077eea) Autobuild-User(v4-3-test): Stefan Metzmacher <metze@samba.org> Autobuild-Date(v4-3-test): Tue Sep 1 01:38:43 CEST 2015 on sn-devel-104
-rwxr-xr-xsource3/selftest/tests.py2
-rwxr-xr-xsource4/selftest/tests.py4
-rw-r--r--source4/torture/smb2/notify_disabled.c119
-rw-r--r--source4/torture/smb2/smb2.c1
-rw-r--r--source4/torture/smb2/wscript_build2
5 files changed, 126 insertions, 2 deletions
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 1833b9f3713..be3cf0e109f 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -386,6 +386,8 @@ for t in tests:
elif t == "local.nss":
for env in ["nt4_dc:local", "ad_member:local", "nt4_member:local", "ad_dc:local", "ad_dc_ntvfs:local"]:
plansmbtorture4testsuite(t, env, '//$SERVER/tmp -U$USERNAME%$PASSWORD')
+ elif t == "smb2.change_notify_disabled":
+ plansmbtorture4testsuite(t, "simpleserver", '//$SERVER/tmp -U$USERNAME%$PASSWORD')
elif t == "smb2.notify":
plansmbtorture4testsuite(t, "nt4_dc", '//$SERVER_IP/tmp -U$USERNAME%$PASSWORD --signing=required')
plansmbtorture4testsuite(t, "ad_dc", '//$SERVER/tmp -U$USERNAME%$PASSWORD --signing=required')
diff --git a/source4/selftest/tests.py b/source4/selftest/tests.py
index 6a30164e932..e284c2ca1fa 100755
--- a/source4/selftest/tests.py
+++ b/source4/selftest/tests.py
@@ -234,7 +234,9 @@ for t in nbt_tests:
# Tests against the NTVFS POSIX backend
ntvfsargs = ["--option=torture:sharedelay=100000", "--option=torture:oplocktimeout=3", "--option=torture:writetimeupdatedelay=500000"]
-smb2 = smbtorture4_testsuites("smb2.")
+# smb2.change_notify_disabled must only run against env fileserver-notify-disabled
+smb2 = filter(lambda x: "smb2.change_notify_disabled" not in x, smbtorture4_testsuites("smb2."))
+
#The QFILEINFO-IPC test needs to be on ipc$
raw = filter(lambda x: "raw.qfileinfo.ipc" not in x, smbtorture4_testsuites("raw."))
base = smbtorture4_testsuites("base.")
diff --git a/source4/torture/smb2/notify_disabled.c b/source4/torture/smb2/notify_disabled.c
new file mode 100644
index 00000000000..0faeb519d19
--- /dev/null
+++ b/source4/torture/smb2/notify_disabled.c
@@ -0,0 +1,119 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ SMB2 notify test suite
+
+ Copyright (C) Stefan Metzmacher 2006
+ Copyright (C) Andrew Tridgell 2009
+ Copyright (C) Ralph Boehme 2015
+
+ 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 3 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, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "includes.h"
+#include "libcli/smb2/smb2.h"
+#include "libcli/smb2/smb2_calls.h"
+#include "../libcli/smb/smbXcli_base.h"
+
+#include "torture/torture.h"
+#include "torture/smb2/proto.h"
+#include "librpc/gen_ndr/ndr_security.h"
+#include "libcli/security/security.h"
+#include "torture/util.h"
+
+#include "system/filesys.h"
+#include "auth/credentials/credentials.h"
+#include "lib/cmdline/popt_common.h"
+#include "librpc/gen_ndr/security.h"
+
+#include "lib/events/events.h"
+
+#include "libcli/raw/libcliraw.h"
+#include "libcli/raw/raw_proto.h"
+#include "libcli/libcli.h"
+
+#define BASEDIR "test_notify_disabled"
+
+/*
+ basic testing of change notify on directories
+*/
+static bool torture_smb2_notify_disabled(struct torture_context *torture,
+ struct smb2_tree *tree1)
+{
+ bool ret = true;
+ NTSTATUS status;
+ union smb_notify notify;
+ union smb_open io;
+ struct smb2_handle h1;
+ struct smb2_request *req;
+
+ torture_comment(torture, "TESTING CHANGE NOTIFY DISABLED\n");
+
+ smb2_deltree(tree1, BASEDIR);
+ smb2_util_rmdir(tree1, BASEDIR);
+ /*
+ get a handle on the directory
+ */
+ ZERO_STRUCT(io.smb2);
+ io.generic.level = RAW_OPEN_SMB2;
+ io.smb2.in.create_flags = 0;
+ io.smb2.in.desired_access = SEC_FILE_ALL;
+ io.smb2.in.create_options = NTCREATEX_OPTIONS_DIRECTORY;
+ io.smb2.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
+ io.smb2.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
+ NTCREATEX_SHARE_ACCESS_WRITE;
+ io.smb2.in.alloc_size = 0;
+ io.smb2.in.create_disposition = NTCREATEX_DISP_CREATE;
+ io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
+ io.smb2.in.security_flags = 0;
+ io.smb2.in.fname = BASEDIR;
+
+ status = smb2_create(tree1, torture, &(io.smb2));
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "smb2_create");
+ h1 = io.smb2.out.file.handle;
+
+ ZERO_STRUCT(notify.smb2);
+ notify.smb2.level = RAW_NOTIFY_SMB2;
+ notify.smb2.in.buffer_size = 1000;
+ notify.smb2.in.completion_filter = FILE_NOTIFY_CHANGE_NAME;
+ notify.smb2.in.file.handle = h1;
+ notify.smb2.in.recursive = true;
+
+ req = smb2_notify_send(tree1, &(notify.smb2));
+ status = smb2_notify_recv(req, torture, &(notify.smb2));
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_NOT_IMPLEMENTED,
+ ret, done, "smb2_notify_recv");
+
+ status = smb2_util_close(tree1, h1);
+ torture_assert_ntstatus_equal_goto(torture, status, NT_STATUS_OK,
+ ret, done, "smb2_create");
+
+done:
+ smb2_deltree(tree1, BASEDIR);
+ return ret;
+}
+
+/*
+ basic testing of SMB2 change notify
+*/
+struct torture_suite *torture_smb2_notify_disabled_init(void)
+{
+ struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "change_notify_disabled");
+
+ torture_suite_add_1smb2_test(suite, "notfiy_disabled", torture_smb2_notify_disabled);
+ suite->description = talloc_strdup(suite, "SMB2-CHANGE-NOTIFY-DISABLED tests");
+
+ return suite;
+}
diff --git a/source4/torture/smb2/smb2.c b/source4/torture/smb2/smb2.c
index 853c4f62802..0124cf1252b 100644
--- a/source4/torture/smb2/smb2.c
+++ b/source4/torture/smb2/smb2.c
@@ -155,6 +155,7 @@ NTSTATUS torture_smb2_init(void)
torture_suite_add_suite(suite, torture_smb2_create_init());
torture_suite_add_suite(suite, torture_smb2_acls_init());
torture_suite_add_suite(suite, torture_smb2_notify_init());
+ torture_suite_add_suite(suite, torture_smb2_notify_disabled_init());
torture_suite_add_suite(suite, torture_smb2_durable_open_init());
torture_suite_add_suite(suite, torture_smb2_durable_open_disconnect_init());
torture_suite_add_suite(suite, torture_smb2_durable_v2_open_init());
diff --git a/source4/torture/smb2/wscript_build b/source4/torture/smb2/wscript_build
index 3c374bb81b5..1c593efcc76 100644
--- a/source4/torture/smb2/wscript_build
+++ b/source4/torture/smb2/wscript_build
@@ -4,7 +4,7 @@ bld.SAMBA_MODULE('TORTURE_SMB2',
source='''connect.c scan.c util.c getinfo.c setinfo.c lock.c notify.c
smb2.c durable_open.c durable_v2_open.c oplock.c dir.c lease.c create.c
acls.c read.c compound.c streams.c ioctl.c rename.c
- session.c delete-on-close.c replay.c''',
+ session.c delete-on-close.c replay.c notify_disabled.c''',
subsystem='smbtorture',
deps='LIBCLI_SMB2 POPT_CREDENTIALS torture NDR_IOCTL',
internal_module=True,