[SCM] Samba Shared Repository - branch v4-7-test updated

Karolin Seeger kseeger at samba.org
Wed Apr 4 14:57:02 UTC 2018


The branch, v4-7-test has been updated
       via  8ac2ffa s4: torture: Test all combinations of directory open with existing directory to ensure behavior is the same.
       via  2500fe7 s4: torture: Test all combinations of directory create to ensure behavior is the same.
       via  ada7126 s4: torture: Test all combinations of file open with existing file to ensure behavior is the same.
       via  1d8c67f s4: torture: Test all combinations of file create to ensure behavior is the same.
       via  052ca44 s4: torture: Ensure a failed file create doesn't create the file.
       via  bd2c850 s3: smbd: Files or directories can't be opened DELETE_ON_CLOSE without delete access.
       via  9f2bae3 Allow AESNI to be used on all processor supporting AESNI, not just Intel's This improves performance/reduced CPU usage. Tests performed: - Ran on Ivy Bridge and Ryzen and verified that AESNI is detected (crypto tests) - Ran on Ryzen, and observed 50% increased speed.
       via  b44b079 smbc_opendir should not return EEXIST with invalid login credentials
      from  214291f s3: docs: Add documentation for "smb2" and "smb2_credits" debug classes.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-7-test


- Log -----------------------------------------------------------------
commit 8ac2ffaa0060cff4df92e1c90ff4b648a301d74d
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Mar 28 13:19:12 2018 -0700

    s4: torture: Test all combinations of directory open with existing directory to ensure behavior is the same.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Mar 29 23:13:42 CEST 2018 on sn-devel-144
    
    (cherry picked from commit c98cd0f25edaae7558f18fd331e2fef3aabb61f2)
    
    Autobuild-User(v4-7-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-7-test): Wed Apr  4 16:56:29 CEST 2018 on sn-devel-144

commit 2500fe7c4014f3da3d768360be6cad5d29c3c35b
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Mar 28 13:17:14 2018 -0700

    s4: torture: Test all combinations of directory create to ensure behavior is the same.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
    (cherry picked from commit fd9084336e7e86ccec83141d880fd7c336c23b6c)

commit ada71264ddf1b19ae17e593015b12bf3b523be39
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Mar 28 11:44:40 2018 -0700

    s4: torture: Test all combinations of file open with existing file to ensure behavior is the same.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
    (cherry picked from commit 820b35bb1ceb445eb3659b67eedfb0a2f5b2f976)

commit 1d8c67f44feaf4c2b3c6b9ae2dcdbb965c94f7ae
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Mar 28 11:00:59 2018 -0700

    s4: torture: Test all combinations of file create to ensure behavior is the same.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
    (cherry picked from commit 22fe8dcb77565495886244e88bb0433363d1f80a)

commit 052ca448aca47bbd23ab10a667f392adaa594ed6
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Mar 28 10:54:30 2018 -0700

    s4: torture: Ensure a failed file create doesn't create the file.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
    (cherry picked from commit 53cdf7a9a18ed547eade4c3cdd80d286058e440d)

commit bd2c850c3dd74b3a8e9ff7a4d4af1cfe7cf87079
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Mar 28 12:42:20 2018 -0700

    s3: smbd: Files or directories can't be opened DELETE_ON_CLOSE without delete access.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Volker Lendecke <Volker.Lendecke at SerNet.DE>
    (cherry picked from commit 2514bee0a3b0a12430e2679ee590075c54d4803a)

commit 9f2bae39970e020420238edfff7aa999bd5ba52a
Author: Eric Vannier <evannier at google.com>
Date:   Thu Mar 22 21:32:56 2018 -0700

    Allow AESNI to be used on all processor supporting AESNI, not just Intel's This improves performance/reduced CPU usage. Tests performed: - Ran on Ivy Bridge and Ryzen and verified that AESNI is detected (crypto tests) - Ran on Ryzen, and observed 50% increased speed.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13302
    
    Signed-off-by: Eric Vannier <evannier at google.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Björn Jacke <bjacke at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Mar 27 13:50:09 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 77d88d75f6262a855e818a9b2b4018f8b6ced7b0)

