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

Karolin Seeger kseeger at samba.org
Tue Apr 10 12:10:02 UTC 2018


The branch, v4-7-test has been updated
       via  00428e8 s3: smbd: Fix memory leak in vfswrap_getwd()
       via  d217375 s3: lib: messages: Don't use the result of sec_init() before calling sec_init().
       via  c62c1c9 dsdb: Fix CID 1034966 Uninitialized scalar variable
       via  119c28b s3:smbd: don't use the directory cache for SMB2/3
       via  4de5e3b ctdb-scripts: Drop "net serverid wipe" from 50.samba event script
      from  8ac2ffa s4: torture: Test all combinations of directory open with existing directory to ensure behavior is the same.

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


- Log -----------------------------------------------------------------
commit 00428e8b36ee25110922989ec5507f875aba8797
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Apr 6 13:52:52 2018 -0700

    s3: smbd: Fix memory leak in vfswrap_getwd()
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13372
    
    Signed-off-by: Andrew Walker <awalker at ixsystems.com>.
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Mon Apr  9 21:48:12 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 461a1172ff819692aa0a2dc5ce7fc5379c8a529e)
    
    Autobuild-User(v4-7-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-7-test): Tue Apr 10 14:09:46 CEST 2018 on sn-devel-144

commit d217375a87d49d65aeff9957d50046722b40e734
Author: Lutz Justen <ljusten at google.com>
Date:   Wed Apr 4 09:50:12 2018 -0700

    s3: lib: messages: Don't use the result of sec_init() before calling sec_init().
    
    Commit ad8c7171ba86e8a47d78b0c7329bb814e5a8871e accidently
    moved sec_init() to the point after sec_initial_uid() is
    called in the call to directory_create_or_exist_strict().
    I missed this in the review (sorry). This works as root
    as initial_uid/initial_gid are static (and so initialized
    as zero) but doesn't work on ChromeOS as this code isn't
    running as root.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13368
    
    Signed-off-by: Lutz Justen <ljusten at google.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Apr  4 23:52:02 CEST 2018 on sn-devel-144
    
    (cherry picked from commit e895b6cf4a7eb3d50d618a022be74db85975bf69)

commit c62c1c93f5712e7c3590eb9b9df9573300bd229a
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Mar 28 15:43:53 2018 -0500

    dsdb: Fix CID 1034966 Uninitialized scalar variable
    
    "continue" in a do-while loop jumps to the "while"-check, so "id_exists" needs
    to be initialized by that point.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13367
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>
    (cherry picked from commit 925d1f23291c4bdbc832977b2b4577964b8301c8)

commit 119c28bba77f258f3d2912b9524884b369200b2d
Author: Ralph Boehme <slow at samba.org>
Date:   Thu Mar 29 20:06:47 2018 +0200

    s3:smbd: don't use the directory cache for SMB2/3
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=13363
    
    Signed-off-by: Ralph Boehme <slow at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Fri Mar 30 03:51:48 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 66052fdccd28922cf1caa2bc750e39051a6414cf)

commit 4de5e3bb09a62eae2e2f8f27d84251a5695ecf92
Author: Amitay Isaacs <amitay at gmail.com>
Date:   Thu Mar 29 10:45:19 2018 +1100

    ctdb-scripts: Drop "net serverid wipe" from 50.samba event script
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13359
    
    There is no serverid database anymore.
    
    Signed-off-by: Amitay Isaacs <amitay at gmail.com>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Martin Schwenke <martin at meltin.net>
    
    Autobuild-User(master): Martin Schwenke <martins at samba.org>
    Autobuild-Date(master): Sat Mar 31 08:34:00 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 6b75d2c650aa9ee632122fa87ea8a2a98f1fa613)

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

Summary of changes:
 ctdb/config/events.d/50.samba                      |  2 --
 .../smbdotconf/misc/directorynamecachesize.xml     |  5 ++--
 source3/lib/messages.c                             |  9 ++++--
 source3/modules/vfs_default.c                      |  9 ++++--
 source3/smbd/dir.c                                 | 32 ++++++++++++++++++++--
 source4/dsdb/samdb/ldb_modules/samldb.c            |  1 +
 6 files changed, 46 insertions(+), 12 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/config/events.d/50.samba b/ctdb/config/events.d/50.samba
index 4c32e4e..f0d8e84 100755
--- a/ctdb/config/events.d/50.samba
+++ b/ctdb/config/events.d/50.samba
@@ -53,8 +53,6 @@ service_start ()
     # start Samba service. Start it reniced, as under very heavy load
     # the number of smbd processes will mean that it leaves few cycles
     # for anything else
-    net serverid wipe
-
     if [ -n "$CTDB_SERVICE_NMB" ] ; then
 	nice_service "$CTDB_SERVICE_NMB" start || die "Failed to start nmbd"
     fi
