[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Wed Mar 16 14:59:01 MDT 2011


The branch, master has been updated
       via  2581cb7 s3: Fix Coverity ID 1402: PASS_BY_VALUE
       via  a7a638c s3: Fix Coverity ID 2213, PASS_BY_VALUE
       via  a282455 s3: Fix Coverity ID 1012, CHECKED_RETURN
       via  9c9ed33 s3: Fix Coverity ID 1013, CHECKED_RETURN
       via  3835d77 s3: Fix Coverity ID 1017, CHECKED_RETURN
       via  920b2fd s3: Fix Coverity ID 1018, CHECKED_RETURN
       via  4668ac8 s3: Fix Coverity ID 1034, CHECKED_RETURN
      from  7bb76bc s3: Fix Coverity ID 2100, BAD_SIZEOF

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


- Log -----------------------------------------------------------------
commit 2581cb7ada25432474f06525ffa9b857bae91e8f
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Mar 16 20:34:30 2011 +0100

    s3: Fix Coverity ID 1402: PASS_BY_VALUE
    
    There's no point in passing GROUP_MAP on the stack
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Wed Mar 16 21:58:08 CET 2011 on sn-devel-104

commit a7a638c3cf6ee4a8f56d18a4d2e35fa5097c9183
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Mar 16 18:59:28 2011 +0100

    s3: Fix Coverity ID 2213, PASS_BY_VALUE
    
    There's little point to pass a copy of this structure on the stack.
    
    Günther, please check!

commit a282455978eb28855317ec6b667436f9c0edda02
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Mar 16 18:50:02 2011 +0100

    s3: Fix Coverity ID 1012, CHECKED_RETURN
    
    This is probably more or less taste. Removing the necessity for a comment is a
    good thing though IMO.

commit 9c9ed33cb7264db4ec486ead7d2cf1b414e79500
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Mar 16 18:50:02 2011 +0100

    s3: Fix Coverity ID 1013, CHECKED_RETURN
    
    This is probably more or less taste. Removing the necessity for a comment is a
    good thing though IMO.

commit 3835d77795bb3918a5eeea551afa02c94bb8db5a
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Mar 16 18:47:36 2011 +0100

    s3: Fix Coverity ID 1017, CHECKED_RETURN
    
    Günther, please check!

commit 920b2fddc6b442ad4f1eb72dcb38921876182b8b
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Mar 16 18:45:50 2011 +0100

    s3: Fix Coverity ID 1018, CHECKED_RETURN

commit 4668ac8b16daddacbaa0fe0e7ecdfbe6309abd3a
Author: Volker Lendecke <vl at samba.org>
Date:   Wed Mar 16 18:42:48 2011 +0100

    s3: Fix Coverity ID 1034, CHECKED_RETURN
    
    In all other places we check the result of secrets_init.

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

Summary of changes:
 source3/auth/auth_util.c                    |    8 ++++--
 source3/passdb/secrets.c                    |    4 +--
 source3/rpc_server/lsa/srv_lsa_nt.c         |   34 ++++++++++++--------------
 source3/rpc_server/spoolss/srv_spoolss_nt.c |    4 ++-
 source3/utils/net_groupmap.c                |   22 ++++++++--------
 5 files changed, 36 insertions(+), 36 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/auth/auth_util.c b/source3/auth/auth_util.c
index 5940628..c75b12e 100644
--- a/source3/auth/auth_util.c
+++ b/source3/auth/auth_util.c
@@ -488,9 +488,11 @@ NTSTATUS create_local_token(struct auth_serversupplied_info *server_info)
 				   "ignoring it\n", sid_string_dbg(sid)));
 			continue;
 		}
