167d4b
From d9eb1359d86b47f3d1ef9f20523aeabd844befc8 Mon Sep 17 00:00:00 2001
167d4b
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
167d4b
Date: Fri, 14 Nov 2014 13:47:16 +0100
167d4b
Subject: [PATCH 1/3] s3-proto: remove duplicate proto for
167d4b
 add_string_to_array().
167d4b
MIME-Version: 1.0
167d4b
Content-Type: text/plain; charset=UTF-8
167d4b
Content-Transfer-Encoding: 8bit
167d4b
167d4b
Guenther
167d4b
167d4b
Signed-off-by: G端nther Deschner <gd@samba.org>
167d4b
Reviewed-by: Andreas Schneider <asn@samba.org>
167d4b
---
167d4b
 source3/include/proto.h | 3 ---
167d4b
 1 file changed, 3 deletions(-)
167d4b
167d4b
diff --git a/source3/include/proto.h b/source3/include/proto.h
167d4b
index 255948f..ce23289 100644
167d4b
--- a/source3/include/proto.h
167d4b
+++ b/source3/include/proto.h
167d4b
@@ -702,9 +702,6 @@ int ipstr_list_parse(const char *ipstr_list, struct ip_service **ip_list);
167d4b
 void ipstr_list_free(char* ipstr_list);
167d4b
 uint64_t STR_TO_SMB_BIG_UINT(const char *nptr, const char **entptr);
167d4b
 uint64_t conv_str_size(const char * str);
167d4b
-bool add_string_to_array(TALLOC_CTX *mem_ctx,
167d4b
-			 const char *str, const char ***strings,
167d4b
-			 int *num);
167d4b
 void sprintf_append(TALLOC_CTX *mem_ctx, char **string, ssize_t *len,
167d4b
 		    size_t *bufsize, const char *fmt, ...);
167d4b
 int asprintf_strupper_m(char **strp, const char *fmt, ...);
167d4b
-- 
167d4b
1.9.3
167d4b
167d4b
167d4b
From ee8ddb8e02f70e9d6050490d96a87e4fd2297a05 Mon Sep 17 00:00:00 2001
167d4b
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
167d4b
Date: Fri, 14 Nov 2014 13:27:45 +0100
167d4b
Subject: [PATCH 2/3] lib/util: use size_t for add_string_to_array().
167d4b
MIME-Version: 1.0
167d4b
Content-Type: text/plain; charset=UTF-8
167d4b
Content-Transfer-Encoding: 8bit
167d4b
167d4b
Guenther
167d4b
167d4b
Signed-off-by: G端nther Deschner <gd@samba.org>
167d4b
Reviewed-by: Andreas Schneider <asn@samba.org>
167d4b
---
167d4b
 lib/util/samba_util.h   | 2 +-
167d4b
 lib/util/util_strlist.c | 2 +-
167d4b
 2 files changed, 2 insertions(+), 2 deletions(-)
167d4b
167d4b
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
167d4b
index 2f762ac..1c7ae79 100644
167d4b
--- a/lib/util/samba_util.h
167d4b
+++ b/lib/util/samba_util.h
167d4b
@@ -253,7 +253,7 @@ _PUBLIC_ char *rfc1738_escape_part(TALLOC_CTX *mem_ctx, const char *url);
167d4b
  * number of elements in strings. It will be updated by this function.
167d4b
  */
167d4b
 _PUBLIC_ bool add_string_to_array(TALLOC_CTX *mem_ctx,
167d4b
-			 const char *str, const char ***strings, int *num);
167d4b
+			 const char *str, const char ***strings, size_t *num);
167d4b
 
167d4b
 /**
167d4b
   varient of strcmp() that handles NULL ptrs
167d4b
diff --git a/lib/util/util_strlist.c b/lib/util/util_strlist.c
167d4b
index 9dd4ab3..987fdfb 100644
167d4b
--- a/lib/util/util_strlist.c
167d4b
+++ b/lib/util/util_strlist.c
167d4b
@@ -453,7 +453,7 @@ _PUBLIC_ const char **str_list_append_const(const char **list1,
167d4b
  * number of elements in strings. It will be updated by this function.
167d4b
  */
