[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed May 8 17:48:02 UTC 2019


The branch, master has been updated
       via  b93ae77a6f4 g_lock: Fix a typo
       via  8992cf4aec4 g_lock: Apply some const
       via  08a31c9092b dbwrap: Adapt tdb_data_buf's overflow handling to modern conventions
       via  30abea88151 dbwrap: Fix tdb_data_buf()
       via  2b957bde5a2 s3:utils: If share is NULL in smbcacls, don't print it
       via  3653dc70135 s3:utils: If share is NULL in smbcquotas, don't print it
       via  e333425e0ff s3:winbindd: Do not free db_path in idmap_tdb2 before we printed it
       via  830cb7e6756 ctdb:common: Do not print NULL if we don't get a sockpath
       via  46f036d3231 s4:torture: Do not free full_name before we printed it
       via  a8f773e326d lib:torture: Fix string comparison macros where we directly pass NULL
       via  be72dfbc8ed s4:torture: Do not print NULL strings we just checked before
       via  6da032df545 s4:ntvfs: Do not free eadb before we printed an error
       via  790d7e34cbe s3:rpc_server: Do not free the tdbname before we printed it
       via  bd29f3fcc02 s4:auth: Fix debug statement in gensec_gssapi
      from  93061fb822d CID 1363286: Resource leak by failing to free tmp_ctx

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


- Log -----------------------------------------------------------------
commit b93ae77a6f44a9eb43aae8ed8abfc4149d7b8fef
Author: Volker Lendecke <vl at samba.org>
Date:   Mon May 6 16:34:15 2019 +0200

    g_lock: Fix a typo
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed May  8 17:47:39 UTC 2019 on sn-devel-184

commit 8992cf4aec4750afa9b6a632d26fabf333801525
Author: Volker Lendecke <vl at samba.org>
Date:   Mon May 6 16:19:22 2019 +0200

    g_lock: Apply some const
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 08a31c9092b808a49ecdf92e8cc0ae9132ba6645
Author: Volker Lendecke <vl at samba.org>
Date:   Fri May 3 15:43:35 2019 +0200

    dbwrap: Adapt tdb_data_buf's overflow handling to modern conventions
    
    This is the way we do it right now, avoid confusion why "tmp" might be
    needed
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 30abea8815113045b7ee075352c415fe176a48fe
Author: Volker Lendecke <vl at samba.org>
Date:   Fri May 3 15:42:42 2019 +0200

    dbwrap: Fix tdb_data_buf()
    
    IIRC there are platforms that don't like memcpy() with len=0.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 2b957bde5a2f0f670ee0c8acde6edae1f4aaf253
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 8 17:12:12 2019 +0200

    s3:utils: If share is NULL in smbcacls, don't print it
    
    Found by GCC 9.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3653dc7013518d90e6deb08a1f21d7472dc86675
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 8 17:11:13 2019 +0200

    s3:utils: If share is NULL in smbcquotas, don't print it
    
    Found by GCC 9.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e333425e0ff6be5691b74a920610b508e7d26892
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 8 17:05:58 2019 +0200

    s3:winbindd: Do not free db_path in idmap_tdb2 before we printed it
    
    Found by GCC 9.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 830cb7e67568de5f3ce359cb6af3be8ab545c824
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 8 17:03:54 2019 +0200

    ctdb:common: Do not print NULL if we don't get a sockpath
    
    sock_socket_start_recv() might not fill sockpath if we return early.
    
    Found by GCC 9.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 46f036d3231bc99cf37c7cabf82757d3c28c5cff
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 8 16:58:07 2019 +0200

    s4:torture: Do not free full_name before we printed it
    
    Found by GCC 9.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a8f773e326d6bdfc1c9eb87a74c00108f6620c56
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 8 16:54:30 2019 +0200

    lib:torture: Fix string comparison macros where we directly pass NULL
    
    See e.g. lib/util/tests/strlist.c +177
    
    Found by GCC 9.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit be72dfbc8edc53ed191dc01668a53cafb5cd785d
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 8 16:51:20 2019 +0200

    s4:torture: Do not print NULL strings we just checked before
    
    Found by GCC 9.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 6da032df5450ef72f8608a19b3b5cc6e9185cd6e
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 8 16:32:45 2019 +0200

    s4:ntvfs: Do not free eadb before we printed an error
    
    Found by GCC 9.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 790d7e34cbe4e190d6acdd24696efe53944cd4a6
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 8 16:31:10 2019 +0200

    s3:rpc_server: Do not free the tdbname before we printed it
    
    Found by GCC 9.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit bd29f3fcc023d00afde8e9cc2f9db22dcae49877
Author: Andreas Schneider <asn at samba.org>
Date:   Wed May 8 16:27:57 2019 +0200

    s4:auth: Fix debug statement in gensec_gssapi
    
    The 'role' is set to null, we should first set it to the correct value
    before printing anything.
    
    Found by GCC 9.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 ctdb/common/sock_daemon.c                     | 2 +-
 lib/dbwrap/dbwrap.c                           | 8 +++-----
 lib/torture/torture.h                         | 8 +++++---
 source3/lib/g_lock.c                          | 5 +++--
 source3/rpc_server/eventlog/srv_eventlog_nt.c | 4 ++--
 source3/utils/smbcacls.c                      | 4 ++--
 source3/utils/smbcquotas.c                    | 4 ++--
 source3/winbindd/idmap_tdb2.c                 | 4 ++--
 source4/auth/gensec/gensec_gssapi.c           | 9 +++++----
 source4/ntvfs/posix/vfs_posix.c               | 2 +-
 source4/torture/rpc/drsuapi_cracknames.c      | 8 ++++----
 source4/torture/vfs/fruit.c                   | 2 +-
 12 files changed, 31 insertions(+), 29 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/common/sock_daemon.c b/ctdb/common/sock_daemon.c
index e5e16f8af12..6298653f4ec 100644
--- a/ctdb/common/sock_daemon.c
+++ b/ctdb/common/sock_daemon.c
@@ -893,7 +893,7 @@ static void sock_daemon_run_socket_fail(struct tevent_req *subreq)
 		subreq, struct tevent_req);
 	struct sock_daemon_run_state *state = tevent_req_data(
 		req, struct sock_daemon_run_state);
