s3: Add a quick test for bug 8042
authorVolker Lendecke <vl@samba.org>
Sun, 3 Apr 2011 12:36:53 +0000 (14:36 +0200)
committerVolker Lendecke <vlendec@samba.org>
Sun, 3 Apr 2011 14:13:21 +0000 (16:13 +0200)
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sun Apr  3 16:13:21 CEST 2011 on sn-devel-104

source3/Makefile.in
source3/selftest/tests.py
source3/torture/proto.h
source3/torture/test_case_insensitive.c [new file with mode: 0644]
source3/torture/torture.c
source3/wscript_build

index 05843efd63c005ed5c599d304c96a030f329fba0..a0f28f1e83c06e944f00ad70d8d0c8609d29abae 100644 (file)
@@ -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) \
index cf6f8a76d0660175099108cf23f0aeca49152087..9ddb164b4d59bedc722e194397e9f5c9f52c4987 100755 (executable)
@@ -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:
index f27a253f2de6ddf1cd4e04c849d5958ecd035f80..a45aa153c4390dbcc7242ce323ad61e06ef6cc9e 100644 (file)
@@ -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 (file)
index 0000000..df9d149
--- /dev/null
@@ -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);
+}
index 87b03b4d44ebcf5338d9c83cf0e62a0242160d27..6319d6194d7cf488a29de99bedbcd92c19427cda 100644 (file)
@@ -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},
index 7a19af92e2001a615eb22159d97d681c0879663d..73b1a43af23d367ed621866282ffdce55edd973d 100755 (executable)
@@ -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}