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

Karolin Seeger kseeger at samba.org
Thu Jul 9 13:05:03 UTC 2020


The branch, v4-12-test has been updated
       via  b0d00ee45c1 s3:smbd: make sure vfs_ChDir() always sets conn->cwd_fsp->fh->fd = AT_FDCWD
       via  33a160124a1 s3:smbd: reformat if statement for caching in vfs_ChDir()
       via  a909b50c0ca s4:torture/smb2: add smb2.delete-on-close-perms.BUG14427
       via  2eb07a97d2f s3:winbind:idmap_ad - make failure to get attrnames for schema mode fatal
       via  e21b6f0ce2b lib/debug: set the correct default backend loglevel to MAX_DEBUG_LEVEL
       via  b88952b3d67 lib/debug: assert file backend
      from  b53b7fc274e selftest: Run test of how userPassword / crypt() style passwords are stored in quicktest

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


- Log -----------------------------------------------------------------
commit b0d00ee45c121f2743e22dc3141687252b0d5b88
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Jul 1 09:38:58 2020 +0200

    s3:smbd: make sure vfs_ChDir() always sets conn->cwd_fsp->fh->fd = AT_FDCWD
    
    This is what all consumers of conn->cwd_fsp->fh->fd expect!
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14427
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit f3f330f61db983f6d213a097d9a4d91b1057ecb1)
    
    Autobuild-User(v4-12-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-12-test): Thu Jul  9 13:04:14 UTC 2020 on sn-devel-184

commit 33a160124a108f0765c30a7473b8ff897e4ac9f1
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jul 2 12:06:28 2020 +0200

    s3:smbd: reformat if statement for caching in vfs_ChDir()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14427
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit b2b5ae090ee8796609eb0b5794bc4e62c24414ef)

commit a909b50c0cad109276a47d516f0f467b8ae8bead
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Jul 2 14:32:34 2020 +0200

    s4:torture/smb2: add smb2.delete-on-close-perms.BUG14427
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14427
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    (cherry picked from commit bcba4bb210d9482be4c2c8dadfb5cc185046cbaa)

commit 2eb07a97d2f83acb7a2c51d13e67367e38e39de7
Author: Andrew <awalker at ixsystems.com>
Date:   Tue Jun 30 06:54:06 2020 -0400

    s3:winbind:idmap_ad - make failure to get attrnames for schema mode fatal
    
    Add check for failure to resolve the OID array for the schema mode into
    names.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14425
    
    Signed-off-by: Andrew <awalker at ixsystems.com>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    (cherry picked from commit b5b801026edd3a8fd8d0ba1752e891453cf675c9)

commit e21b6f0ce2bf28b5ea98804434f5b432dd445bf4
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Jun 30 17:03:05 2020 +0200

    lib/debug: set the correct default backend loglevel to MAX_DEBUG_LEVEL
    
    This fixed a regression introduced by commit
    c83ce5f4f99aef94530411ec82cc03e9935b352d for bug #14345.
    
    The backend loglevel globally restricts logging of a particular backend. If this
    value is smaller then any explicitly configured logging class, logging for this
    class is skipped.
    
    Eg, given the following logging config in smb.conf:
    
      log level = 1 auth_json_audit:3@/var/log/samba/samba_auth_audit.log
    
    the default class loglevel of 1 (dbgc_config[DBGC_ALL].loglevel) will be
    assigned to the backend loglevel.
    
    So even though the logging class auth_json_audit is configured at level 3, this
    doesn't become effective as the file backend drops all log messages with a level
    below 1.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14426
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Andreas Schneider <asn at cryptomilk.org>
    Autobuild-Date(master): Thu Jul  2 13:25:29 UTC 2020 on sn-devel-184
    
    (cherry picked from commit 71488b812fe737df2d3439a6ff3f95bb69b4a5bd)

commit b88952b3d675ad9b10ae5800276becdf6c39cf2a
Author: Ralph Boehme <slow at samba.org>
Date:   Tue Jun 30 17:02:07 2020 +0200

    lib/debug: assert file backend
    
    The debug file backend is a built-in default, if it's missing we're totally
    screwed.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14426
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    (cherry picked from commit 5aeaa6959da326095e98f0369b6d91dc5667415e)

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

Summary of changes:
 lib/util/debug.c                       | 12 +++++-----
 source3/smbd/vfs.c                     | 40 +++++++++++++++++++++++++++++--
 source3/winbindd/idmap_ad.c            |  8 +++++++
 source4/torture/smb2/delete-on-close.c | 43 +++++++++++++++++++++++++++++++++-
 4 files changed, 94 insertions(+), 9 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/util/debug.c b/lib/util/debug.c
index d990a6bf2b0..1650551a766 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -30,6 +30,7 @@
 #include "util_strlist.h" /* LIST_SEP */
 #include "blocking.h"
 #include "debug.h"
+#include <assert.h>
 
 /* define what facility to use for syslog */
 #ifndef SYSLOG_FACILITY
