[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Wed Dec 15 20:23:01 UTC 2021


The branch, master has been updated
       via  eae4c54e2b1 s3:winbind: Fix using normalized name in sam_name_to_sid()
       via  4e9a58f376f lib:util: Initialize pid
       via  31b9208d839 lib:krb_wrap: Add missing error check in smb_krb5_salt_principal_str()
       via  092e11295a9 s3:winbindd: Remove dead code from sam_rids_to_names()
       via  116123e9214 s4:dns_server: Remove less-than-zero comparison of an unsigned value
       via  90fd7674f81 ctdb:client: Initialize structs and pointers in ctdb_ctrl_(en|dis)able_node()
       via  3397e04d714 s3:libnet: Initialize struct ODJ_POLICY_DNS_DOMAIN_INFO
       via  e25af2bc4f1 lib:util: Check return value of tdb_parse_record()
       via  e8e1a74da3f s3:lib: Do not close fd = -1 on fail in netapi example
       via  9bd0fbf5e8d s3:lib: Fix memory leak in netapi examples
      from  c8c3c547646 s3: smbd: In call_trans2qfilepathinfo(), remove unneeded vfs_stat().

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


- Log -----------------------------------------------------------------
commit eae4c54e2b15c0022010b75c3117edce39d6c204
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Dec 14 16:27:17 2021 +0100

    s3:winbind: Fix using normalized name in sam_name_to_sid()
    
    name is never read again, we want lsa_name to be set.
    
    Found by covscan.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Volker Lendecke <vl at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Wed Dec 15 20:22:47 UTC 2021 on sn-devel-184

commit 4e9a58f376f60b16e88f0e34f35168fc3e260326
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Dec 14 16:13:51 2021 +0100

    lib:util: Initialize pid
    
    Found by covscan
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 31b9208d8390d2cb6fc784ff3486cab27a187b98
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Dec 14 16:12:43 2021 +0100

    lib:krb_wrap: Add missing error check in smb_krb5_salt_principal_str()
    
    Found by covscan.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 092e11295a9cfaed1cc0b70a4d1e25a6a106826c
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Dec 14 15:46:05 2021 +0100

    s3:winbindd: Remove dead code from sam_rids_to_names()
    
    domain_name is never NULL in this case. Found by covscan.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 116123e9214cfc9a2c2c0f5ffe223f65ae03da05
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Dec 14 15:42:06 2021 +0100

    s4:dns_server: Remove less-than-zero comparison of an unsigned value
    
    This will never be true. Found by covscan
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 90fd7674f81ca03485908ea483d6c9a5631a0179
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Dec 14 15:38:45 2021 +0100

    ctdb:client: Initialize structs and pointers in ctdb_ctrl_(en|dis)able_node()
    
    Found by covscan.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3397e04d7149f22604e6213e833190da7ce1a5ac
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Dec 10 15:10:39 2021 +0100

    s3:libnet: Initialize struct ODJ_POLICY_DNS_DOMAIN_INFO
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e25af2bc4f18e2c497c64e654b3059a1949c909e
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Dec 10 15:06:03 2021 +0100

    lib:util: Check return value of tdb_parse_record()
    
    This makes covscan happy.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit e8e1a74da3f5ba4850a6f4ad8b54ea2ac5703710
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Dec 10 15:03:20 2021 +0100

    s3:lib: Do not close fd = -1 on fail in netapi example
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 9bd0fbf5e8d2e4cf65d5d26311a8b510eef3eba5
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Dec 10 14:56:08 2021 +0100

    s3:lib: Fix memory leak in netapi examples
    
    Found by covscan.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

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

Summary of changes:
 ctdb/client/client_control_sync.c    | 12 ++++++++----
 lib/krb5_wrap/krb5_samba.c           |  5 +++++
 lib/util/pidfile.c                   |  2 +-
 lib/util/util_tdb.c                  |  7 +++++--
 source3/lib/netapi/examples/common.c | 12 +++++++++---
 source3/libnet/libnet_join_offline.c |  4 +++-
 source3/winbindd/winbindd_samr.c     | 11 ++---------
 source4/dns_server/pydns.c           |  2 +-
 8 files changed, 34 insertions(+), 21 deletions(-)


Changeset truncated at 500 lines:

diff --git a/ctdb/client/client_control_sync.c b/ctdb/client/client_control_sync.c
index e9f97dd0f30..1459dc09b46 100644
--- a/ctdb/client/client_control_sync.c
+++ b/ctdb/client/client_control_sync.c
@@ -2667,8 +2667,10 @@ int ctdb_ctrl_disable_node(TALLOC_CTX *mem_ctx,
 			   int destnode,
 			   struct timeval timeout)
 {
-	struct ctdb_req_control request;
-	struct ctdb_reply_control *reply;
+	struct ctdb_req_control request = {
+		.opcode = 0,
+	};
+	struct ctdb_reply_control *reply = NULL;
 	int ret;
 
 	ctdb_req_control_disable_node(&request);
@@ -2701,8 +2703,10 @@ int ctdb_ctrl_enable_node(TALLOC_CTX *mem_ctx,
 			  int destnode,
 			  struct timeval timeout)
 {
-	struct ctdb_req_control request;
-	struct ctdb_reply_control *reply;
+	struct ctdb_req_control request = {
+		.opcode = 0,
+	};
+	struct ctdb_reply_control *reply = NULL;
 	int ret;
 
 	ctdb_req_control_enable_node(&request);
diff --git a/lib/krb5_wrap/krb5_samba.c b/lib/krb5_wrap/krb5_samba.c
index fff5b4e2a22..61d651b4d5f 100644
--- a/lib/krb5_wrap/krb5_samba.c
+++ b/lib/krb5_wrap/krb5_samba.c
@@ -680,6 +680,11 @@ int smb_krb5_salt_principal_str(const char *realm,
 					   userPrincipalName,
 					   uac_flags,
 					   &salt_principal);
+	if (krb5_ret != 0) {
+		DBG_ERR("unable to create salt principal:%s\n",
+			error_message(krb5_ret));
+		return krb5_ret;
+	}
 
 	krb5_ret = krb5_unparse_name(krb5_ctx, salt_principal,
 				     &salt_principal_malloc);
diff --git a/lib/util/pidfile.c b/lib/util/pidfile.c
index 4f4e5e9782c..6ffbbeac5ee 100644
--- a/lib/util/pidfile.c
+++ b/lib/util/pidfile.c
@@ -207,7 +207,7 @@ void pidfile_create(const char *piddir, const char *name)
 {
 	size_t len = strlen(piddir) + strlen(name) + 6;
 	char pidFile[len];
-	pid_t pid;
+	pid_t pid = (pid_t)-1;
 	int ret, fd;
 
 	snprintf(pidFile, sizeof(pidFile), "%s/%s.pid", piddir, name);
diff --git a/lib/util/util_tdb.c b/lib/util/util_tdb.c
index b00b5039ec1..d8672c35b9a 100644
--- a/lib/util/util_tdb.c
+++ b/lib/util/util_tdb.c
@@ -142,8 +142,11 @@ static int fetch_int32_parser(TDB_DATA key, TDB_DATA data, void *private_data)
 
 static int32_t tdb_fetch_int32_byblob(struct tdb_context *tdb, TDB_DATA key)
 {
-	int v = -1;
-	tdb_parse_record(tdb, key, fetch_int32_parser, &v);
+	int32_t v = -1;
+	int32_t ret = tdb_parse_record(tdb, key, fetch_int32_parser, &v);
+	if (ret == -1) {
+		return ret;
+	}
 	return v;
 }
 
diff --git a/source3/lib/netapi/examples/common.c b/source3/lib/netapi/examples/common.c
index a1a491e60c2..66b2bd3b6d0 100644
--- a/source3/lib/netapi/examples/common.c
+++ b/source3/lib/netapi/examples/common.c
@@ -126,6 +126,7 @@ char *netapi_read_file(const char *filename, uint32_t *psize)
 	}
 
 	while (size < maxsize) {
+		char *tmp = NULL;
 		size_t newbufsize;
 		size_t nread;
 
@@ -136,10 +137,12 @@ char *netapi_read_file(const char *filename, uint32_t *psize)
 			goto fail; /* overflow */
 		}
 
-		p = realloc(p, sizeof(char)*newbufsize);
-		if (p == NULL) {
+		tmp = realloc(p, sizeof(char) * newbufsize);
+		if (tmp == NULL) {
+			free(p);
 			goto fail;
 		}
+		p = tmp;
 
 		nread = fread(p+size, 1, chunk, file);
 		size += nread;
@@ -151,6 +154,7 @@ char *netapi_read_file(const char *filename, uint32_t *psize)
 
 	err = ferror(file);
 	if (err != 0) {
+		free(p);
 		goto fail;
 	}
 
@@ -163,7 +167,9 @@ char *netapi_read_file(const char *filename, uint32_t *psize)
 	if (file != NULL) {
 		fclose(file);
 	}
-	close(fd);
+	if (fd >= 0) {
+		close(fd);
+	}
 
 	return p;
 }
diff --git a/source3/libnet/libnet_join_offline.c b/source3/libnet/libnet_join_offline.c
index 58d941e8230..33380207209 100644
--- a/source3/libnet/libnet_join_offline.c
+++ b/source3/libnet/libnet_join_offline.c
@@ -30,7 +30,9 @@ static WERROR libnet_odj_compose_ODJ_WIN7BLOB(TALLOC_CTX *mem_ctx,
 {
 	char *samaccount;
 	uint32_t len;
-	struct ODJ_POLICY_DNS_DOMAIN_INFO i;
+	struct ODJ_POLICY_DNS_DOMAIN_INFO i = {
+		.Sid = NULL,
+	};
 
 	ZERO_STRUCTP(b);
 
diff --git a/source3/winbindd/winbindd_samr.c b/source3/winbindd/winbindd_samr.c
index 6740d11dfb0..6b7a2c3be6a 100644
--- a/source3/winbindd/winbindd_samr.c
+++ b/source3/winbindd/winbindd_samr.c
@@ -683,7 +683,7 @@ static NTSTATUS sam_name_to_sid(struct winbindd_domain *domain,
 			tmp_ctx, name, &normalized);
 		if (NT_STATUS_IS_OK(nstatus) ||
 		    NT_STATUS_EQUAL(nstatus, NT_STATUS_FILE_RENAMED)) {
-			name = normalized;
+			lsa_name.string = normalized;
 		}
 	}
 
@@ -968,7 +968,6 @@ static NTSTATUS sam_rids_to_names(struct winbindd_domain *domain,
 
 		for (i=0; i<num_rids; i++) {
 			struct dom_sid sid;
-			char *dom_name = NULL;
 			char *name = NULL;
 
 			sid_compose(&sid, domain_sid, rids[i]);
@@ -980,16 +979,10 @@ static NTSTATUS sam_rids_to_names(struct winbindd_domain *domain,
 				domain,
 				tmp_ctx,
 				&sid,
-				&dom_name,
+				NULL,
 				&name,
 				&types[i]);
 			if (NT_STATUS_IS_OK(status)) {
-				if (domain_name == NULL) {
-					domain_name = dom_name;
-				} else {
-					/* always the same */
-					TALLOC_FREE(dom_name);
-				}
 				names[i] = talloc_move(names, &name);
 				num_mapped += 1;
 			}
diff --git a/source4/dns_server/pydns.c b/source4/dns_server/pydns.c
index 0b2013c384b..7b83d7c49a1 100644
--- a/source4/dns_server/pydns.c
+++ b/source4/dns_server/pydns.c
@@ -388,7 +388,7 @@ static PyObject *py_dsdb_dns_timestamp_to_nt_time(PyObject *self, PyObject *args
 		return NULL;
 	}
 
-	if (timestamp > UINT32_MAX || timestamp < 0) {
+	if (timestamp > UINT32_MAX) {
 		PyErr_SetString(PyExc_ValueError, "Time out of range");
 		return NULL;
 	}


-- 
Samba Shared Repository



More information about the samba-cvs mailing list