diff --git a/docs-xml/smbdotconf/misc/directorynamecachesize.xml b/docs-xml/smbdotconf/misc/directorynamecachesize.xml
index 7a89bf2..22999a6 100644
--- a/docs-xml/smbdotconf/misc/directorynamecachesize.xml
+++ b/docs-xml/smbdotconf/misc/directorynamecachesize.xml
@@ -4,8 +4,9 @@
                  xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
 	<para>
-	This parameter specifies the size of the directory name cache.
-	It will be needed to turn this off for *BSD systems.
+	This parameter specifies the size of the directory name cache for SMB1
+	connections. It is not used for SMB2. It will be needed to turn this off
+	for *BSD systems.
 	</para>
 
 </description>
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index b94a696..fca3994 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -248,6 +248,13 @@ static NTSTATUS messaging_init_internal(TALLOC_CTX *mem_ctx,
 	const char *priv_path;
 	bool ok;
 
+	/*
+	 * sec_init() *must* be called before any other
+	 * functions that use sec_XXX(). e.g. sec_initial_uid().
+	 */
+
+	sec_init();
+
 	lck_path = lock_path("msg.lock");
 	if (lck_path == NULL) {
 		return NT_STATUS_NO_MEMORY;
@@ -292,8 +299,6 @@ static NTSTATUS messaging_init_internal(TALLOC_CTX *mem_ctx,
 
 	ctx->event_ctx = ev;
 
-	sec_init();
-
 	ctx->msg_dgm_ref = messaging_dgm_ref(ctx,
 					     ctx->event_ctx,
 					     &ctx->id.unique_id,
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 6686303..ead11ee 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -2235,9 +2235,12 @@ static struct smb_filename *vfswrap_getwd(vfs_handle_struct *handle,
 				NULL,
 				NULL,
 				0);
-	if (smb_fname == NULL) {
-		SAFE_FREE(result);
-	}
+	/*
+	 * sys_getwd() *always* returns malloced memory.
+	 * We must free here to avoid leaks:
+	 * BUG:https://bugzilla.samba.org/show_bug.cgi?id=13372
+	 */
+	SAFE_FREE(result);
 	return smb_fname;
 }
 
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 19e2964..edac280 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1227,7 +1227,15 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
 			mask, smb_fname_str_dbg(&smb_fname),
 			dname, fname));
 
-		DirCacheAdd(dirptr->dir_hnd, dname, cur_offset);
+		if (!conn->sconn->using_smb2) {
+			/*
+			 * The dircache is only needed for SMB1 because SMB1
+			 * uses a name for the resume wheras SMB2 always
+			 * continues from the next position (unless it's told to
+			 * restart or close-and-reopen the listing).
+			 */
+			DirCacheAdd(dirptr->dir_hnd, dname, cur_offset);
+		}
 
 		TALLOC_FREE(dname);
 
@@ -1654,7 +1662,16 @@ static struct smb_Dir *OpenDir_internal(TALLOC_CTX *mem_ctx,
 	}
 
 	dirp->conn = conn;
-	dirp->name_cache_size = lp_directory_name_cache_size(SNUM(conn));
+
+	if (!conn->sconn->using_smb2) {
+		/*
+		 * The dircache is only needed for SMB1 because SMB1 uses a name
+		 * for the resume wheras SMB2 always continues from the next
+		 * position (unless it's told to restart or close-and-reopen the
+		 * listing).
+		 */
+		dirp->name_cache_size = lp_directory_name_cache_size(SNUM(conn));
+	}
 
 	if (sconn && !sconn->using_smb2) {
 		sconn->searches.dirhandles_open++;
@@ -1776,7 +1793,16 @@ static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn,
 	}
 
 	dirp->conn = conn;
-	dirp->name_cache_size = lp_directory_name_cache_size(SNUM(conn));
+
+	if (!conn->sconn->using_smb2) {
+		/*
+		 * The dircache is only needed for SMB1 because SMB1 uses a name
+		 * for the resume wheras SMB2 always continues from the next
+		 * position (unless it's told to restart or close-and-reopen the
+		 * listing).
+		 */
+		dirp->name_cache_size = lp_directory_name_cache_size(SNUM(conn));
+	}
 
 	dirp->dir_smb_fname = cp_smb_filename(dirp, fsp->fsp_name);
 	if (!dirp->dir_smb_fname) {
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 3e429e1..11da629 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -875,6 +875,7 @@ static int samldb_add_handle_msDS_IntId(struct samldb_ctx *ac)
 		 * order to be sure.
 		 */
 		if (dsdb_attribute_by_attributeID_id(schema, msds_intid)) {
+			id_exists = true;
 			msds_intid = generate_random() % 0X3FFFFFFF;
 			msds_intid += 0x80000000;
 			continue;


-- 
Samba Shared Repository



More information about the samba-cvs mailing list