commit b44b0791c09e63d6bd5fa5afac22dee8ef801d05
Author: David Mulder <dmulder at suse.com>
Date:   Thu Nov 2 08:25:11 2017 -0600

    smbc_opendir should not return EEXIST with invalid login credentials
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13050
    
    Signed-off-by: David Mulder <dmulder at suse.com>
    
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jim McDonough <jmcd at samba.org>
    
    Autobuild-User(master): Jim McDonough <jmcd at samba.org>
    Autobuild-Date(master): Thu Nov  9 01:49:06 CET 2017 on sn-devel-144
    
    (cherry picked from commit 7470b9b18af282a742929d3fc90f4be5520428a1)

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

Summary of changes:
 lib/crypto/aes.c               |  16 ---
 source3/libsmb/libsmb_server.c |   4 +-
 source3/smbd/open.c            |  12 ++
 source4/torture/basic/delete.c | 257 +++++++++++++++++++++++++++++++++++++++--
 4 files changed, 260 insertions(+), 29 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/crypto/aes.c b/lib/crypto/aes.c
index c226ac1..d16d715 100644
--- a/lib/crypto/aes.c
+++ b/lib/crypto/aes.c
@@ -66,22 +66,6 @@ static bool has_intel_aes_instructions(void)
 		return (bool)has_aes_instructions;
 	}
 
-	__cpuid(cpuid_results, 0);
-	/*
-	 *        MSB         LSB
-	 *  EBX = 'u' 'n' 'e' 'G'
-	 *  EDX = 'I' 'e' 'n' 'i'
-	 *  ECX = 'l' 'e' 't' 'n'
-	 */
-	if (memcmp((unsigned char *)&cpuid_results[1], "Genu", 4) != 0 ||
-			memcmp((unsigned char *)&cpuid_results[3],
-				"ineI", 4) != 0 ||
-			memcmp((unsigned char *)&cpuid_results[2],
-				"ntel", 4) != 0) {
-		has_aes_instructions = 0;
-		return (bool)has_aes_instructions;
-	}
-
 	__cpuid(cpuid_results, 1);
 	has_aes_instructions = !!(cpuid_results[2] & (1 << 25));
 	return (bool)has_aes_instructions;
