[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Sat Aug 10 20:43:02 UTC 2019


The branch, master has been updated
       via  9f193b747f3 loadparm: fix mem leak found by ASAN
       via  dbf26d7e0c9 torture: fix mem leak found by ASAN (smb2_scan)
       via  16104768605 torture: fix mem leak found by ASAN
       via  99b4791cfe4 ldb: Fix mem-leak if talloc_realloc fails
       via  5eb4d705396 gitlab-ci: Install compat-gnutls34 on CentOS7
       via  b81cb04d03d s3:modules: Link vfs_acl_common against gnutls
       via  6bf6cb1643a libcli:smb: Add forward declaration for gnutls_hmac_hd_t
      from  fe26ff6e911 smbd: Simplify fd_open_atomic()

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


- Log -----------------------------------------------------------------
commit 9f193b747f399f7d8be42a198f81b0cafa67341d
Author: Swen Schillig <swen at linux.ibm.com>
Date:   Mon Aug 5 10:58:53 2019 +0200

    loadparm: fix mem leak found by ASAN
    
    ==24948==ERROR: LeakSanitizer: detected memory leaks
    
    Indirect leak of 232 byte(s) in 1 object(s) allocated from:
        #0 0x7fc44b971c08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08)
        #1 0x7fc44a2fe7b0 in __talloc_with_prefix ../../lib/talloc/talloc.c:782
        #2 0x7fc44a2fe7b0 in __talloc ../../lib/talloc/talloc.c:824
        #3 0x7fc44a2fe7b0 in _talloc_named_const ../../lib/talloc/talloc.c:981
        #4 0x7fc44a2fe7b0 in _talloc_array ../../lib/talloc/talloc.c:2764
        #5 0x7fc44a1239bc in str_list_make_v3 ../../lib/util/util_strlist_v3.c:58
        #6 0x7fc44a123e3b in str_list_make_v3_const ../../lib/util/util_strlist_v3.c:127
        #7 0x7fc44b14cc1a in init_globals ../../source3/param/loadparm.c:547
        #8 0x7fc44b14deef in lp_load_ex ../../source3/param/loadparm.c:3876
        #9 0x7fc44b14f97c in lp_load_initial_only ../../source3/param/loadparm.c:4025
        #10 0x7fc44b479235 in cmdline_messaging_context ../../source3/lib/cmdline_contexts.c:34
        #11 0x557cf59d642c in process_options ../../source3/utils/smbpasswd.c:200
        #12 0x557cf59d642c in main ../../source3/utils/smbpasswd.c:633
        #13 0x7fc4419f5412 in __libc_start_main (/lib64/libc.so.6+0x24412)
    
    Signed-off-by: Swen Schillig <swen at linux.ibm.com>
    Reviewed-by: Matthias Dieter Wallnöfer <mdw at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Sat Aug 10 20:42:39 UTC 2019 on sn-devel-184

commit dbf26d7e0c9b46ff3b8da7af0d51080bbf17a9d6
Author: Swen Schillig <swen at linux.ibm.com>
Date:   Mon Aug 5 11:15:59 2019 +0200

    torture: fix mem leak found by ASAN (smb2_scan)
    
    Direct leak of 96 byte(s) in 1 object(s) allocated from:
        #0 0x7f63e6938c08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08)
        #1 0x7f63e615fa5c in __talloc_with_prefix ../../lib/talloc/talloc.c:782
        #2 0x7f63e615fa5c in __talloc ../../lib/talloc/talloc.c:824
        #3 0x7f63e615fa5c in _talloc_named_const ../../lib/talloc/talloc.c:981
        #4 0x7f63e615fa5c in talloc_named_const ../../lib/talloc/talloc.c:1748
        #5 0x55609e7530cf in torture_smb2_scan ../../source4/torture/smb2/scan.c:203
        #6 0x7f63e2a37772 in wrap_simple_test ../../lib/torture/torture.c:633
        #7 0x7f63e2a3b75e in internal_torture_run_test ../../lib/torture/torture.c:442
        #8 0x7f63e2a3c543 in torture_run_tcase_restricted ../../lib/torture/torture.c:507
        #9 0x7f63e2a3cdd5 in torture_run_suite_restricted ../../lib/torture/torture.c:357
        #10 0x7f63e2a3cf25 in torture_run_suite_restricted ../../lib/torture/torture.c:362
        #11 0x7f63e2a3d434 in torture_run_suite ../../lib/torture/torture.c:339
        #12 0x55609e3a154a in run_matching ../../source4/torture/smbtorture.c:93
        #13 0x55609e3a2f56 in torture_run_named_tests ../../source4/torture/smbtorture.c:143
        #14 0x55609e3a699d in main ../../source4/torture/smbtorture.c:691
        #15 0x7f63dad59412 in __libc_start_main (/lib64/libc.so.6+0x24412)
    
    Signed-off-by: Swen Schillig <swen at linux.ibm.com>
    Reviewed-by: Matthias Dieter Wallnöfer <mdw at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 1610476860576effa3c05fc10c753c6183f6d9e9
Author: Swen Schillig <swen at linux.ibm.com>
Date:   Mon Aug 5 11:07:53 2019 +0200

    torture: fix mem leak found by ASAN
    
    ==14507==ERROR: LeakSanitizer: detected memory leaks
    
    Direct leak of 112 byte(s) in 1 object(s) allocated from:
        #0 0x7f3c76fe5c08 in __interceptor_malloc (/lib64/libasan.so.5+0xefc08)
        #1 0x7f3c7680df33 in __talloc_with_prefix ../../lib/talloc/talloc.c:782
        #2 0x7f3c7680df33 in __talloc ../../lib/talloc/talloc.c:824
        #3 0x7f3c7680df33 in _talloc_named_const ../../lib/talloc/talloc.c:981
        #4 0x7f3c7680df33 in _talloc_zero ../../lib/talloc/talloc.c:2422
        #5 0x7f3c7680e2a5 in _talloc_zero_array ../../lib/talloc/talloc.c:2775
        #6 0x557a50d4a09f in torture_bench_treeconnect ../../source4/torture/raw/tconrate.c:165
        #7 0x7f3c730e4772 in wrap_simple_test ../../lib/torture/torture.c:633
        #8 0x7f3c730e875e in internal_torture_run_test ../../lib/torture/torture.c:442
        #9 0x7f3c730e9543 in torture_run_tcase_restricted ../../lib/torture/torture.c:507
        #10 0x7f3c730e9dd5 in torture_run_suite_restricted ../../lib/torture/torture.c:357
        #11 0x7f3c730ea434 in torture_run_suite ../../lib/torture/torture.c:339
        #12 0x557a50c1b54a in run_matching ../../source4/torture/smbtorture.c:93
        #13 0x557a50c1cf56 in torture_run_named_tests ../../source4/torture/smbtorture.c:143
        #14 0x557a50c2099d in main ../../source4/torture/smbtorture.c:691
        #15 0x7f3c6b406412 in __libc_start_main (/lib64/libc.so.6+0x24412)
    
    Signed-off-by: Swen Schillig <swen at linux.ibm.com>
    Reviewed-by: Matthias Dieter Wallnöfer <mdw at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 99b4791cfe423b19f1f21d5f9fb42157336019f1
Author: Swen Schillig <swen at linux.ibm.com>
Date:   Wed Jul 31 10:27:37 2019 +0200

    ldb: Fix mem-leak if talloc_realloc fails
    
    In case of a failing talloc_realloc(), the only reference
    to the originally allocated memory is overwritten.
    Instead use a temp var until success is verified.
    
    Signed-off-by: Swen Schillig <swen at linux.ibm.com>
    Reviewed-by: Christof Schmitt <cs at samba.org>
    Reviewed-by: Matthias Dieter Wallnöfer <mdw at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 5eb4d705396faa5e5de90aaa86f7115b0f005589
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Aug 8 08:18:55 2019 +0200

    gitlab-ci: Install compat-gnutls34 on CentOS7
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit b81cb04d03d57b8175d862ba48ac476fedf23636
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Aug 8 13:14:45 2019 +0200

    s3:modules: Link vfs_acl_common against gnutls
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

commit 6bf6cb1643ae5e8fff66a7cbec50f58ede632666
Author: Andreas Schneider <asn at samba.org>
Date:   Thu Aug 8 11:57:02 2019 +0200

    libcli:smb: Add forward declaration for gnutls_hmac_hd_t
    
    This file is basically included everywhere. So use a forward declaration
    for gnutls_hmac_hd_t. This way we don't have to link everthing against
    gnutls to get access to the header path.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>

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

Summary of changes:
 .gitlab-ci.yml                                 |  4 +++-
 bootstrap/.gitlab-ci.yml                       |  4 +++-
 bootstrap/config.py                            |  3 +++
 bootstrap/generated-dists/centos6/bootstrap.sh |  2 ++
 bootstrap/generated-dists/centos7/bootstrap.sh |  4 +++-
 bootstrap/generated-dists/centos7/packages.yml |  2 +-
 bootstrap/sha1sum.txt                          |  2 +-
 lib/ldb/common/ldb_dn.c                        | 15 ++++++++++-----
 libcli/smb/smb2_signing.h                      |  6 +++---
 source3/modules/wscript_build                  |  3 ++-
 source3/param/loadparm.c                       |  2 +-
 source4/torture/raw/tconrate.c                 |  2 +-
 source4/torture/smb2/scan.c                    |  2 +-
 13 files changed, 34 insertions(+), 17 deletions(-)


Changeset truncated at 500 lines:

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 313ae01fa69..734d5152c00 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -22,7 +22,7 @@ variables:
   # Set this to the contents of bootstrap/sha1sum.txt
   # which is generated by bootstrap/template.py --render
   #
-  SAMBA_CI_CONTAINER_TAG: 339a70ba1881feec94109c5c4eafacf4ff6c43bc
+  SAMBA_CI_CONTAINER_TAG: e4c3da88c459ae1a97c1c5e41f52b17d688d295f
   #
   # We use the ubuntu1804 image as default as
   # it matches what we have on sn-devel-184.
@@ -268,6 +268,8 @@ centos7-samba-o3:
   variables:
     # Git on CentOS doesn't support shallow git cloning
     GIT_DEPTH: ""
+    # We need a newer GnuTLS version on CentOS7
+    PKG_CONFIG_PATH: "/usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig"
 
 fedora29-samba-o3:
   extends: .samba-o3-template
diff --git a/bootstrap/.gitlab-ci.yml b/bootstrap/.gitlab-ci.yml
index 8bec8cc4e20..8254986d2dc 100644
--- a/bootstrap/.gitlab-ci.yml
+++ b/bootstrap/.gitlab-ci.yml
@@ -41,7 +41,7 @@ services:
     diff -u bootstrap/sha1sum.txt /tmp/sha1sum-template.txt
     # run smoke test with samba-o3
     docker run --volume $(pwd):${samba_repo_root} --workdir ${samba_repo_root} ${ci_image_name} \
-        /bin/bash -c "sudo chown -R samba:samba ./** && script/autobuild.py samba-o3 --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase"
+        /bin/bash -c "sudo chown -R samba:samba ./** && export PKG_CONFIG_PATH=/usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig && script/autobuild.py samba-o3 --verbose --nocleanup --keeplogs --tail --testbase /tmp/samba-testbase"
     docker tag ${ci_image_name} ${ci_image_path}:${SAMBA_CI_CONTAINER_TAG}
     docker tag ${ci_image_name} ${ci_image_path}:${timestamp_tag}
     # We build all images, but only upload is it's not marked as broken
@@ -114,6 +114,8 @@ centos7:
   variables:
     # Shallow copies are not supported by git on CentOS7
     GIT_DEPTH: ""
+    # We install a compat-gnutls34 package for GnuTLS >= 3.4.7
+    PKG_CONFIG_PATH: /usr/lib64/compat-gnutls34/pkgconfig:/usr/lib64/compat-nettle32/pkgconfig
 
 centos6:
   extends: .build_image_template_force_broken
diff --git a/bootstrap/config.py b/bootstrap/config.py
index 9126961fc93..f4acdf5d925 100644
--- a/bootstrap/config.py
+++ b/bootstrap/config.py
@@ -214,6 +214,8 @@ set -xueo pipefail
 
 yum update -y
 yum install -y epel-release
+yum install -y yum-plugin-copr
+yum copr enable -y sergiomb/SambaAD
 yum update -y
 
 yum install -y \
@@ -478,6 +480,7 @@ RPM_DISTS = {
             'glusterfs-api-devel': '',
             'glusterfs-devel': '',
             'libcephfs-devel': '',
+            'gnutls-devel': 'compat-gnutls34-devel',
         }
     },
     'fedora28': {
diff --git a/bootstrap/generated-dists/centos6/bootstrap.sh b/bootstrap/generated-dists/centos6/bootstrap.sh
index 6d60bd2cdc9..441eba7918e 100755
--- a/bootstrap/generated-dists/centos6/bootstrap.sh
+++ b/bootstrap/generated-dists/centos6/bootstrap.sh
@@ -9,6 +9,8 @@ set -xueo pipefail
 
 yum update -y
 yum install -y epel-release
+yum install -y yum-plugin-copr
+yum copr enable -y sergiomb/SambaAD
 yum update -y
 
 yum install -y \
diff --git a/bootstrap/generated-dists/centos7/bootstrap.sh b/bootstrap/generated-dists/centos7/bootstrap.sh
index b59ef6a5dcf..c74cdd470d0 100755
--- a/bootstrap/generated-dists/centos7/bootstrap.sh
+++ b/bootstrap/generated-dists/centos7/bootstrap.sh
@@ -9,6 +9,8 @@ set -xueo pipefail
 
 yum update -y
 yum install -y epel-release
+yum install -y yum-plugin-copr
+yum copr enable -y sergiomb/SambaAD
 yum update -y
 
 yum install -y \
@@ -20,6 +22,7 @@ yum install -y \
     bind-utils \
     binutils \
     bison \
+    compat-gnutls34-devel \
     cups-devel \
     curl \
     dbus-devel \
@@ -32,7 +35,6 @@ yum install -y \
     git \
     glib2-devel \
     glibc-common \
-    gnutls-devel \
     gpgme-devel \
     gzip \
     hostname \
diff --git a/bootstrap/generated-dists/centos7/packages.yml b/bootstrap/generated-dists/centos7/packages.yml
index 7a106d8dfd5..9623698b9ff 100644
--- a/bootstrap/generated-dists/centos7/packages.yml
+++ b/bootstrap/generated-dists/centos7/packages.yml
@@ -8,6 +8,7 @@ packages:
   - bind-utils
   - binutils
   - bison
+  - compat-gnutls34-devel
   - cups-devel
   - curl
   - dbus-devel
@@ -20,7 +21,6 @@ packages:
   - git
   - glib2-devel
   - glibc-common
-  - gnutls-devel
   - gpgme-devel
   - gzip
   - hostname
diff --git a/bootstrap/sha1sum.txt b/bootstrap/sha1sum.txt
index 52cf7350bc0..f4d7219402e 100644
--- a/bootstrap/sha1sum.txt
+++ b/bootstrap/sha1sum.txt
@@ -1 +1 @@
-339a70ba1881feec94109c5c4eafacf4ff6c43bc
+e4c3da88c459ae1a97c1c5e41f52b17d688d295f
diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c
index 23a817edf65..9b2fa966e11 100644
--- a/lib/ldb/common/ldb_dn.c
+++ b/lib/ldb/common/ldb_dn.c
@@ -376,6 +376,7 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 			}
 
 			if (in_ex_value && *p == '>') {
+				struct ldb_dn_ext_component *ext_comp = NULL;
 				const struct ldb_dn_extended_syntax *ext_syntax;
 				struct ldb_val ex_val = {
 					.data = (uint8_t *)ex_value,
@@ -388,15 +389,19 @@ static bool ldb_dn_explode(struct ldb_dn *dn)
 
 				/* Process name and ex_value */
 
-				dn->ext_components = talloc_realloc(dn,
-								    dn->ext_components,
-								    struct ldb_dn_ext_component,
-								    dn->ext_comp_num + 1);
-				if ( ! dn->ext_components) {
+				ext_comp = talloc_realloc(
+					dn,
+					dn->ext_components,
+					struct ldb_dn_ext_component,
+					dn->ext_comp_num + 1);
+
+				if (ext_comp == NULL) {
 					/* ouch ! */
 					goto failed;
 				}
 
+				dn->ext_components = ext_comp;
+
 				ext_syntax = ldb_dn_extended_syntax_by_name(dn->ldb, ex_name);
 				if (!ext_syntax) {
 					/* We don't know about this type of extended DN */
diff --git a/libcli/smb/smb2_signing.h b/libcli/smb/smb2_signing.h
index 6e1682955c9..96a002f4a0c 100644
--- a/libcli/smb/smb2_signing.h
+++ b/libcli/smb/smb2_signing.h
@@ -21,10 +21,10 @@
 #ifndef _LIBCLI_SMB_SMB2_SIGNING_H_
 #define _LIBCLI_SMB_SMB2_SIGNING_H_
 
-#include <gnutls/gnutls.h>
-#include <gnutls/crypto.h>
-
 struct iovec;
+ /* Forward declaration of GnuTLS typedefs */
+struct hmac_hd_st;
+typedef struct hmac_hd_st* gnutls_hmac_hd_t;
 
 struct smb2_signing_key {
 	gnutls_hmac_hd_t hmac_hnd;
diff --git a/source3/modules/wscript_build b/source3/modules/wscript_build
index 28f98568976..f928323d66e 100644
--- a/source3/modules/wscript_build
+++ b/source3/modules/wscript_build
@@ -10,7 +10,8 @@ bld.SAMBA3_BINARY('test_nfs4_acls',
                   install=False)
 
 bld.SAMBA3_SUBSYSTEM('vfs_acl_common',
-                     source='vfs_acl_common.c')
+                     source='vfs_acl_common.c',
+                     deps='gnutls')
 
 bld.SAMBA3_SUBSYSTEM('POSIXACL_XATTR',
                  source='posixacl_xattr.c',
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 0daac0e44cb..bcda6a1c600 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -545,7 +545,7 @@ static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
 
 	init_printer_values(lp_ctx, Globals.ctx, &sDefault);
 
-	sDefault.ntvfs_handler = str_list_make_v3_const(NULL, "unixuid default", NULL);
+	sDefault.ntvfs_handler = str_list_make_v3_const(Globals.ctx, "unixuid default", NULL);
 
 	DEBUG(3, ("Initialising global parameters\n"));
 
diff --git a/source4/torture/raw/tconrate.c b/source4/torture/raw/tconrate.c
index b485ccd8e63..3872a9cd8da 100644
--- a/source4/torture/raw/tconrate.c
+++ b/source4/torture/raw/tconrate.c
@@ -162,7 +162,7 @@ bool torture_bench_treeconnect(struct torture_context *tctx)
 	int nprocs = torture_setting_int(tctx, "nprocs", 4);
 
 	int *curr_counts = map_count_buffer(nprocs, sizeof(int));
-	int *last_counts = talloc_zero_array(NULL, int, nprocs);
+	int *last_counts = talloc_zero_array(tctx, int, nprocs);
 
 	struct timeval now, last, start;
 	int i, delta;
diff --git a/source4/torture/smb2/scan.c b/source4/torture/smb2/scan.c
index 3e43b9dfa32..adb7fdb7f1a 100644
--- a/source4/torture/smb2/scan.c
+++ b/source4/torture/smb2/scan.c
@@ -200,7 +200,7 @@ static bool torture_smb2_find_scan(struct torture_context *tctx)
 */
 static bool torture_smb2_scan(struct torture_context *tctx)
 {
-	TALLOC_CTX *mem_ctx = talloc_new(NULL);
+	TALLOC_CTX *mem_ctx = talloc_new(tctx);
 	struct smb2_tree *tree;
 	const char *host = torture_setting_string(tctx, "host", NULL);
 	const char *share = torture_setting_string(tctx, "share", NULL);


-- 
Samba Shared Repository



More information about the samba-cvs mailing list