svn commit: samba r23081 - in branches/SAMBA_3_0/source/rpc_client: .

obnox at samba.org obnox at samba.org
Tue May 22 21:04:56 GMT 2007


Author: obnox
Date: 2007-05-22 21:04:56 +0000 (Tue, 22 May 2007)
New Revision: 23081

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

Log:
Reorder the lsa_lookup_sids functions so that the order makes more sense... 


Modified:
   branches/SAMBA_3_0/source/rpc_client/cli_lsarpc.c


Changeset:
Modified: branches/SAMBA_3_0/source/rpc_client/cli_lsarpc.c
===================================================================
--- branches/SAMBA_3_0/source/rpc_client/cli_lsarpc.c	2007-05-22 20:20:01 UTC (rev 23080)
+++ branches/SAMBA_3_0/source/rpc_client/cli_lsarpc.c	2007-05-22 21:04:56 UTC (rev 23081)
@@ -214,8 +214,8 @@
 			}
 
 		} else {
-			(names)[i] = NULL;
-			(domains)[i] = NULL;
+			(names)[i] = "";
+			(domains)[i] = "";
 			(types)[i] = SID_NAME_UNKNOWN;
 		}
 	}
@@ -225,6 +225,117 @@
 	return result;
 }
 
+/* Lookup a list of sids 
+ *
+ * do it the right way: there is a limit (of 20480 for w2k3) entries
+ * returned by this call. when the sids list contains more entries,
+ * empty lists are returned. This version of lsa_lookup_sids passes
+ * the list of sids in hunks of LOOKUP_SIDS_HUNK_SIZE to the lsa call. */
+
+/* This constant defines the limit of how many sids to look up
+ * in one call (maximum). the limit from the server side is
+ * at 20480 for win2k3, but we keep it at a save 1000 for now. */
+#define LOOKUP_SIDS_HUNK_SIZE 1000
+
+NTSTATUS rpccli_lsa_lookup_sids_all(struct rpc_pipe_client *cli,
+				    TALLOC_CTX *mem_ctx,
+				    POLICY_HND *pol, 
+				    int num_sids,
+				    const DOM_SID *sids, 
+				    char ***domains,
+				    char ***names,
+				    enum lsa_SidType **types)
+{
+	NTSTATUS result = NT_STATUS_OK;
+	int sids_left = 0;
+	int sids_processed = 0;
+	const DOM_SID *hunk_sids = sids;
+	char **hunk_domains = NULL;
+	char **hunk_names = NULL;
+	enum lsa_SidType *hunk_types = NULL;
+
+	if (num_sids) {
+		if (!((*domains) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
+			DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n"));
+			result = NT_STATUS_NO_MEMORY;
+			goto done;
+		}
+
+		if (!((*names) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
+			DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n"));
+			result = NT_STATUS_NO_MEMORY;
+			goto done;
+		}
+
+		if (!((*types) = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_sids))) {
+			DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n"));
+			result = NT_STATUS_NO_MEMORY;
+			goto done;
+		}
+	} else {
+		(*domains) = NULL;
+		(*names) = NULL;
+		(*types) = NULL;
+	}
+	
+	sids_left = num_sids;
+	hunk_domains = *domains;
+	hunk_names = *names;
+	hunk_types = *types;
+
+	while (sids_left > 0) {
+		int hunk_num_sids;
+		NTSTATUS hunk_result = NT_STATUS_OK;
+
+		hunk_num_sids = ((sids_left > LOOKUP_SIDS_HUNK_SIZE) 
+				? LOOKUP_SIDS_HUNK_SIZE 
+				: sids_left);
+
+		DEBUG(10, ("rpccli_lsa_lookup_sids_all: processing items "
+			   "%d -- %d of %d.\n", 
+			   sids_processed, 
+			   sids_processed + hunk_num_sids - 1,
+			   num_sids));
+
+		hunk_result = rpccli_lsa_lookup_sids_noalloc(cli,
+							     mem_ctx,
+							     pol,
+							     hunk_num_sids, 
+							     hunk_sids,
+							     hunk_domains,
+							     hunk_names,
+							     hunk_types);
+
+		if (!NT_STATUS_IS_OK(hunk_result) &&
+		    !NT_STATUS_EQUAL(hunk_result, STATUS_SOME_UNMAPPED) &&
+		    !NT_STATUS_EQUAL(hunk_result, NT_STATUS_NONE_MAPPED)) 
+		{
+			/* An actual error occured */
+			goto done;
+		}
+
+		/* adapt overall result */
+		if (( NT_STATUS_IS_OK(result) && 
+		     !NT_STATUS_IS_OK(hunk_result)) 
+		    ||
+		    ( NT_STATUS_EQUAL(result, NT_STATUS_NONE_MAPPED) &&
+		     !NT_STATUS_EQUAL(hunk_result, NT_STATUS_NONE_MAPPED)))
+		{
+			result = STATUS_SOME_UNMAPPED;
+		}
+
+		sids_left -= hunk_num_sids;
+		sids_processed += hunk_num_sids; /* only used in DEBUG */
+		hunk_sids += hunk_num_sids;
+		hunk_domains += hunk_num_sids;
+		hunk_names += hunk_num_sids;
+		hunk_types += hunk_num_sids;
+	}
+
+done:
+	return result;
+}
+
 /** Lookup a list of sids */
 
 NTSTATUS rpccli_lsa_lookup_sids(struct rpc_pipe_client *cli,
@@ -336,117 +447,6 @@
 	return result;
 }
 
-/* Lookup a list of sids 
- *
- * do it the right way: there is a limit (of 20480 for w2k3) entries
- * returned by this call. when the sids list contains more entries,
- * empty lists are returned. This version of lsa_lookup_sids passes
- * the list of sids in hunks of LOOKUP_SIDS_HUNK_SIZE to the lsa call. */
-
-/* This constant defines the limit of how many sids to look up
- * in one call (maximum). the limit from the server side is
- * at 20480 for win2k3, but we keep it at a save 1000 for now. */
-#define LOOKUP_SIDS_HUNK_SIZE 1000
-
-NTSTATUS rpccli_lsa_lookup_sids_all(struct rpc_pipe_client *cli,
-				    TALLOC_CTX *mem_ctx,
-				    POLICY_HND *pol, 
-				    int num_sids,
-				    const DOM_SID *sids, 
-				    char ***domains,
-				    char ***names,
-				    enum lsa_SidType **types)
-{
-	NTSTATUS result = NT_STATUS_OK;
-	int sids_left = 0;
-	int sids_processed = 0;
-	const DOM_SID *hunk_sids = sids;
-	char **hunk_domains = NULL;
-	char **hunk_names = NULL;
-	enum lsa_SidType *hunk_types = NULL;
-
-	if (num_sids) {
-		if (!((*domains) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
-			DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n"));
-			result = NT_STATUS_NO_MEMORY;
-			goto done;
-		}
-
-		if (!((*names) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) {
-			DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n"));
-			result = NT_STATUS_NO_MEMORY;
-			goto done;
-		}
-
-		if (!((*types) = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_sids))) {
-			DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n"));
-			result = NT_STATUS_NO_MEMORY;
-			goto done;
-		}
-	} else {
-		(*domains) = NULL;
-		(*names) = NULL;
-		(*types) = NULL;
-	}
-	
-	sids_left = num_sids;
-	hunk_domains = *domains;
-	hunk_names = *names;
-	hunk_types = *types;
-
-	while (sids_left > 0) {
-		int hunk_num_sids;
-		NTSTATUS hunk_result = NT_STATUS_OK;
-
-		hunk_num_sids = ((sids_left > LOOKUP_SIDS_HUNK_SIZE) 
-				? LOOKUP_SIDS_HUNK_SIZE 
-				: sids_left);
-
-		DEBUG(10, ("rpccli_lsa_lookup_sids_all: processing items "
-			   "%d -- %d of %d.\n", 
-			   sids_processed, 
-			   sids_processed + hunk_num_sids - 1,
-			   num_sids));
-
-		hunk_result = rpccli_lsa_lookup_sids_noalloc(cli,
-							     mem_ctx,
-							     pol,
-							     hunk_num_sids, 
-							     hunk_sids,
-							     hunk_domains,
-							     hunk_names,
-							     hunk_types);
-
-		if (!NT_STATUS_IS_OK(hunk_result) &&
-		    !NT_STATUS_EQUAL(hunk_result, STATUS_SOME_UNMAPPED) &&
-		    !NT_STATUS_EQUAL(hunk_result, NT_STATUS_NONE_MAPPED)) 
-		{
-			/* An actual error occured */
-			goto done;
-		}
-
-		/* adapt overall result */
-		if (( NT_STATUS_IS_OK(result) && 
-		     !NT_STATUS_IS_OK(hunk_result)) 
-		    ||
-		    ( NT_STATUS_EQUAL(result, NT_STATUS_NONE_MAPPED) &&
-		     !NT_STATUS_EQUAL(hunk_result, NT_STATUS_NONE_MAPPED)))
-		{
-			result = STATUS_SOME_UNMAPPED;
-		}
-
-		sids_left -= hunk_num_sids;
-		sids_processed += hunk_num_sids; /* only used in DEBUG */
-		hunk_sids += hunk_num_sids;
-		hunk_domains += hunk_num_sids;
-		hunk_names += hunk_num_sids;
-		hunk_types += hunk_num_sids;
-	}
-
-done:
-	return result;
-}
-
 /** Lookup a list of names */
 
 NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli,



More information about the samba-cvs mailing list