uninitialised result status in net_groupmap.c

James Peach jpeach at sgi.com
Tue May 10 09:12:58 GMT 2005


On Tue, May 10, 2005 at 05:49:19PM +1000, James Peach wrote:
> In 3.0.14a and svn HEAD, the error messages printed by
> net_groupmap_listmem() and net_groupmap_memberships() will basically
> be arbitrary:
> 
> cc-1551 cc: WARNING File = utils/net_groupmap.c, Line = 683
>   The variable "result" is used before its value is set.
> 
>   			 argv[0], nt_errstr(result));
>   			                    ^
> 
> cc-1551 cc: WARNING File = utils/net_groupmap.c, Line = 711
>   The variable "result" is used before its value is set.
> 
>   			 argv[0], nt_errstr(result));
> 
> IMHO, it would be better if pdb_* all returned NT_STATUS, but there's a
> comment that these are for backwards compatibility, so the attached
> diff just removes the warning.

Let's try a patch that compiles ..

-- 
James Peach | jpeach at sgi.com | SGI Australian Software Group
I don't speak for SGI.
-------------- next part --------------
diff -r -u reference/source/utils/net_groupmap.c samba-3.0.14a/source/utils/net_groupmap.c
--- reference/source/utils/net_groupmap.c	Thu Apr 14 16:14:26 2005
+++ samba-3.0.14a/source/utils/net_groupmap.c	Tue May 10 17:41:19 2005
@@ -670,7 +670,6 @@
 	DOM_SID alias;
 	DOM_SID *members;
 	int i, num;
-	NTSTATUS result;
 
 	if ( (argc != 1) || 
 	     !string_to_sid(&alias, argv[0]) ) {
@@ -679,8 +678,7 @@
 	}
 
 	if (!pdb_enum_aliasmem(&alias, &members, &num)) {
-		d_printf("Could not list members for sid %s: %s\n",
-			 argv[0], nt_errstr(result));
+		d_printf("Could not list members for sid %s\n", argv[0]);
 		return -1;
 	}
 
@@ -698,7 +696,6 @@
 	DOM_SID member;
 	DOM_SID *aliases;
 	int i, num;
-	NTSTATUS result;
 
 	if ( (argc != 1) || 
 	     !string_to_sid(&member, argv[0]) ) {
@@ -707,8 +704,7 @@
 	}
 
 	if (!pdb_enum_alias_memberships(&member, 1, &aliases, &num)) {
-		d_printf("Could not list memberships for sid %s: %s\n",
-			 argv[0], nt_errstr(result));
+		d_printf("Could not list memberships for sid %s\n", argv[0]);
 		return -1;
 	}
 


More information about the samba-technical mailing list