summaryrefslogtreecommitdiff
path: root/source3/torture
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/torture
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/torture')
-rw-r--r--source3/torture/proto.h1
-rw-r--r--source3/torture/test_case_insensitive.c79
-rw-r--r--source3/torture/torture.c1
3 files changed, 81 insertions, 0 deletions
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},