@@ -1113,6 +1114,7 @@ static bool reopen_one_log(int *fd, const char *logfile)
 */
 bool reopen_logs_internal(void)
 {
+	struct debug_backend *b = NULL;
 	mode_t oldumask;
 	int new_fd = 0;
 	size_t i;
@@ -1140,15 +1142,13 @@ bool reopen_logs_internal(void)
 		dbgc_config[DBGC_ALL].fd = 2;
 		return true;
 
-	case DEBUG_FILE: {
-		struct debug_backend *b = debug_find_backend("file");
+	case DEBUG_FILE:
+		b = debug_find_backend("file");
+		assert(b != NULL);
 
-		if (b != NULL) {
-			b->log_level = dbgc_config[DBGC_ALL].loglevel;
-		}
+		b->log_level = MAX_DEBUG_LEVEL;
 		break;
 	}
-	}
 
 	oldumask = umask( 022 );
 
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 96067e45005..411999c3856 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -876,11 +876,47 @@ int vfs_ChDir(connection_struct *conn, const struct smb_filename *smb_fname)
 	}
 
 	if (ISDOT(smb_fname->base_name)) {
+		/*
+		 * passing a '.' is a noop,
+		 * and we only expect this after
+		 * everything is initialized.
+		 *
+		 * So the first vfs_ChDir() on a given
+		 * connection_struct must not be '.'.
+		 *
+		 * Note: conn_new() sets
+		 * conn->cwd_fsp->fh->fd = -1
+		 * and vfs_ChDir() leaves with
+		 * conn->cwd_fsp->fh->fd = AT_FDCWD
+		 * on success!
+		 */
+		if (conn->cwd_fsp->fh->fd != AT_FDCWD) {
+			/*
+			 * This should never happen and
+			 * we might change this to
+			 * SMB_ASSERT() in future.
+			 */
+			DBG_ERR("Called with '.' as first operation!\n");
+			log_stack_trace();
+			errno = EINVAL;
+			return -1;
+		}
 		return 0;
 	}
 
-	if (*smb_fname->base_name == '/' &&
-			strcsequal(LastDir,smb_fname->base_name)) {
+	if (smb_fname->base_name[0] == '/' &&
+	    strcsequal(LastDir,smb_fname->base_name))
+	{
+		/*
+		 * conn->cwd_fsp->fsp_name and the kernel
+		 * are already correct, but conn->cwd_fsp->fh->fd
+		 * might still be -1 as initialized in conn_new().
+		 *
+		 * This can happen when a client made a 2nd
+		 * tree connect to a share with the same underlying
+		 * path (may or may not the same share).
+		 */
+		conn->cwd_fsp->fh->fd = AT_FDCWD;
 		return 0;
 	}
 
diff --git a/source3/winbindd/idmap_ad.c b/source3/winbindd/idmap_ad.c
index a93c61f54d1..6d879cdf4d7 100644
--- a/source3/winbindd/idmap_ad.c
+++ b/source3/winbindd/idmap_ad.c
@@ -162,6 +162,14 @@ static TLDAPRC get_attrnames_by_oids(struct tldap_context *ld,
 	}
 
 	TALLOC_FREE(msgs);
+	for (i=0; i<num_oids; i++) {
+		if (names[i] == NULL) {
+			DBG_ERR("Failed to retrieve schema name for "
+				"oid [%s]. Schema mode is incorrect "
+				"for this domain.\n", oids[i]);
+			return TLDAP_FILTER_ERROR;
+		}
+	}
 
 	return TLDAP_SUCCESS;
 }
diff --git a/source4/torture/smb2/delete-on-close.c b/source4/torture/smb2/delete-on-close.c
index 3c495750f43..05242876dcb 100644
--- a/source4/torture/smb2/delete-on-close.c
+++ b/source4/torture/smb2/delete-on-close.c
@@ -698,6 +698,46 @@ done:
 	return ret;
 }
 
+/*
+ * This is a regression test for
+ * https://bugzilla.samba.org/show_bug.cgi?id=14427
+ *
+ * It's not really a delete-on-close specific test.
+ */
+static bool test_doc_bug14427(struct torture_context *tctx, struct smb2_tree *tree1)
+{
+	struct smb2_tree *tree2 = NULL;
+	NTSTATUS status;
+	char fname[256];
+	bool ret = false;
+	bool ok;
+
+	/* Add some random component to the file name. */
+	snprintf(fname, sizeof(fname), "doc_bug14427_%s.dat",
+		 generate_random_str(tctx, 8));
+
+	ok = torture_smb2_tree_connect(tctx, tree1->session, tctx, &tree2);
+	torture_assert_goto(tctx, ok, ret, done,
+		"torture_smb2_tree_connect() failed.\n");
+
+	status = torture_setup_simple_file(tctx, tree1, fname);
+	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+		"torture_setup_simple_file() failed on tree1.\n");
+
+	status = smb2_util_unlink(tree2, fname);
+	torture_assert_ntstatus_ok_goto(tctx, status, ret, done,
+		"smb2_util_unlink() failed on tree2.\n");
+	TALLOC_FREE(tree2);
+	ret = true;
+done:
+	if (tree2 != NULL) {
+		TALLOC_FREE(tree2);
+		smb2_util_unlink(tree1, fname);
+	}
+
+	TALLOC_FREE(tree1);
+	return ret;
+}
 
 /*
  *  Extreme testing of Delete On Close and permissions
@@ -713,7 +753,8 @@ struct torture_suite *torture_smb2_doc_init(TALLOC_CTX *ctx)
 	torture_suite_add_1smb2_test(suite, "CREATE_IF", test_doc_create_if);
 	torture_suite_add_1smb2_test(suite, "CREATE_IF Existing", test_doc_create_if_exist);
 	torture_suite_add_1smb2_test(suite, "FIND_and_set_DOC", test_doc_find_and_set_doc);
-	torture_suite_add_1smb2_test(suite,  "READONLY", test_doc_read_only);
+	torture_suite_add_1smb2_test(suite, "READONLY", test_doc_read_only);
+	torture_suite_add_1smb2_test(suite, "BUG14427", test_doc_bug14427);
 
 	suite->description = talloc_strdup(suite, "SMB2-Delete-on-Close-Perms tests");
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list