-	const char *sockpath = NULL;
+	const char *sockpath = "INVALID";
 	int ret = 0;
 	bool status;
 
diff --git a/lib/dbwrap/dbwrap.c b/lib/dbwrap/dbwrap.c
index 79c83b1a5e2..5e307ee47cd 100644
--- a/lib/dbwrap/dbwrap.c
+++ b/lib/dbwrap/dbwrap.c
@@ -634,16 +634,14 @@ static ssize_t tdb_data_buf(const TDB_DATA *dbufs, int num_dbufs,
 
 	for (i=0; i<num_dbufs; i++) {
 		size_t thislen = dbufs[i].dsize;
-		size_t tmp;
 
-		tmp = needed + thislen;
-		if (tmp < needed) {
+		needed += thislen;
+		if (needed < thislen) {
 			/* wrap */
 			return -1;
 		}
-		needed = tmp;
 
-		if (needed <= buflen) {
+		if ((thislen != 0) && (needed <= buflen)) {
 			memcpy(p, dbufs[i].dptr, thislen);
 			p += thislen;
 		}
diff --git a/lib/torture/torture.h b/lib/torture/torture.h
index 2921ae74b9b..a7f3f471b3a 100644
--- a/lib/torture/torture.h
+++ b/lib/torture/torture.h
@@ -323,7 +323,9 @@ void torture_result(struct torture_context *test,
 #define torture_assert_casestr_equal(torture_ctx,got,expected,cmt) \
 	do { const char *__got = (got), *__expected = (expected); \
 	if (!strequal(__got, __expected)) { \
-		torture_result(torture_ctx, TORTURE_FAIL, __location__": "#got" was %s, expected %s: %s", __got, __expected, cmt); \
+		torture_result(torture_ctx, TORTURE_FAIL, \
+			       __location__": "#got" was %s, expected %s: %s", \
+			       __got, __expected == NULL ? "null" : __expected, cmt); \
 		return false; \
 	} \
 	} while(0)
@@ -332,8 +334,8 @@ void torture_result(struct torture_context *test,
 	do { const char *__got = (got), *__expected = (expected); \
 	if (strcmp_safe(__got, __expected) != 0) { \
 		torture_result(torture_ctx, TORTURE_FAIL, \
-					   __location__": "#got" was %s, expected %s: %s", \
-					   __got, __expected, cmt); \
+			       __location__": "#got" was %s, expected %s: %s", \
+			       __got, __expected == NULL ? "NULL" : __expected, cmt); \
 		return false; \
 	} \
 	} while(0)
diff --git a/source3/lib/g_lock.c b/source3/lib/g_lock.c
index d8298b6ee33..d97786b02a3 100644
--- a/source3/lib/g_lock.c
+++ b/source3/lib/g_lock.c
@@ -90,7 +90,8 @@ static bool g_lock_parse(uint8_t *buf, size_t buflen, struct g_lock *lck)
 	return true;
 }
 
-static void g_lock_get_rec(struct g_lock *lck, size_t i,
+static void g_lock_get_rec(const struct g_lock *lck,
+			   size_t i,
 			   struct g_lock_rec *rec)
 {
 	if (i >= lck->num_recs) {
@@ -517,7 +518,7 @@ static void g_lock_unlock_fn(struct db_record *rec,
 
 	ok = g_lock_parse(value.dptr, value.dsize, &lck);
 	if (!ok) {
-		DBG_DEBUG("g_lock_get for %s failed\n",
+		DBG_DEBUG("g_lock_parse for %s failed\n",
 			  hex_encode_talloc(talloc_tos(),
 					    state->key.dptr,
 					    state->key.dsize));
diff --git a/source3/rpc_server/eventlog/srv_eventlog_nt.c b/source3/rpc_server/eventlog/srv_eventlog_nt.c
index ce27dd530e1..5093125a6f6 100644
--- a/source3/rpc_server/eventlog/srv_eventlog_nt.c
+++ b/source3/rpc_server/eventlog/srv_eventlog_nt.c
@@ -95,13 +95,13 @@ static bool elog_check_access( EVENTLOG_INFO *info, const struct security_token
 			tdbname,
 			SECINFO_OWNER | SECINFO_GROUP | SECINFO_DACL,
 			&sec_desc);
-	TALLOC_FREE( tdbname );
-
 	if (!NT_STATUS_IS_OK(status)) {
 		DEBUG(5,("elog_check_access: Unable to get NT ACL for %s: %s\n",
 			tdbname, nt_errstr(status)));
+		TALLOC_FREE(tdbname);
 		return False;
 	}
+	TALLOC_FREE(tdbname);
 
 	ace = talloc_zero(sec_desc, struct security_ace);
 	if (ace == NULL) {
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index b61d11df860..084df9f9a4a 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -1050,8 +1050,8 @@ int main(int argc, char *argv[])
 		return -1;
 	}
 	share = strchr_m(server,'\\');
-	if (!share) {
-		printf("Invalid argument: %s\n", share);
+	if (share == NULL) {
+		printf("Invalid argument\n");
 		return -1;
 	}
 
diff --git a/source3/utils/smbcquotas.c b/source3/utils/smbcquotas.c
index 3f2fc7b37a1..17d16b1cba5 100644
--- a/source3/utils/smbcquotas.c
+++ b/source3/utils/smbcquotas.c
@@ -770,8 +770,8 @@ int main(int argc, char *argv[])
 		exit(EXIT_PARSE_ERROR);
 	}
 	share = strchr_m(server,'\\');
-	if (!share) {
-		printf("Invalid argument: %s\n", share);
+	if (share == NULL) {
+		printf("Invalid argument\n");
 		exit(EXIT_PARSE_ERROR);
 	}
 
diff --git a/source3/winbindd/idmap_tdb2.c b/source3/winbindd/idmap_tdb2.c
index 3ae309e5e5b..b784546bb33 100644
--- a/source3/winbindd/idmap_tdb2.c
+++ b/source3/winbindd/idmap_tdb2.c
@@ -115,13 +115,13 @@ static NTSTATUS idmap_tdb2_open_db(struct idmap_domain *dom)
 	/* Open idmap repository */
 	ctx->db = db_open(ctx, db_path, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0644,
 			  DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
-	TALLOC_FREE(db_path);
-
 	if (ctx->db == NULL) {
 		DEBUG(0, ("Unable to open idmap_tdb2 database '%s'\n",
 			  db_path));
+		TALLOC_FREE(db_path);
 		return NT_STATUS_UNSUCCESSFUL;
 	}
+	TALLOC_FREE(db_path);
 
 	return idmap_tdb2_init_hwm(dom);
 }
diff --git a/source4/auth/gensec/gensec_gssapi.c b/source4/auth/gensec/gensec_gssapi.c
index a61b2b2659c..4577c91c93a 100644
--- a/source4/auth/gensec/gensec_gssapi.c
+++ b/source4/auth/gensec/gensec_gssapi.c
@@ -703,11 +703,7 @@ init_sec_context_done:
 			OM_uint32 lifetime = 0;
 			gss_cred_usage_t usage;
 			const char *role = NULL;
-			DEBUG(0, ("GSS %s Update(krb5)(%d) Update failed, credentials expired during GSSAPI handshake!\n",
-				  role,
-				  gensec_gssapi_state->gss_exchange_count));
 
-			
 			switch (gensec_security->gensec_role) {
 			case GENSEC_CLIENT:
 				creds = gensec_gssapi_state->client_cred->creds;
@@ -719,6 +715,11 @@ init_sec_context_done:
 				break;
 			}
 
+			DBG_ERR("GSS %s Update(krb5)(%d) failed, credentials "
+				"expired during GSSAPI handshake!\n",
+				role,
+				gensec_gssapi_state->gss_exchange_count);
+
 			maj_stat = gss_inquire_cred(&min_stat, 
 						    creds,
 						    &name, &lifetime, &usage, NULL);
diff --git a/source4/ntvfs/posix/vfs_posix.c b/source4/ntvfs/posix/vfs_posix.c
index df5637486d3..c69e979c31c 100644
--- a/source4/ntvfs/posix/vfs_posix.c
+++ b/source4/ntvfs/posix/vfs_posix.c
@@ -123,7 +123,6 @@ static void pvfs_setup_options(struct pvfs_state *pvfs)
 			pvfs, eadb, 50000,
 			lpcfg_tdb_flags(pvfs->ntvfs->ctx->lp_ctx, TDB_DEFAULT),
 			O_RDWR|O_CREAT, 0600);
-		TALLOC_FREE(eadb);
 		if (pvfs->ea_db != NULL) {
 			pvfs->flags |= PVFS_FLAG_XATTR_ENABLE;
 		} else {
@@ -131,6 +130,7 @@ static void pvfs_setup_options(struct pvfs_state *pvfs)
 				 eadb, strerror(errno)));
 			pvfs->flags &= ~PVFS_FLAG_XATTR_ENABLE;
 		}
+		TALLOC_FREE(eadb);
 	}
 
 	if (pvfs->flags & PVFS_FLAG_XATTR_ENABLE) {
diff --git a/source4/torture/rpc/drsuapi_cracknames.c b/source4/torture/rpc/drsuapi_cracknames.c
index c03f6bd1ca9..33917832069 100644
--- a/source4/torture/rpc/drsuapi_cracknames.c
+++ b/source4/torture/rpc/drsuapi_cracknames.c
@@ -213,13 +213,13 @@ static bool test_DsCrackNamesMatrix(struct torture_context *tctx,
 			} else if (n_matrix[i][j] == NULL && formats[j] == DRSUAPI_DS_NAME_FORMAT_SERVICE_PRINCIPAL) {
 			} else if (n_matrix[i][j] == NULL && n_from[j] != NULL) {
 				err_msg = talloc_asprintf(mem_ctx,
-						"dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: %s should be %s",
-						formats[i], formats[j], n_matrix[i][j], n_from[j]);
+						"dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: should be %s",
+						formats[i], formats[j], n_from[j]);
 				torture_fail(tctx, err_msg);
 			} else if (n_matrix[i][j] != NULL && n_from[j] == NULL) {
 				err_msg = talloc_asprintf(mem_ctx,
-						"dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: %s should be %s",
-						formats[i], formats[j], n_matrix[i][j], n_from[j]);
+						"dcerpc_drsuapi_DsCrackNames mismatch - from %d to %d: should be %s",
+						formats[i], formats[j], n_matrix[i][j]);
 				torture_fail(tctx, err_msg);
 			} else if (strcmp(n_matrix[i][j], n_from[j]) != 0) {
 				err_msg = talloc_asprintf(mem_ctx,
diff --git a/source4/torture/vfs/fruit.c b/source4/torture/vfs/fruit.c
index 43f5167bd11..45c7aaac7a3 100644
--- a/source4/torture/vfs/fruit.c
+++ b/source4/torture/vfs/fruit.c
@@ -1163,11 +1163,11 @@ static bool check_stream(struct smb2_tree *tree,
 
 	status = smb2_create(tree, mem_ctx, &create);
 	if (!NT_STATUS_IS_OK(status)) {
-		TALLOC_FREE(full_name);
 		if (value == NULL) {
 			return true;
 		}
 		torture_comment(tctx, "Unable to open stream %s\n", full_name);
+		TALLOC_FREE(full_name);
 		return false;
 	}
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list