[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Sun Feb 24 13:05:01 UTC 2019


The branch, master has been updated
       via  12da33e2bbc smbd: unix_convert: Ensure we don't call get_real_filename on POSIX paths.
       via  980db8debde smbd: SMB1-POSIX: Add missing info-level SMB_POSIX_PATH_OPEN for UCF_UNIX_NAME_LOOKUP flag.
       via  f0decb31fff s3: smbtorture3: Add POSIX-MKDIR test for posix_mkdir case sensitive bug.
      from  9b9565c3e69 winbindd: set idmap cache entries as the last step in async wb_xids2sids

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 12da33e2bbce657f25abe9bc4cb936ca4615b30f
Author: Jeremy Allison <jra at samba.org>
Date:   Sat Feb 23 12:24:31 2019 -0800

    smbd: unix_convert: Ensure we don't call get_real_filename on POSIX paths.
    
    For posix_pathnames don't blunder into the name_has_wildcard OR
    get_real_filename() codepaths as they may be doing case insensitive lookups.
    So when creating a new POSIX directory 'Foo' they might
    match on name 'foo'.
    
    Remove POSIX-MKDIR from knownfail.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13803
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Sun Feb 24 14:04:14 CET 2019 on sn-devel-144

commit 980db8debde68f9edce13fc01bc45a904379cffd
Author: Jeremy Allison <jra at samba.org>
Date:   Sat Feb 23 12:26:01 2019 -0800

    smbd: SMB1-POSIX: Add missing info-level SMB_POSIX_PATH_OPEN for UCF_UNIX_NAME_LOOKUP flag.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13803
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

commit f0decb31fff24ceb57d23bebbfb87aa0e5103947
Author: Jeremy Allison <jra at samba.org>
Date:   Sat Feb 23 17:52:34 2019 -0800

    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 at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 selftest/skip             |   1 +
 source3/selftest/tests.py |   2 +-
 source3/smbd/filename.c   |  25 +++++++++++
 source3/smbd/trans2.c     |   1 +
 source3/torture/torture.c | 103 ++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 131 insertions(+), 1 deletion(-)


Changeset truncated at 500 lines:

diff --git a/selftest/skip b/selftest/skip
index f59f824147c..b88412c082d 100644
--- a/selftest/skip
+++ b/selftest/skip
@@ -48,6 +48,7 @@
 ^samba3.smbtorture_s3.plain.POSIX-SYMLINK-EA\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
 ^samba3.smbtorture_s3.plain.POSIX-OFD-LOCK\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
 ^samba3.smbtorture_s3.plain.POSIX-STREAM-DELETE\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
+^samba3.smbtorture_s3.plain.POSIX-MKDIR\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
 ^samba3.smbtorture_s3.plain.WINDOWS-BAD-SYMLINK\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
 ^samba3.smbtorture_s3.plain.RENAME-ACCESS\(ad_dc_ntvfs\) # Fails against the s4 ntvfs server
 ^samba3.smbtorture_s3.plain.OWNER-RIGHTS\(ad_dc_ntvfs\) # Don't test against the s4 ntvfs server anymore
diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py
index 30a93a2ee42..5d7e4969e59 100755
--- a/source3/selftest/tests.py
+++ b/source3/selftest/tests.py
@@ -153,7 +153,7 @@ for s in shares:
     plansmbtorture4testsuite(t, "simpleserver", "//%s/%s %s" % ('$SERVER_IP', s, ' -U$USERNAME%$PASSWORD'), description=s)
 
 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.%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/smbd/filename.c b/source3/smbd/filename.c
index d861b51771b..098489abaa5 100644
--- a/source3/smbd/filename.c
+++ b/source3/smbd/filename.c
@@ -926,6 +926,31 @@ NTSTATUS unix_convert(TALLOC_CTX *ctx,
 			/* Stat failed - ensure we don't use it. */
 			SET_STAT_INVALID(smb_fname->st);
 
+			if (posix_pathnames) {
+				/*
+				 * For posix_pathnames, we're done.
+				 * Don't blunder into the name_has_wildcard OR
+				 * get_real_filename() codepaths as they may
+				 * be doing case insensitive lookups. So when
+				 * creating a new POSIX directory Foo they might
+				 * match on name foo.
+				 *
+				 * BUG: https://bugzilla.samba.org/show_bug.cgi?id=13803
+				 */
+				if (errno == ENOENT) {
+					/* New file or directory. */
+					goto done;
+				}
+				if ((errno == EACCES) &&
+				    (ucf_flags & UCF_PREP_CREATEFILE)) {
+					/* POSIX Dropbox case. */
+					errno = 0;
+					goto done;
+				}
+				status = map_nt_error_from_unix(errno);
+				goto fail;
+			}
+
 			/*
 			 * Reset errno so we can detect
 			 * directory open errors.
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index d3497fed0b4..108bd570922 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -8840,6 +8840,7 @@ static void call_trans2setfilepathinfo(connection_struct *conn,
 		if (info_level == SMB_SET_FILE_UNIX_BASIC ||
 				info_level == SMB_SET_FILE_UNIX_INFO2 ||
 				info_level == SMB_FILE_RENAME_INFORMATION ||
+				info_level == SMB_POSIX_PATH_OPEN ||
 				info_level == SMB_POSIX_PATH_UNLINK) {
 			ucf_flags |= UCF_UNIX_NAME_LOOKUP;
 		}
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index c4c8754bcb4..0723fcb4e2b 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -7256,6 +7256,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,
@@ -11895,6 +11994,10 @@ static struct {
 		.name  = "POSIX-OFD-LOCK",
 		.fn    = run_posix_ofd_lock_test,
 	},
+	{
+		.name  = "POSIX-MKDIR",
+		.fn    = run_posix_mkdir_test,
+	},
 	{
 		.name  = "WINDOWS-BAD-SYMLINK",
 		.fn    = run_symlink_open_test,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list