-		add_gid_to_array_unique(server_info, gid,
-					&server_info->utok.groups,
-					&server_info->utok.ngroups);
+		if (!add_gid_to_array_unique(server_info, gid,
+					     &server_info->utok.groups,
+					     &server_info->utok.ngroups)) {
+			return NT_STATUS_NO_MEMORY;
+		}
 	}
 
 	/*
diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c
index 45f8e15..49a0125 100644
--- a/source3/passdb/secrets.c
+++ b/source3/passdb/secrets.c
@@ -445,9 +445,7 @@ NTSTATUS secrets_trusted_domains(TALLOC_CTX *mem_ctx, uint32 *num_domains,
 {
 	struct list_trusted_domains_state state;
 
-	secrets_init();
-
-	if (db_ctx == NULL) {
+	if (!secrets_init()) {
 		return NT_STATUS_ACCESS_DENIED;
 	}
 
diff --git a/source3/rpc_server/lsa/srv_lsa_nt.c b/source3/rpc_server/lsa/srv_lsa_nt.c
index a4fc40a..061b481 100644
--- a/source3/rpc_server/lsa/srv_lsa_nt.c
+++ b/source3/rpc_server/lsa/srv_lsa_nt.c
@@ -184,7 +184,7 @@ static NTSTATUS lookup_lsa_rids(TALLOC_CTX *mem_ctx,
 		int dom_idx;
 		const char *full_name;
 		const char *domain;
-		enum lsa_SidType type = SID_NAME_UNKNOWN;
+		enum lsa_SidType type;
 
 		/* Split name into domain and user component */
 