167d4b
 _PUBLIC_ bool add_string_to_array(TALLOC_CTX *mem_ctx,
167d4b
-			 const char *str, const char ***strings, int *num)
167d4b
+			 const char *str, const char ***strings, size_t *num)
167d4b
 {
167d4b
 	char *dup_str = talloc_strdup(mem_ctx, str);
167d4b
 
167d4b
-- 
167d4b
1.9.3
167d4b
167d4b
167d4b
From a62cc2ce447870b4f4ab6ebf9c8d999af054d06f Mon Sep 17 00:00:00 2001
167d4b
From: =?UTF-8?q?G=C3=BCnther=20Deschner?= <gd@samba.org>
167d4b
Date: Fri, 14 Nov 2014 14:12:26 +0100
167d4b
Subject: [PATCH 3/3] samba: pass down size_t instead of int to
167d4b
 add_string_to_array().
167d4b
MIME-Version: 1.0
167d4b
Content-Type: text/plain; charset=UTF-8
167d4b
Content-Transfer-Encoding: 8bit
167d4b
167d4b
Guenther
167d4b
167d4b
Signed-off-by: G端nther Deschner <gd@samba.org>
167d4b
Reviewed-by: Andreas Schneider <asn@samba.org>
167d4b
167d4b
Autobuild-User(master): G端nther Deschner <gd@samba.org>
167d4b
Autobuild-Date(master): Mon Nov 17 19:53:22 CET 2014 on sn-devel-104
167d4b
---
167d4b
 libcli/ldap/ldap_message.h                  |  2 +-
167d4b
 libgpo/gpext/gpext.c                        |  2 +-
167d4b
 source3/lib/eventlog/eventlog.c             |  2 +-
167d4b
 source3/libads/ldap.c                       |  2 +-
167d4b
 source3/libnet/libnet_join.c                |  4 ++--
167d4b
 source3/rpc_server/lsa/srv_lsa_nt.c         |  2 +-
167d4b
 source3/rpc_server/netlogon/srv_netlog_nt.c |  2 +-
167d4b
 source3/rpc_server/spoolss/srv_spoolss_nt.c |  3 ++-
167d4b
 source3/rpcclient/cmd_spoolss.c             |  5 +++--
167d4b
 source3/winbindd/winbindd_cm.c              |  2 +-
167d4b
 source4/torture/rpc/samba3rpc.c             |  4 ++--
167d4b
 source4/torture/rpc/samr.c                  |  2 +-
167d4b
 source4/torture/rpc/wkssvc.c                | 10 +++++-----
167d4b
 13 files changed, 22 insertions(+), 20 deletions(-)
167d4b
167d4b
diff --git a/libcli/ldap/ldap_message.h b/libcli/ldap/ldap_message.h
167d4b
index 4385fe6..2f64881 100644
167d4b
--- a/libcli/ldap/ldap_message.h
167d4b
+++ b/libcli/ldap/ldap_message.h
167d4b
@@ -104,7 +104,7 @@ struct ldap_SearchRequest {
167d4b
 	uint32_t sizelimit;
167d4b
 	bool attributesonly;
167d4b
 	struct ldb_parse_tree *tree;
167d4b
-	int num_attributes;
167d4b
+	size_t num_attributes;
167d4b
 	const char * const *attributes;
167d4b
 };
167d4b
 
167d4b
diff --git a/libgpo/gpext/gpext.c b/libgpo/gpext/gpext.c
167d4b
index 2afcfec..1320dad 100644
167d4b
--- a/libgpo/gpext/gpext.c
167d4b
+++ b/libgpo/gpext/gpext.c
167d4b
@@ -524,7 +524,7 @@ static NTSTATUS gp_glob_ext_list(TALLOC_CTX *mem_ctx,
167d4b
 		name[PTR_DIFF(p, dirent->d_name)] = 0;
167d4b
 
167d4b
 		if (!add_string_to_array(mem_ctx, name, ext_list,
167d4b
-					 (int *)ext_list_len)) {
167d4b
+					 ext_list_len)) {
167d4b
 			closedir(dir);
167d4b
 			return NT_STATUS_NO_MEMORY;
167d4b
 		}
167d4b
diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c
167d4b
index 81957b1..34752fd 100644
167d4b
--- a/source3/lib/eventlog/eventlog.c
167d4b
+++ b/source3/lib/eventlog/eventlog.c
167d4b
@@ -586,7 +586,7 @@ bool parse_logentry( TALLOC_CTX *mem_ctx, char *line, struct eventlog_Record_tdb
167d4b
 		}
167d4b
 	} else if ( 0 == strncmp( start, "STR", stop - start ) ) {
167d4b
 		size_t tmp_len;
167d4b
-		int num_of_strings;
167d4b
+		size_t num_of_strings;
167d4b
 		/* skip past initial ":" */
167d4b
 		stop++;
167d4b
 		/* now skip any other leading whitespace */
167d4b
diff --git a/source3/libads/ldap.c b/source3/libads/ldap.c
167d4b
index 06b4895..b46f510 100644
167d4b
--- a/source3/libads/ldap.c
167d4b
+++ b/source3/libads/ldap.c
167d4b
@@ -3288,7 +3288,7 @@ ADS_STATUS ads_get_joinable_ous(ADS_STRUCT *ads,
167d4b
 
167d4b
 		if (!add_string_to_array(mem_ctx, dn,
167d4b
 					 (const char ***)ous,
167d4b
-					 (int *)num_ous)) {
167d4b
+					 num_ous)) {
167d4b
 			TALLOC_FREE(dn);
167d4b
 			ads_msgfree(ads, res);
167d4b
 			return ADS_ERROR(LDAP_NO_MEMORY);
167d4b
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
167d4b
index be953ae..7c70d35 100644
167d4b
--- a/source3/libnet/libnet_join.c
167d4b
+++ b/source3/libnet/libnet_join.c
167d4b
@@ -423,7 +423,7 @@ static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx,
167d4b
 	ok = ads_element_in_array(spn_array, num_spns, spn);
167d4b
 	if (!ok) {
167d4b
 		ok = add_string_to_array(spn_array, spn,
167d4b
-					 &spn_array, (int *)&num_spns);
167d4b
+					 &spn_array, &num_spns);
167d4b
 		if (!ok) {
167d4b
 			return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
167d4b
 		}
167d4b
@@ -448,7 +448,7 @@ static ADS_STATUS libnet_join_set_machine_spn(TALLOC_CTX *mem_ctx,
167d4b
 		ok = ads_element_in_array(spn_array, num_spns, spn);
167d4b
 		if (!ok) {
167d4b
 			ok = add_string_to_array(spn_array, spn,
167d4b
-						 &spn_array, (int *)&num_spns);
167d4b
+						 &spn_array, &num_spns);
167d4b
 			if (!ok) {
167d4b
 				return ADS_ERROR_LDAP(LDAP_NO_MEMORY);
167d4b
 			}
167d4b
diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c
167d4b
index 67909aa..039206b 100644
167d4b
--- a/source3/rpc_server/lsa/srv_lsa_nt.c
167d4b
+++ b/source3/rpc_server/lsa/srv_lsa_nt.c
167d4b
@@ -3335,7 +3335,7 @@ static NTSTATUS init_lsa_right_set(TALLOC_CTX *mem_ctx,
167d4b
 	uint32 i;
167d4b
 	const char *privname;
167d4b
 	const char **privname_array = NULL;
167d4b
-	int num_priv = 0;
167d4b
+	size_t num_priv = 0;
167d4b
 
167d4b
 	for (i=0; i<privileges->count; i++) {
167d4b
 		if (privileges->set[i].luid.high) {
167d4b
diff --git a/source3/rpc_server/netlogon/srv_netlog_nt.c b/source3/rpc_server/netlogon/srv_netlog_nt.c
167d4b
index de30106..fdcc847 100644
167d4b
--- a/source3/rpc_server/netlogon/srv_netlog_nt.c
167d4b
+++ b/source3/rpc_server/netlogon/srv_netlog_nt.c
167d4b
@@ -397,7 +397,7 @@ NTSTATUS _netr_NetrEnumerateTrustedDomains(struct pipes_struct *p,
167d4b
 	NTSTATUS status;
167d4b
 	NTSTATUS result = NT_STATUS_OK;
167d4b
 	DATA_BLOB blob;
167d4b
-	int num_domains = 0;
167d4b
+	size_t num_domains = 0;
167d4b
 	const char **trusted_domains = NULL;
167d4b
 	struct lsa_DomainList domain_list;
167d4b
 	struct dcerpc_binding_handle *h = NULL;
167d4b
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
167d4b
index f6fbfda..1226ec1 100644
167d4b
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
167d4b
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
167d4b
@@ -4902,7 +4902,8 @@ static WERROR string_array_from_driver_info(TALLOC_CTX *mem_ctx,
167d4b
 						  const char *arch,
167d4b
 						  int version)
167d4b
 {
167d4b
-	int i, num_strings = 0;
167d4b
+	int i;
167d4b
+	size_t num_strings = 0;
167d4b
 	const char **array = NULL;
167d4b
 
167d4b
 	if (string_array == NULL) {
167d4b
diff --git a/source3/rpcclient/cmd_spoolss.c b/source3/rpcclient/cmd_spoolss.c
167d4b
index fb011f8..c2b1e3d 100644
167d4b
--- a/source3/rpcclient/cmd_spoolss.c
167d4b
+++ b/source3/rpcclient/cmd_spoolss.c
167d4b
@@ -1659,7 +1659,7 @@ static bool init_drv_info_3_members(TALLOC_CTX *mem_ctx, struct spoolss_AddDrive
167d4b
                                     char *args)
167d4b
 {
167d4b
 	char	*str, *str2;
167d4b
-	int count = 0;
167d4b
+	size_t count = 0;
167d4b
 	char *saveptr = NULL;
167d4b
 	struct spoolss_StringArray *deps;
167d4b
 	const char **file_array = NULL;
167d4b
@@ -2636,7 +2636,8 @@ static WERROR cmd_spoolss_setprinterdata(struct rpc_pipe_client *cli,
167d4b
 		data.binary = strhex_to_data_blob(mem_ctx, argv[4]);
167d4b
 		break;
167d4b
 	case REG_MULTI_SZ: {
167d4b
-		int i, num_strings;
167d4b
+		int i;
167d4b
+		size_t num_strings;
167d4b
 		const char **strings = NULL;
167d4b
 
167d4b
 		num_strings = 0;
167d4b
diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c
167d4b
index 5071e02..52e3fa1 100644
167d4b
--- a/source3/winbindd/winbindd_cm.c
167d4b
+++ b/source3/winbindd/winbindd_cm.c
167d4b
@@ -1631,7 +1631,7 @@ static bool find_new_dc(TALLOC_CTX *mem_ctx,
167d4b
 	int num_dcs = 0;
167d4b
 
167d4b
 	const char **dcnames = NULL;
167d4b
-	int num_dcnames = 0;
167d4b
+	size_t num_dcnames = 0;
167d4b
 
167d4b
 	struct sockaddr_storage *addrs = NULL;
167d4b
 	int num_addrs = 0;
167d4b
diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c
167d4b
index 406eb9a..ff1a53c 100644
167d4b
--- a/source4/torture/rpc/samba3rpc.c
167d4b
+++ b/source4/torture/rpc/samba3rpc.c
167d4b
@@ -2634,7 +2634,7 @@ static bool rap_get_servername(struct torture_context *tctx,
167d4b
 static bool find_printers(struct torture_context *tctx,
167d4b
 			  struct dcerpc_pipe *p,
167d4b
 			  const char ***printers,
167d4b
-			  int *num_printers)
167d4b
+			  size_t *num_printers)
167d4b
 {
167d4b
 	struct srvsvc_NetShareEnum r;
167d4b
 	struct srvsvc_NetShareInfoCtr info_ctr;
167d4b
@@ -2771,7 +2771,7 @@ static bool torture_samba3_rpc_spoolss(struct torture_context *torture)
167d4b
 	struct dcerpc_binding_handle *b;
167d4b
 	struct policy_handle server_handle, printer_handle;
167d4b
 	const char **printers;
167d4b
-	int num_printers;
167d4b
+	size_t num_printers;
167d4b
 	struct spoolss_UserLevel1 userlevel1;
167d4b
 	char *servername;
167d4b
 
167d4b
diff --git a/source4/torture/rpc/samr.c b/source4/torture/rpc/samr.c
167d4b
index 7dfd183..293b672 100644
167d4b
--- a/source4/torture/rpc/samr.c
167d4b
+++ b/source4/torture/rpc/samr.c
167d4b
@@ -7258,7 +7258,7 @@ static bool test_GroupList(struct dcerpc_binding_handle *b,
167d4b
 	uint32_t returned_size;
167d4b
 	union samr_DispInfo info;
167d4b
 
167d4b
-	int num_names = 0;
167d4b
+	size_t num_names = 0;
167d4b
 	const char **names = NULL;
167d4b
 
167d4b
 	bool builtin_domain = dom_sid_compare(domain_sid,
167d4b
diff --git a/source4/torture/rpc/wkssvc.c b/source4/torture/rpc/wkssvc.c
167d4b
index 5bf64af..0927200 100644
167d4b
--- a/source4/torture/rpc/wkssvc.c
167d4b
+++ b/source4/torture/rpc/wkssvc.c
167d4b
@@ -530,7 +530,7 @@ static bool test_NetrEnumerateComputerNames_level(struct torture_context *tctx,
167d4b
 						  struct dcerpc_pipe *p,
167d4b
 						  uint16_t level,
167d4b
 						  const char ***names,
167d4b
-						  int *num_names)
167d4b
+						  size_t *num_names)
167d4b
 {
167d4b
 	NTSTATUS status;
167d4b
 	struct wkssvc_NetrEnumerateComputerNames r;
167d4b
@@ -666,7 +666,7 @@ static bool test_NetrAddAlternateComputerName(struct torture_context *tctx,
167d4b
 	NTSTATUS status;
167d4b
 	struct wkssvc_NetrAddAlternateComputerName r;
167d4b
 	const char **names = NULL;
167d4b
-	int num_names = 0;
167d4b
+	size_t num_names = 0;
167d4b
 	int i;
167d4b
 	struct dcerpc_binding_handle *b = p->binding_handle;
167d4b
 
167d4b
@@ -708,7 +708,7 @@ static bool test_NetrRemoveAlternateComputerName(struct torture_context *tctx,
167d4b
 	NTSTATUS status;
167d4b
 	struct wkssvc_NetrRemoveAlternateComputerName r;
167d4b
 	const char **names = NULL;
167d4b
-	int num_names = 0;
167d4b
+	size_t num_names = 0;
167d4b
 	int i;
167d4b
 	struct dcerpc_binding_handle *b = p->binding_handle;
167d4b
 
167d4b
@@ -781,7 +781,7 @@ static bool test_NetrSetPrimaryComputername(struct torture_context *tctx,
167d4b
 	*/
167d4b
 
167d4b
 	const char **names_o = NULL, **names = NULL;
167d4b
-	int num_names_o = 0, num_names = 0;
167d4b
+	size_t num_names_o = 0, num_names = 0;
167d4b
 
167d4b
 	torture_comment(tctx, "Testing NetrSetPrimaryComputername\n");
167d4b
 
167d4b
@@ -887,7 +887,7 @@ static bool test_NetrRenameMachineInDomain2(struct torture_context *tctx,
167d4b
 					    struct dcerpc_pipe *p)
167d4b
 {
167d4b
 	const char **names_o = NULL, **names = NULL;
167d4b
-	int num_names_o = 0, num_names = 0;
167d4b
+	size_t num_names_o = 0, num_names = 0;
167d4b
 
167d4b
 	torture_comment(tctx, "Testing NetrRenameMachineInDomain2\n");
167d4b
 
167d4b
-- 
167d4b
1.9.3
167d4b