svn commit: samba r5318 - in branches/SAMBA_3_0/source/utils: .

sharpe at samba.org sharpe at samba.org
Thu Feb 10 18:27:24 GMT 2005


Author: sharpe
Date: 2005-02-10 18:27:23 +0000 (Thu, 10 Feb 2005)
New Revision: 5318

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=5318

Log:

Fix a small problem in where we ignore the response from a SamrGetGroupsForUser
that says the user is in 0 groups, and we issue an RPC to LookupIds for 0 RIDs.

The printing that there are no groups the user is a member of might be overkill
in that it might upset existing scripts that don't expect that output.


Modified:
   branches/SAMBA_3_0/source/utils/net_rpc.c
   branches/SAMBA_3_0/source/utils/profiles.c


Changeset:
Modified: branches/SAMBA_3_0/source/utils/net_rpc.c
===================================================================
--- branches/SAMBA_3_0/source/utils/net_rpc.c	2005-02-10 17:40:02 UTC (rev 5317)
+++ branches/SAMBA_3_0/source/utils/net_rpc.c	2005-02-10 18:27:23 UTC (rev 5318)
@@ -1005,26 +1005,32 @@
 	result = cli_samr_query_usergroups(cli, mem_ctx, &user_pol,
 					   &num_rids, &user_gids);
 
+	if (!NT_STATUS_IS_OK(result)) goto done;
+
 	/* Look up rids */
 
-	rids = TALLOC_ARRAY(mem_ctx, uint32, num_rids);
+	if (rids) {
+		rids = TALLOC_ARRAY(mem_ctx, uint32, num_rids);
 
-	for (i = 0; i < num_rids; i++)
-                rids[i] = user_gids[i].g_rid;
+		for (i = 0; i < num_rids; i++)
+                	rids[i] = user_gids[i].g_rid;
 
-	result = cli_samr_lookup_rids(cli, mem_ctx, &domain_pol,
-				      flags, num_rids, rids,
-				      &num_names, &names, &name_types);
+		result = cli_samr_lookup_rids(cli, mem_ctx, &domain_pol,
+				      	      flags, num_rids, rids,
+				      	      &num_names, &names, &name_types);
 
-	if (!NT_STATUS_IS_OK(result)) {
-		goto done;
-	}
+		if (!NT_STATUS_IS_OK(result)) {
+			goto done;
+		}
 
-	/* Display results */
+		/* Display results */
 
-	for (i = 0; i < num_names; i++)
-		printf("%s\n", names[i]);
-
+		for (i = 0; i < num_names; i++)
+			printf("%s\n", names[i]);
+	}
+	else {
+		printf("no groups\n");
+	}
  done:
 	return result;
 }

Modified: branches/SAMBA_3_0/source/utils/profiles.c
===================================================================
--- branches/SAMBA_3_0/source/utils/profiles.c	2005-02-10 17:40:02 UTC (rev 5317)
+++ branches/SAMBA_3_0/source/utils/profiles.c	2005-02-10 18:27:23 UTC (rev 5318)
@@ -521,7 +521,7 @@
 int main(int argc, char *argv[])
 {
   int opt;
-  int fd, start = 0;
+  int fd;
   char *base;
   struct stat sbuf;
   REGF_HDR *regf_hdr;
@@ -608,10 +608,9 @@
    * Now, mmap the file into memory, check the header and start
    * dealing with the records. We are interested in the sk record
    */
-  start = 0;
 
 #ifdef HAVE_MMAP
-  base = mmap(&start, sbuf.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+  base = mmap(NULL, sbuf.st_size, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
 #else
   base = (char *)-1;
   errno = ENOSYS;



More information about the samba-cvs mailing list