@@ -199,11 +199,10 @@ static NTSTATUS lookup_lsa_rids(TALLOC_CTX *mem_ctx,
 
 		DEBUG(5, ("lookup_lsa_rids: looking up name %s\n", full_name));
 
-		/* We can ignore the result of lookup_name, it will not touch
-		   "type" if it's not successful */
-
-		lookup_name(mem_ctx, full_name, flags, &domain, NULL,
-			    &sid, &type);
+		if (!lookup_name(mem_ctx, full_name, flags, &domain, NULL,
+				 &sid, &type)) {
+			type = SID_NAME_UNKNOWN;
+		}
 
 		switch (type) {
 		case SID_NAME_USER:
@@ -268,7 +267,7 @@ static NTSTATUS lookup_lsa_sids(TALLOC_CTX *mem_ctx,
 		int dom_idx;
 		const char *full_name;
 		const char *domain;
-		enum lsa_SidType type = SID_NAME_UNKNOWN;
+		enum lsa_SidType type;
 
 		ZERO_STRUCT(sid);
 
@@ -281,11 +280,10 @@ static NTSTATUS lookup_lsa_sids(TALLOC_CTX *mem_ctx,
 
 		DEBUG(5, ("init_lsa_sids: looking up name %s\n", full_name));
 
-		/* We can ignore the result of lookup_name, it will not touch
-		   "type" if it's not successful */
-
-		lookup_name(mem_ctx, full_name, flags, &domain, NULL,
-			    &sid, &type);
+		if (!lookup_name(mem_ctx, full_name, flags, &domain, NULL,
+				 &sid, &type)) {
+			type = SID_NAME_UNKNOWN;
+		}
 
 		switch (type) {
 		case SID_NAME_USER:
@@ -1600,7 +1598,7 @@ NTSTATUS _lsa_OpenTrustedDomainByName(struct pipes_struct *p,
 static NTSTATUS add_trusted_domain_user(TALLOC_CTX *mem_ctx,
 					const char *netbios_name,
 					const char *domain_name,
-					struct trustDomainPasswords auth_struct)
+					const struct trustDomainPasswords *auth_struct)
 {
 	NTSTATUS status;
 	struct samu *sam_acct;
@@ -1640,14 +1638,14 @@ static NTSTATUS add_trusted_domain_user(TALLOC_CTX *mem_ctx,
 		return NT_STATUS_UNSUCCESSFUL;
 	}
 
-	for (i = 0; i < auth_struct.incoming.count; i++) {
-		switch (auth_struct.incoming.current.array[i].AuthType) {
+	for (i = 0; i < auth_struct->incoming.count; i++) {
+		switch (auth_struct->incoming.current.array[i].AuthType) {
 			case TRUST_AUTH_TYPE_CLEAR:
 				if (!convert_string_talloc(mem_ctx,
 							   CH_UTF16LE,
 							   CH_UNIX,
-							   auth_struct.incoming.current.array[i].AuthInfo.clear.password,
-							   auth_struct.incoming.current.array[i].AuthInfo.clear.size,
+							   auth_struct->incoming.current.array[i].AuthInfo.clear.password,
+							   auth_struct->incoming.current.array[i].AuthInfo.clear.size,
 							   &dummy,
 							   &dummy_size,
 							   false)) {
@@ -1787,7 +1785,7 @@ NTSTATUS _lsa_CreateTrustedDomainEx2(struct pipes_struct *p,
 		status = add_trusted_domain_user(p->mem_ctx,
 						 r->in.info->netbios_name.string,
 						 r->in.info->domain_name.string,
-						 auth_struct);
+						 &auth_struct);
 		if (!NT_STATUS_IS_OK(status)) {
 			return status;
 		}
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index dc036fa..3026a88 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -3647,7 +3647,9 @@ static WERROR printer_notify_info(struct pipes_struct *p,
 	if ( !option )
 		return WERR_BADFID;
 
-	get_printer_snum(p, hnd, &snum, NULL);
+	if (!get_printer_snum(p, hnd, &snum, NULL)) {
+		return WERR_BADFID;
+	}
 
 	/* Maybe we should use the SYSTEM session_info here... */
 	result = winreg_get_printer(mem_ctx,
diff --git a/source3/utils/net_groupmap.c b/source3/utils/net_groupmap.c
index 5efc5ae..7ae348c 100644
--- a/source3/utils/net_groupmap.c
+++ b/source3/utils/net_groupmap.c
@@ -56,19 +56,19 @@ static bool get_sid_from_input(struct dom_sid *sid, char *input)
  Dump a GROUP_MAP entry to stdout (long or short listing)
 **********************************************************/
 
-static void print_map_entry ( GROUP_MAP map, bool long_list )
+static void print_map_entry (const GROUP_MAP *map, bool long_list)
 {
 	if (!long_list)
-		d_printf("%s (%s) -> %s\n", map.nt_name,
-			 sid_string_tos(&map.sid), gidtoname(map.gid));
+		d_printf("%s (%s) -> %s\n", map->nt_name,
+			 sid_string_tos(&map->sid), gidtoname(map->gid));
 	else {
-		d_printf("%s\n", map.nt_name);
-		d_printf(_("\tSID       : %s\n"), sid_string_tos(&map.sid));
-		d_printf(_("\tUnix gid  : %u\n"), (unsigned int)map.gid);
-		d_printf(_("\tUnix group: %s\n"), gidtoname(map.gid));
+		d_printf("%s\n", map->nt_name);
+		d_printf(_("\tSID       : %s\n"), sid_string_tos(&map->sid));
+		d_printf(_("\tUnix gid  : %u\n"), (unsigned int)map->gid);
+		d_printf(_("\tUnix group: %s\n"), gidtoname(map->gid));
 		d_printf(_("\tGroup type: %s\n"),
-			 sid_type_lookup(map.sid_name_use));
-		d_printf(_("\tComment   : %s\n"), map.comment);
+			 sid_type_lookup(map->sid_name_use));
+		d_printf(_("\tComment   : %s\n"), map->comment);
 	}
 
 }
@@ -142,7 +142,7 @@ static int net_groupmap_list(struct net_context *c, int argc, const char **argv)
 			return -1;
 		}
 
-		print_map_entry( map, long_list );
+		print_map_entry(&map, long_list );
 	}
 	else {
 		GROUP_MAP *map=NULL;
@@ -151,7 +151,7 @@ static int net_groupmap_list(struct net_context *c, int argc, const char **argv)
 			return -1;
 
 		for (i=0; i<entries; i++) {
-			print_map_entry( map[i], long_list );
+			print_map_entry(&map[i], long_list);
 		}
 
 		SAFE_FREE(map);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list