summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-04-03 14:36:53 +0200
committerVolker Lendecke <vlendec@samba.org>2011-04-03 16:13:21 +0200
commit32296a2c3653ef1a1fe2ef0e4939be421d1ee7a0 (patch)
tree0a4efdc749146ae933e9bda547d29b5b95fc1fbf /source3
parent2b94169cda00e31a3b7814996abf42635735b6ff (diff)
downloadsamba-32296a2c3653ef1a1fe2ef0e4939be421d1ee7a0.tar.gz
samba-32296a2c3653ef1a1fe2ef0e4939be421d1ee7a0.tar.bz2
samba-32296a2c3653ef1a1fe2ef0e4939be421d1ee7a0.zip
s3: Add a quick test for bug 8042
Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Sun Apr 3 16:13:21 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/Makefile.in1
-rwxr-xr-xsource3/selftest/tests.py1
-rw-r--r--source3/torture/proto.h1
-rw-r--r--source3/torture/test_case_insensitive.c79
-rw-r--r--source3/torture/torture.c1
-rwxr-xr-xsource3/wscript_build1
6 files changed, 84 insertions, 0 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index 05843efd63..a0f28f1e83 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -1213,6 +1213,7 @@ SMBTORTURE_OBJ1 = torture/torture.o torture/nbio.o torture/scanner.o torture/uta
torture/test_async_echo.o \
torture/test_smbsock_any_connect.o \
torture/test_addrchange.o \
+ torture/test_case_insensitive.o \
torture/test_posix_append.o
SMBTORTURE_OBJ = $(SMBTORTURE_OBJ1) $(PARAM_OBJ) $(TLDAP_OBJ) \
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index cf6f8a76d0..9ddb164b4d 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -59,6 +59,7 @@ tests=[ "FDPASS", "LOCK1", "LOCK2", "LOCK3", "LOCK4", "LOCK5", "LOCK6", "LOCK7",
"TCON2", "IOCTL", "CHKPATH", "FDSESS", "LOCAL-SUBSTITUTE", "CHAIN1",
"GETADDRINFO", "POSIX", "UID-REGRESSION-TEST", "SHORTNAME-TEST",
"LOCAL-BASE64", "LOCAL-GENCACHE", "POSIX-APPEND",
+ "CASE-INSENSITIVE-CREATE",
"LOCAL-string_to_sid", "LOCAL-CONVERT-STRING" ]
for t in tests:
diff --git a/source3/torture/proto.h b/source3/torture/proto.h
index f27a253f2d..a45aa153c4 100644
--- a/source3/torture/proto.h
+++ b/source3/torture/proto.h
@@ -81,6 +81,7 @@ bool torture_casetable(int dummy);
*/
bool run_posix_append(int dummy);
+bool run_case_insensitive_create(int dummy);
bool run_nbench2(int dummy);
bool run_async_echo(int dummy);
diff --git a/source3/torture/test_case_insensitive.c b/source3/torture/test_case_insensitive.c
new file mode 100644
index 0000000000..df9d149861
--- /dev/null
+++ b/source3/torture/test_case_insensitive.c
@@ -0,0 +1,79 @@
+/*
+ Unix SMB/CIFS implementation.
+ reproducer for bug 8042
+ Copyright (C) Volker Lendecke 2011
+
+ 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 "torture/proto.h"
+#include "system/filesys.h"
+
+/*
+ * Regression test file creates on case insensitive file systems (e.g. OS/X)
+ * https://bugzilla.samba.org/show_bug.cgi?id=8042
+ */
+
+bool run_case_insensitive_create(int dummy)
+{
+ struct cli_state *cli;
+ uint16_t fnum;
+ NTSTATUS status;
+
+ printf("Starting case_insensitive_create\n");
+
+ if (!torture_open_connection(&cli, 0)) {
+ return false;
+ }
+
+ status = cli_mkdir(cli, "x");
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_mkdir failed: %s\n", nt_errstr(status));
+ goto done;
+ }
+ status = cli_chkpath(cli, "X");
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_chkpath failed: %s\n", nt_errstr(status));
+ goto rmdir;
+ }
+ status = cli_open(cli, "x\\y", O_RDWR|O_CREAT, 0, &fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_open failed: %s\n", nt_errstr(status));
+
+ if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_IS_A_DIRECTORY)) {
+ printf("Bug 8042 reappeared!!\n");
+ }
+ goto unlink;
+ }
+ status = cli_close(cli, fnum);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_close failed: %s\n", nt_errstr(status));
+ goto done;
+ }
+unlink:
+ status = cli_unlink(cli, "x\\y", 0);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_unlink failed: %s\n", nt_errstr(status));
+ goto done;
+ }
+rmdir:
+ status = cli_rmdir(cli, "x");
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_close failed: %s\n", nt_errstr(status));
+ }
+done:
+ torture_close_connection(cli);
+ return NT_STATUS_IS_OK(status);
+}
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 87b03b4d44..6319d6194d 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -8224,6 +8224,7 @@ static struct {
{"OPEN", run_opentest, 0},
{"POSIX", run_simple_posix_open_test, 0},
{"POSIX-APPEND", run_posix_append, 0},
+ {"CASE-INSENSITIVE-CREATE", run_case_insensitive_create, 0},
{"ASYNC-ECHO", run_async_echo, 0},
{ "UID-REGRESSION-TEST", run_uid_regression_test, 0},
{ "SHORTNAME-TEST", run_shortname_test, 0},
diff --git a/source3/wscript_build b/source3/wscript_build
index 7a19af92e2..73b1a43af2 100755
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -562,6 +562,7 @@ SMBTORTURE_SRC1 = '''torture/torture.c torture/nbio.c torture/scanner.c torture/
torture/test_async_echo.c
torture/test_addrchange.c
torture/test_posix_append.c
+ torture/test_case_insensitive.c
torture/test_smbsock_any_connect.c'''
SMBTORTURE_SRC = '''${SMBTORTURE_SRC1}