summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2019-02-23 17:52:34 -0800
committerKarolin Seeger <kseeger@samba.org>2019-03-05 07:39:28 +0000
commit3060221960b6d76a98f1a3eaf8afefe12a0fc717 (patch)
tree834e919e80db470ff8bc270db81e5c8ae58b6127
parent89c3db2e9bbb39d3665db0f2eecd62f253771199 (diff)
downloadsamba-3060221960b6d76a98f1a3eaf8afefe12a0fc717.tar.gz
s3: smbtorture3: Add POSIX-MKDIR test for posix_mkdir case sensitive bug.
Test does: mkdir POSIX_foo mkdir POSIX_Foo mkdir POSIX_foo/Foo mkdir POSIX_foo/foo mkdir POSIX_Foo/Foo mkdir POSIX_Foo/foo Which should pass a SMB1 POSIX extensions server as posix mkdir should always be case sensitive no matter what the share is set to. Mark as knownfail for now. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13803 Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> (cherry picked from commit f0decb31fff24ceb57d23bebbfb87aa0e5103947)
-rw-r--r--selftest/knownfail1
-rw-r--r--selftest/skip1
-rwxr-xr-xsource3/selftest/tests.py2
-rw-r--r--source3/torture/torture.c100
4 files changed, 103 insertions, 1 deletions
diff --git a/selftest/knownfail b/selftest/knownfail
index 84776d4f35d..f4427fb4ab4 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -9,6 +9,7 @@
^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-REAUTH # expected to give ACCESS_DENIED SMB2.1 doesn't have encryption
^samba3.smbtorture_s3.crypt_server\(nt4_dc\).SMB2-SESSION-RECONNECT # expected to give CONNECTION_DISCONNECTED, we need to fix the test
^samba3.smbtorture_s3.*ad_dc_ntvfs.*SMB2-DIR-FSYNC.*
+^samba3.smbtorture_s3.*.POSIX-MKDIR
^samba3.smb2.session enc.reconnect # expected to give CONNECTION_DISCONNECTED, we need to fix the test
^samba3.raw.session enc # expected to give ACCESS_DENIED as SMB1 encryption isn't used
^samba3.smbtorture_s3.crypt_server # expected to give ACCESS_DENIED as SMB1 encryption isn't used
diff --git a/selftest/skip b/selftest/skip
index dd60ab5a1fb..4d6648f3369 100644
--- a/selftest/skip
+++ b/selftest/skip
@@ -48,6 +48,7 @@
^samba3.smbtorture_s3.plain\(ad_dc_ntvfs\).POSIX-SYMLINK-EA # Fails against the s4 ntvfs server
^samba3.smbtorture_s3.plain\(ad_dc_ntvfs\).POSIX-OFD-LOCK # Fails against the s4 ntvfs server
^samba3.smbtorture_s3.plain\(ad_dc_ntvfs\).POSIX-STREAM-DELETE # Fails against the s4 ntvfs server
+^samba3.smbtorture_s3.plain\(ad_dc_ntvfs\).POSIX-MKDIR # Fails against the s4 ntvfs server
^samba3.smbtorture_s3.plain\(ad_dc_ntvfs\).WINDOWS-BAD-SYMLINK # Fails against the s4 ntvfs server
^samba3.smbtorture_s3.plain\(ad_dc_ntvfs\).RENAME-ACCESS # Fails against the s4 ntvfs server
^samba3.smbtorture_s3.plain\(ad_dc_ntvfs\).OWNER-RIGHTS # Don't test against the s4 ntvfs server anymore
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 0625c7e924e..e5433a55118 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -117,7 +117,7 @@ for t in tests:
plantestsuite("samba3.smbtorture_s3.vfs_aio_fork(simpleserver).%s" % t, "simpleserver", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/vfs_aio_fork', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
posix_tests = ["POSIX", "POSIX-APPEND", "POSIX-SYMLINK-ACL", "POSIX-SYMLINK-EA", "POSIX-OFD-LOCK",
- "POSIX-STREAM-DELETE", "WINDOWS-BAD-SYMLINK" ]
+ "POSIX-STREAM-DELETE", "WINDOWS-BAD-SYMLINK", "POSIX-MKDIR" ]
for t in posix_tests:
plantestsuite("samba3.smbtorture_s3.plain(nt4_dc).%s" % t, "nt4_dc", [os.path.join(samba3srcdir, "script/tests/test_smbtorture_s3.sh"), t, '//$SERVER_IP/posix_share', '$USERNAME', '$PASSWORD', smbtorture3, "", "-l $LOCAL_PATH"])
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index ed7390a47a7..b81c679e330 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -7254,6 +7254,105 @@ static bool run_posix_ofd_lock_test(int dummy)
return correct;
}
+/*
+ Test POSIX mkdir is case-sensitive.
+ */
+static bool run_posix_mkdir_test(int dummy)
+{
+ static struct cli_state *cli;
+ const char *fname_foo = "POSIX_foo";
+ const char *fname_foo_Foo = "POSIX_foo/Foo";
+ const char *fname_foo_foo = "POSIX_foo/foo";
+ const char *fname_Foo = "POSIX_Foo";
+ const char *fname_Foo_Foo = "POSIX_Foo/Foo";
+ const char *fname_Foo_foo = "POSIX_Foo/foo";
+ bool correct = false;
+ NTSTATUS status;
+ TALLOC_CTX *frame = NULL;
+
+ frame = talloc_stackframe();
+
+ printf("Starting POSIX mkdir test\n");
+
+ if (!torture_open_connection(&cli, 0)) {
+ TALLOC_FREE(frame);
+ return false;
+ }
+
+ smbXcli_conn_set_sockopt(cli->conn, sockops);
+
+ status = torture_setup_unix_extensions(cli);
+ if (!NT_STATUS_IS_OK(status)) {
+ TALLOC_FREE(frame);
+ return false;
+ }
+
+ cli_posix_rmdir(cli, fname_foo_foo);
+ cli_posix_rmdir(cli, fname_foo_Foo);
+ cli_posix_rmdir(cli, fname_foo);
+
+ cli_posix_rmdir(cli, fname_Foo_foo);
+ cli_posix_rmdir(cli, fname_Foo_Foo);
+ cli_posix_rmdir(cli, fname_Foo);
+
+ status = cli_posix_mkdir(cli, fname_foo, 0777);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_posix_mkdir of %s failed\n", fname_foo);
+ goto out;
+ }
+
+ status = cli_posix_mkdir(cli, fname_Foo, 0777);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_posix_mkdir of %s failed\n", fname_Foo);
+ goto out;
+ }
+
+ status = cli_posix_mkdir(cli, fname_foo_foo, 0777);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_posix_mkdir of %s failed\n", fname_foo_foo);
+ goto out;
+ }
+
+ status = cli_posix_mkdir(cli, fname_foo_Foo, 0777);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_posix_mkdir of %s failed\n", fname_foo_Foo);
+ goto out;
+ }
+
+ status = cli_posix_mkdir(cli, fname_Foo_foo, 0777);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_posix_mkdir of %s failed\n", fname_Foo_foo);
+ goto out;
+ }
+
+ status = cli_posix_mkdir(cli, fname_Foo_Foo, 0777);
+ if (!NT_STATUS_IS_OK(status)) {
+ printf("cli_posix_mkdir of %s failed\n", fname_Foo_Foo);
+ goto out;
+ }
+
+ printf("POSIX mkdir test passed\n");
+ correct = true;
+
+ out:
+
+ cli_posix_rmdir(cli, fname_foo_foo);
+ cli_posix_rmdir(cli, fname_foo_Foo);
+ cli_posix_rmdir(cli, fname_foo);
+
+ cli_posix_rmdir(cli, fname_Foo_foo);
+ cli_posix_rmdir(cli, fname_Foo_Foo);
+ cli_posix_rmdir(cli, fname_Foo);
+
+ if (!torture_close_connection(cli)) {
+ correct = false;
+ }
+
+ TALLOC_FREE(frame);
+ return correct;
+}
+
+
static uint32_t open_attrs_table[] = {
FILE_ATTRIBUTE_NORMAL,
FILE_ATTRIBUTE_ARCHIVE,
@@ -11760,6 +11859,7 @@ static struct {
{"POSIX-SYMLINK-EA", run_ea_symlink_test, 0},
{"POSIX-STREAM-DELETE", run_posix_stream_delete, 0},
{"POSIX-OFD-LOCK", run_posix_ofd_lock_test, 0},
+ {"POSIX-MKDIR", run_posix_mkdir_test, 0},
{"WINDOWS-BAD-SYMLINK", run_symlink_open_test, 0},
{"CASE-INSENSITIVE-CREATE", run_case_insensitive_create, 0},
{"ASYNC-ECHO", run_async_echo, 0},