diff --git a/source3/libsmb/libsmb_server.c b/source3/libsmb/libsmb_server.c
index 2d41f2f..e6067be 100644
--- a/source3/libsmb/libsmb_server.c
+++ b/source3/libsmb/libsmb_server.c
@@ -360,8 +360,8 @@ SMBC_server_internal(TALLOC_CTX *ctx,
 						  "?????",
 						  *pp_password);
 			if (!NT_STATUS_IS_OK(status)) {
-                                errno = map_errno_from_nt_status(status);
                                 cli_shutdown(srv->cli);
+                                errno = map_errno_from_nt_status(status);
 				srv->cli = NULL;
                                 smbc_getFunctionRemoveCachedServer(context)(context,
                                                                             srv);
@@ -571,8 +571,8 @@ SMBC_server_internal(TALLOC_CTX *ctx,
 
 	status = cli_tree_connect_creds(c, share, "?????", creds);
 	if (!NT_STATUS_IS_OK(status)) {
-		errno = map_errno_from_nt_status(status);
 		cli_shutdown(c);
+		errno = map_errno_from_nt_status(status);
 		return NULL;
 	}
 
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 8c52f4b..cd2f1c0 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -5075,6 +5075,18 @@ static NTSTATUS create_file_unixpath(connection_struct *conn,
 		goto fail;
 	}
 
+	/*
+	 * Files or directories can't be opened DELETE_ON_CLOSE without
+	 * delete access.
+	 * BUG: https://bugzilla.samba.org/show_bug.cgi?id=13358
+	 */
+	if (create_options & FILE_DELETE_ON_CLOSE) {
+		if ((access_mask & DELETE_ACCESS) == 0) {
+			status = NT_STATUS_INVALID_PARAMETER;
+			goto fail;
+		}
+	}
+
 	if ((conn->fs_capabilities & FILE_NAMED_STREAMS)
 	    && is_ntfs_stream_smb_fname(smb_fname)
 	    && (!(private_flags & NTCREATEX_OPTIONS_PRIVATE_STREAM_DELETE))) {
diff --git a/source4/torture/basic/delete.c b/source4/torture/basic/delete.c
index 21af05c..20586a5 100644
--- a/source4/torture/basic/delete.c
+++ b/source4/torture/basic/delete.c
@@ -476,21 +476,124 @@ static bool deltest8(struct torture_context *tctx, struct smbcli_state *cli1, st
 static bool deltest9(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2)
 {
 	int fnum1 = -1;
+	NTSTATUS status;
+	uint32_t disps[4] = {
+			NTCREATEX_DISP_SUPERSEDE,
+			NTCREATEX_DISP_OVERWRITE_IF,
+			NTCREATEX_DISP_CREATE,
+			NTCREATEX_DISP_OPEN_IF};
+	unsigned int i;
 
 	del_clean_area(cli1, cli2);
 
-	/* This should fail - we need to set DELETE_ACCESS. */
-	fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0,
-				      SEC_FILE_READ_DATA|SEC_FILE_WRITE_DATA,
-				      FILE_ATTRIBUTE_NORMAL, 
-				      NTCREATEX_SHARE_ACCESS_NONE, 
-				      NTCREATEX_DISP_OVERWRITE_IF, 
-				      NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0);
-	
-	torture_assert(tctx, fnum1 == -1, 
-				   talloc_asprintf(tctx, "open of %s succeeded should have failed!", 
-		       fname));
+	for (i = 0; i < sizeof(disps)/sizeof(disps[0]); i++) {
+		/* This should fail - we need to set DELETE_ACCESS. */
+
+		/*
+		 * A file or directory create with DELETE_ON_CLOSE but
+		 * without DELETE_ACCESS should fail with
+		 * NT_STATUS_INVALID_PARAMETER.
+		 */
+
+		fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0,
+				SEC_FILE_READ_DATA|SEC_FILE_WRITE_DATA,
+				FILE_ATTRIBUTE_NORMAL,
+				NTCREATEX_SHARE_ACCESS_NONE,
+				disps[i],
+				NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0);
+
+		torture_assert(tctx, fnum1 == -1,
+			talloc_asprintf(tctx, "open of %s succeeded "
+				"should have failed!",
+			fname));
+
+		/* Must fail with NT_STATUS_INVALID_PARAMETER. */
+		status = smbcli_nt_error(cli1->tree);
+		torture_assert_ntstatus_equal(tctx,
+			status,
+			NT_STATUS_INVALID_PARAMETER,
+			talloc_asprintf(tctx, "create of %s should return "
+				"NT_STATUS_INVALID_PARAMETER, got %s",
+			fname,
+			smbcli_errstr(cli1->tree)));
+
+		/* This should fail - the file should not have been created. */
+		status = smbcli_getatr(cli1->tree, fname, NULL, NULL, NULL);
+		torture_assert_ntstatus_equal(tctx,
+			status,
+			NT_STATUS_OBJECT_NAME_NOT_FOUND,
+			talloc_asprintf(tctx, "getattr of %s succeeded should "
+				"not have been created !",
+			fname));
+	}
+
+	return true;
+}
 
+/* Test 9a ... */
+static bool deltest9a(struct torture_context *tctx,
+			struct smbcli_state *cli1,
+			struct smbcli_state *cli2)
+{
+	int fnum1 = -1;
+	NTSTATUS status;
+	uint32_t disps[4] = {
+			NTCREATEX_DISP_OVERWRITE_IF,
+			NTCREATEX_DISP_OPEN,
+			NTCREATEX_DISP_OVERWRITE,
+			NTCREATEX_DISP_OPEN_IF};
+
+	unsigned int i;
+
+	del_clean_area(cli1, cli2);
+
+	/* Create the file, and try with open calls. */
+	fnum1 = smbcli_open(cli1->tree, fname, O_CREAT|O_RDWR, DENY_NONE);
+	torture_assert(tctx,
+			fnum1 != -1,
+			talloc_asprintf(tctx, "open of %s failed (%s)",
+			fname,
+			smbcli_errstr(cli1->tree)));
+	status = smbcli_close(cli1->tree, fnum1);
+	torture_assert_ntstatus_ok(tctx,
+				status,
+				talloc_asprintf(tctx, "close failed"));
+
+	for (i = 0; i < sizeof(disps)/sizeof(disps[0]); i++) {
+		fnum1 = smbcli_nt_create_full(cli1->tree, fname, 0,
+				SEC_FILE_READ_DATA|SEC_FILE_WRITE_DATA,
+				FILE_ATTRIBUTE_NORMAL,
+				NTCREATEX_SHARE_ACCESS_NONE,
+				disps[i],
+				NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0);
+
+		torture_assert(tctx, fnum1 == -1,
+			talloc_asprintf(tctx, "open of %s succeeded "
+				"should have failed!",
+			fname));
+
+		/* Must fail with NT_STATUS_INVALID_PARAMETER. */
+		status = smbcli_nt_error(cli1->tree);
+		torture_assert_ntstatus_equal(tctx,
+			status,
+			NT_STATUS_INVALID_PARAMETER,
+			talloc_asprintf(tctx, "create of %s should return "
+				"NT_STATUS_INVALID_PARAMETER, got %s",
+			fname,
+			smbcli_errstr(cli1->tree)));
+
+		/*
+		 * This should succeed - the file should not have been deleted.
+		 */
+		status = smbcli_getatr(cli1->tree, fname, NULL, NULL, NULL);
+		torture_assert_ntstatus_ok(tctx,
+			status,
+			talloc_asprintf(tctx, "getattr of %s failed %s",
+			fname,
+			smbcli_errstr(cli1->tree)));
+	}
+
+	del_clean_area(cli1, cli2);
 	return true;
 }
 
@@ -2201,6 +2304,135 @@ static bool deltest23(struct torture_context *tctx,
 	return true;
 }
 
+/* Test 25 ... */
+static bool deltest25(struct torture_context *tctx,
+			struct smbcli_state *cli1,
+			struct smbcli_state *cli2)
+{
+	int fnum1 = -1;
+	NTSTATUS status;
+	uint32_t disps[4] = {
+			NTCREATEX_DISP_SUPERSEDE,
+			NTCREATEX_DISP_OVERWRITE_IF,
+			NTCREATEX_DISP_CREATE,
+			NTCREATEX_DISP_OPEN_IF};
+	unsigned int i;
+
+	del_clean_area(cli1, cli2);
+
+	for (i = 0; i < sizeof(disps)/sizeof(disps[0]); i++) {
+		/* This should fail - we need to set DELETE_ACCESS. */
+
+		/*
+		 * A file or directory create with DELETE_ON_CLOSE but
+		 * without DELETE_ACCESS should fail with
+		 * NT_STATUS_INVALID_PARAMETER.
+		 */
+
+		fnum1 = smbcli_nt_create_full(cli1->tree, dname, 0,
+				SEC_FILE_READ_DATA,
+				FILE_ATTRIBUTE_DIRECTORY,
+				NTCREATEX_SHARE_ACCESS_NONE,
+				disps[i],
+				NTCREATEX_OPTIONS_DIRECTORY|
+				NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0);
+
+		torture_assert(tctx, fnum1 == -1,
+			talloc_asprintf(tctx, "open of %s succeeded "
+				"should have failed!",
+			dname));
+
+		/* Must fail with NT_STATUS_INVALID_PARAMETER. */
+		status = smbcli_nt_error(cli1->tree);
+		torture_assert_ntstatus_equal(tctx,
+			status,
+			NT_STATUS_INVALID_PARAMETER,
+			talloc_asprintf(tctx, "create of %s should return "
+				"NT_STATUS_INVALID_PARAMETER, got %s",
+			dname,
+			smbcli_errstr(cli1->tree)));
+
+		/*
+		 * This should fail - the directory
+		 * should not have been created.
+		 */
+		status = smbcli_getatr(cli1->tree, dname, NULL, NULL, NULL);
+		torture_assert_ntstatus_equal(tctx,
+			status,
+			NT_STATUS_OBJECT_NAME_NOT_FOUND,
+			talloc_asprintf(tctx, "getattr of %s succeeded should "
+				"not have been created !",
+			dname));
+	}
+
+	return true;
+}
+
+/* Test 25a... */
+static bool deltest25a(struct torture_context *tctx,
+		struct smbcli_state *cli1,
+		struct smbcli_state *cli2)
+{
+	int fnum1 = -1;
+	NTSTATUS status;
+	uint32_t disps[4] = {
+			NTCREATEX_DISP_OVERWRITE_IF,
+			NTCREATEX_DISP_OPEN,
+			NTCREATEX_DISP_OVERWRITE,
+			NTCREATEX_DISP_OPEN_IF};
+
+	unsigned int i;
+
+	del_clean_area(cli1, cli2);
+
+	/* Create the directory, and try with open calls. */
+	status = smbcli_mkdir(cli1->tree, dname);
+	torture_assert_ntstatus_ok(tctx,
+		status,
+		talloc_asprintf(tctx, "mkdir of %s failed %s",
+		dname,
+		smbcli_errstr(cli1->tree)));
+
+	for (i = 0; i < sizeof(disps)/sizeof(disps[0]); i++) {
+		fnum1 = smbcli_nt_create_full(cli1->tree, dname, 0,
+				SEC_FILE_READ_DATA,
+				FILE_ATTRIBUTE_DIRECTORY,
+				NTCREATEX_SHARE_ACCESS_NONE,
+				disps[i],
+				NTCREATEX_OPTIONS_DIRECTORY|
+				NTCREATEX_OPTIONS_DELETE_ON_CLOSE, 0);
+
+		torture_assert(tctx, fnum1 == -1,
+			talloc_asprintf(tctx, "open of %s succeeded "
+				"should have failed!",
+			dname));
+
+		/* Must fail with NT_STATUS_INVALID_PARAMETER. */
+		status = smbcli_nt_error(cli1->tree);
+		torture_assert_ntstatus_equal(tctx,
+			status,
+			NT_STATUS_INVALID_PARAMETER,
+			talloc_asprintf(tctx, "create of %s should return "
+				"NT_STATUS_INVALID_PARAMETER, got %s",
+			dname,
+			smbcli_errstr(cli1->tree)));
+
+		/*
+		 * This should succeed - the directory
+		 * should not have been deleted.
+		 */
+		status = smbcli_getatr(cli1->tree, dname, NULL, NULL, NULL);
+		torture_assert_ntstatus_ok(tctx,
+			status,
+			talloc_asprintf(tctx, "getattr of %s failed %s",
+			fname,
+			smbcli_errstr(cli1->tree)));
+	}
+
+	del_clean_area(cli1, cli2);
+	return true;
+}
+
 /*
   Test delete on close semantics.
  */
@@ -2218,6 +2450,7 @@ struct torture_suite *torture_test_delete(TALLOC_CTX *ctx)
 	torture_suite_add_2smb_test(suite, "deltest7", deltest7);
 	torture_suite_add_2smb_test(suite, "deltest8", deltest8);
 	torture_suite_add_2smb_test(suite, "deltest9", deltest9);
+	torture_suite_add_2smb_test(suite, "deltest9a", deltest9a);
 	torture_suite_add_2smb_test(suite, "deltest10", deltest10);
 	torture_suite_add_2smb_test(suite, "deltest11", deltest11);
 	torture_suite_add_2smb_test(suite, "deltest12", deltest12);
@@ -2241,6 +2474,8 @@ struct torture_suite *torture_test_delete(TALLOC_CTX *ctx)
 	torture_suite_add_simple_test(suite, "deltest21", deltest21);
 	torture_suite_add_simple_test(suite, "deltest22", deltest22);
 	torture_suite_add_2smb_test(suite, "deltest23", deltest23);
+	torture_suite_add_2smb_test(suite, "deltest25", deltest25);
+	torture_suite_add_2smb_test(suite, "deltest25a", deltest25a);
 
 	return suite;
 }


-- 
Samba Shared Repository



More information about the samba-cvs mailing list