The branch, v4-8-test has been updated
       via  bc11f28 s3: smbd: Fix memory leak in vfswrap_getwd()
       via  5afebb2 s3: lib: messages: Don't use the result of sec_init() 
before calling sec_init().
       via  2c3060b dsdb: Fix CID 1034966 Uninitialized scalar variable
       via  a9ed196 s3:smbd: don't use the directory cache for SMB2/3
       via  eb9085b ctdb-scripts: Drop "net serverid wipe" from 50.samba event 
script
       via  365569d ms_schema: fix python2.6 incompatibility
       via  9230fe2 samba-tool visualize: fix python2.6 incompatibility
      from  8e149c8 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-8-test


- Log -----------------------------------------------------------------
commit bc11f2851af7e71c91f90224c90528f2c7755f6a
Author: Jeremy Allison <j...@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 <awal...@ixsystems.com>.
    Reviewed-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Ralph Boehme <s...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@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-8-test): Karolin Seeger <ksee...@samba.org>
    Autobuild-Date(v4-8-test): Tue Apr 10 14:44:28 CEST 2018 on sn-devel-144

commit 5afebb251c6b87d264ea66a20b29c79e8aa1215d
Author: Lutz Justen <ljus...@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 <ljus...@google.com>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Andreas Schneider <a...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Wed Apr  4 23:52:02 CEST 2018 on sn-devel-144
    
    (cherry picked from commit e895b6cf4a7eb3d50d618a022be74db85975bf69)

commit 2c3060b6a6c8d03286906adb89452788988feeeb
Author: Volker Lendecke <v...@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 <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Stefan Metzmacher <me...@samba.org>
    (cherry picked from commit 925d1f23291c4bdbc832977b2b4577964b8301c8)

commit a9ed1968e8bf435d98a9fa02d1f0265398c45523
Author: Ralph Boehme <s...@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 <s...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Fri Mar 30 03:51:48 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 66052fdccd28922cf1caa2bc750e39051a6414cf)

commit eb9085b3ef8610970a4168566f73395fd3c900d5
Author: Amitay Isaacs <ami...@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 <ami...@gmail.com>
    Reviewed-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Martin Schwenke <mar...@meltin.net>
    
    Autobuild-User(master): Martin Schwenke <mart...@samba.org>
    Autobuild-Date(master): Sat Mar 31 08:34:00 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 6b75d2c650aa9ee632122fa87ea8a2a98f1fa613)

commit 365569dfc70a45ff9ba4b3baf9e3ea7de66eff4e
Author: Björn Baumbach <b...@sernet.de>
Date:   Thu Mar 15 18:32:31 2018 +0100

    ms_schema: fix python2.6 incompatibility
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13337
    
    Signed-off-by: Björn Baumbach <b...@sernet.de>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz>
    (cherry picked from commit a27db0b61e40b6b503b53e3579867e227f1971b8)

commit 9230fe25287dd3ee53c9384f73f62b4e4ed8dd1e
Author: Björn Baumbach <b...@sernet.de>
Date:   Tue Mar 20 12:15:22 2018 +0100

    samba-tool visualize: fix python2.6 incompatibility
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13337
    
    Signed-off-by: Björn Baumbach <b...@sernet.de>
    Reviewed-by: Andrew Bartlett <abart...@samba.org>
    Reviewed-by: Douglas Bagnall <douglas.bagn...@catalyst.net.nz>
    
    Autobuild-User(master): Douglas Bagnall <dbagn...@samba.org>
    Autobuild-Date(master): Wed Mar 21 09:25:51 CET 2018 on sn-devel-144
    
    (cherry picked from commit 9312a1cdafbd5a0140d72502487c4e478dc578d2)

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

Summary of changes:
 ctdb/config/events.d/50.samba                      |  2 --
 .../smbdotconf/misc/directorynamecachesize.xml     |  5 ++--
 python/samba/ms_schema.py                          |  2 +-
 python/samba/netcmd/visualize.py                   |  6 +++-
 source3/lib/messages.c                             |  9 ++++--
 source3/modules/vfs_default.c                      |  9 ++++--
 source3/smbd/dir.c                                 | 32 ++++++++++++++++++++--
 source4/dsdb/samdb/ldb_modules/samldb.c            |  1 +
 8 files changed, 52 insertions(+), 14 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/python/samba/ms_schema.py b/python/samba/ms_schema.py
index a8c9363..53ec02d 100644
--- a/python/samba/ms_schema.py
+++ b/python/samba/ms_schema.py
@@ -277,7 +277,7 @@ def __transform_entry(entry, objectClass):
 
     header.append(["objectGUID", str(uuid.uuid4()), False])
 
-    entry = header + [x for x in entry if x[0].lower() not in {'dn', 
'changetype', 'objectcategory'}]
+    entry = header + [x for x in entry if x[0].lower() not in set(['dn', 
'changetype', 'objectcategory'])]
 
     return entry
 
diff --git a/python/samba/netcmd/visualize.py b/python/samba/netcmd/visualize.py
index 473872a..3e5b950 100644
--- a/python/samba/netcmd/visualize.py
+++ b/python/samba/netcmd/visualize.py
@@ -176,7 +176,11 @@ def get_partition_maps(samdb):
         "DNSDOMAIN": "DC=DomainDnsZones,%s" % base_dn,
         "DNSFOREST": "DC=ForestDnsZones,%s" % base_dn
     }
-    long_to_short = {v: k for k, v in short_to_long.iteritems()}
+
+    long_to_short = {}
+    for s, l in short_to_long.iteritems():
+        long_to_short[l] = s
+
     return short_to_long, long_to_short
 
 
diff --git a/source3/lib/messages.c b/source3/lib/messages.c
index 464233f..5a31f34 100644
--- a/source3/lib/messages.c
+++ b/source3/lib/messages.c
@@ -457,6 +457,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;
@@ -507,8 +514,6 @@ static NTSTATUS messaging_init_internal(TALLOC_CTX *mem_ctx,
                goto done;
        }
 
-       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 a26bec4..a9c87e4 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -2229,9 +2229,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 6621b4e..801daa5 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -1219,7 +1219,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);
 
@@ -1646,7 +1654,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++;
@@ -1768,7 +1785,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

Reply via email to