[SCM] Samba Shared Repository - branch v3-6-test updated

Jeremy Allison jra at samba.org
Mon Jan 10 13:22:50 MST 2011


The branch, v3-6-test has been updated
       via  ec3a786 s3: Fix some warnings in the zfsacl module
       via  9f35139 s3: Convert enc_blob_send_receive to cli_trans()
       via  d91fc9d s3: Fix two incompatible pointer type warnings on Solaris (cherry picked from commit 3274d80ffd19ccb5e5783f7577909121d8111854)
       via  88337fa s3-rpc_client: Fixed the dcerpc_lsa_LookupNames4 client_revision.
       via  0ea00ca s3-rpc_client: Fixed the dcerpc_lsa_LookupNames4 lookup_options.
       via  dd8956a s3-rpc_client: Fixed the dcerpc_lsa_LookupSids3 client_revision.
       via  46a1ef3 s3-rpc_client: Fixed the dcerpc_lsa_LookupSids3 lookup_options.
       via  7d58409 s3-netlogon: Move to new dcerpc client funtions.
       via  de60af3 s3-rpc_client: Added dcerpc_lsa_lookup_names.
       via  bd9bce6 s3-rpc_client: Added dcerpc_lsa_lookup_sids and dcerpc_lsa_lookup_sids3.
       via  32d692e s3-rpc_client: Added dcerpc_lsa_open_policy2.
       via  57a4b46 s3-rpc_client: Added dcerpc_lsa_open_policy.
      from  83f5ac4 s3: Remove superfluous ;

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-6-test


- Log -----------------------------------------------------------------
commit ec3a7863f3b98d9c537153bf1fa2a331b0e4c237
Author: Volker Lendecke <vl at samba.org>
Date:   Thu Jan 6 17:09:56 2011 +0100

    s3: Fix some warnings in the zfsacl module
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Sat Jan  8 13:42:20 CET 2011 on sn-devel-104
    (cherry picked from commit bdff4591ca80b0589954e812d8fe498038c87837)

commit 9f35139682e93b87510b5588bfe249e3ab53e962
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 9 10:53:04 2011 +0100

    s3: Convert enc_blob_send_receive to cli_trans()
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Sun Jan  9 11:40:04 CET 2011 on sn-devel-104
    (cherry picked from commit b57721faafad749f01df22bf555841aac158fa71)

commit d91fc9dea83976b4c7bd3987eba05cfe7195341e
Author: Volker Lendecke <vl at samba.org>
Date:   Sun Jan 9 10:20:29 2011 +0100

    s3: Fix two incompatible pointer type warnings on Solaris
    (cherry picked from commit 3274d80ffd19ccb5e5783f7577909121d8111854)

commit 88337fa257a6418dfa4cdaedd4744bdec115b8ba
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jan 5 17:35:36 2011 +0100

    s3-rpc_client: Fixed the dcerpc_lsa_LookupNames4 client_revision.
    
    The spec states that the ClientRevision value MUST be one of the
    following: LSA_CLIENT_REVISION_1 or LSA_CLIENT_REVISION_2.
    
    LSA_CLIENT_REVISION_2 means Windows 2000 and newer.
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    
    Autobuild-User: Günther Deschner <gd at samba.org>
    Autobuild-Date: Mon Jan 10 19:05:31 CET 2011 on sn-devel-104
    (cherry picked from commit 3f21b971a9fda418e1a96ada9e6778b04004e005)

commit 0ea00cae5b41506c02bd658d76ce72e7ee5ffccf
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jan 5 17:34:30 2011 +0100

    s3-rpc_client: Fixed the dcerpc_lsa_LookupNames4 lookup_options.
    
    Use the enum value in dcerpc_lsa_LookupNames4 for _lookup_options.
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit b1df95cbc5c5f0f5272ea047f9f8d93d5d732fcc)

commit dd8956a906109c78bc4d48458a16e25d25b79717
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jan 5 17:24:51 2011 +0100

    s3-rpc_client: Fixed the dcerpc_lsa_LookupSids3 client_revision.
    
    The spec states that the ClientRevision value MUST be one of the
    following: LSA_CLIENT_REVISION_1 or LSA_CLIENT_REVISION_2.
    
    LSA_CLIENT_REVISION_2 means Windows 2000 and newer.
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit e02916c4532c8cdd185624e1fe26b0496ef60419)

commit 46a1ef376790330caed4025b51b76299f1afcf3e
Author: Andreas Schneider <asn at samba.org>
Date:   Wed Jan 5 17:22:18 2011 +0100

    s3-rpc_client: Fixed the dcerpc_lsa_LookupSids3 lookup_options.
    
    Use the enum value in dcerpc_lsa_LookupSids3 for _lookup_options.
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit a53e0831d2491268b9fe808a3f9fda7dd9ebce5d)

commit 7d58409abffb1764795d7f0fb8f06705b105fd76
Author: Andreas Schneider <asn at samba.org>
Date:   Fri Sep 3 11:15:25 2010 +0200

    s3-netlogon: Move to new dcerpc client funtions.
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit b17eb8256d28f0ec2b6376f0bd3c90e0d664bd8f)

commit de60af3b2f0dc36742b4f00586b97e8c35d67600
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Sep 7 15:49:00 2010 +0200

    s3-rpc_client: Added dcerpc_lsa_lookup_names.
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit fd1fff608c03bd45741ff89ccfefe549b3abfada)

commit bd9bce67ad8586f754d0995271e28cf376e2f421
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Sep 7 14:58:19 2010 +0200

    s3-rpc_client: Added dcerpc_lsa_lookup_sids and dcerpc_lsa_lookup_sids3.
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit c91e756f8d406abee41f9644bd82353fdee347cb)

commit 32d692e5a57df0fdd7ee7a5f208bf3fff7afe774
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Sep 7 12:19:25 2010 +0200

    s3-rpc_client: Added dcerpc_lsa_open_policy2.
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit 8f14229b28321e82f6f444d48f514c54cbc24f9b)

commit 57a4b462b30b5c5718e5a5b25b408bf595555fb8
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Sep 7 11:24:52 2010 +0200

    s3-rpc_client: Added dcerpc_lsa_open_policy.
    
    Signed-off-by: Günther Deschner <gd at samba.org>
    (cherry picked from commit 2f819505afe2a5f1bd244a625861f7b07c78ae8f)

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

Summary of changes:
 source3/libsmb/clifsinfo.c         |   55 ++---
 source3/libsmb/unexpected.c        |    4 +-
 source3/modules/vfs_zfsacl.c       |   30 ++--
 source3/rpc_client/cli_lsarpc.c    |  443 +++++++++++++++++++++++++++---------
 source3/rpc_client/cli_lsarpc.h    |  136 +++++++++++
 source3/rpc_server/srv_netlog_nt.c |  196 ++++++++++++-----
 6 files changed, 649 insertions(+), 215 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/clifsinfo.c b/source3/libsmb/clifsinfo.c
index 69e6546..a5f58bb 100644
--- a/source3/libsmb/clifsinfo.c
+++ b/source3/libsmb/clifsinfo.c
@@ -519,48 +519,35 @@ NTSTATUS cli_get_posix_fs_info(struct cli_state *cli,
 
 static NTSTATUS enc_blob_send_receive(struct cli_state *cli, DATA_BLOB *in, DATA_BLOB *out, DATA_BLOB *param_out)
 {
-	uint16 setup;
-	char param[4];
-	char *rparam=NULL, *rdata=NULL;
-	unsigned int rparam_count=0, rdata_count=0;
-	NTSTATUS status = NT_STATUS_OK;
-
-	setup = TRANSACT2_SETFSINFO;
+	uint16_t setup[1];
+	uint8_t param[4];
+	uint8_t *rparam=NULL, *rdata=NULL;
+	uint32_t num_rparam, num_rdata;
+	NTSTATUS status;
 
+	SSVAL(setup+0, 0, TRANSACT2_SETFSINFO);
 	SSVAL(param,0,0);
 	SSVAL(param,2,SMB_REQUEST_TRANSPORT_ENCRYPTION);
 
-	if (!cli_send_trans(cli, SMBtrans2,
-				NULL,
-				0, 0,
-				&setup, 1, 0,
-				param, 4, 0,
-				(char *)in->data, in->length, CLI_BUFFER_SIZE)) {
-		status = cli_nt_error(cli);
-		goto out;
-	}
-
-	if (!cli_receive_trans(cli, SMBtrans2,
-				&rparam, &rparam_count,
-				&rdata, &rdata_count)) {
-		status = cli_nt_error(cli);
-		goto out;
-	}
+	status = cli_trans(talloc_tos(), cli, SMBtrans2, NULL, 0, 0, 0,
+			   setup, 1, 0,
+			   param, 4, 2,
+			   (uint8_t *)in->data, in->length, CLI_BUFFER_SIZE,
+			   NULL,	  /* recv_flags */
+			   NULL, 0, NULL, /* rsetup */
+			   &rparam, 0, &num_rparam,
+			   &rdata, 0, &num_rdata);
 
-	if (cli_is_error(cli)) {
-		status = cli_nt_error(cli);
-		if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
-			goto out;
-		}
+	if (!NT_STATUS_IS_OK(status) &&
+	    !NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) {
+		return status;
 	}
 
-	*out = data_blob(rdata, rdata_count);
-	*param_out = data_blob(rparam, rparam_count);
-
-  out:
+	*out = data_blob(rdata, num_rdata);
+	*param_out = data_blob(rparam, num_rparam);
 
-	SAFE_FREE(rparam);
-	SAFE_FREE(rdata);
+	TALLOC_FREE(rparam);
+	TALLOC_FREE(rdata);
 	return status;
 }
 
diff --git a/source3/libsmb/unexpected.c b/source3/libsmb/unexpected.c
index 12832f6..faee559 100644
--- a/source3/libsmb/unexpected.c
+++ b/source3/libsmb/unexpected.c
@@ -390,7 +390,7 @@ static void nb_packet_client_send(struct nb_packet_client *client,
 	state->hdr.type = p->packet_type;
 	state->hdr.len = build_packet(state->buf, sizeof(state->buf), p);
 
-	state->iov[0].iov_base = &state->hdr;
+	state->iov[0].iov_base = (char *)&state->hdr;
 	state->iov[0].iov_len = sizeof(state->hdr);
 	state->iov[1].iov_base = state->buf;
 	state->iov[1].iov_len = state->hdr.len;
@@ -540,7 +540,7 @@ static void nb_packet_reader_connected(struct tevent_req *subreq)
 		return;
 	}
 
-	state->iov[0].iov_base = &state->query;
+	state->iov[0].iov_base = (char *)&state->query;
 	state->iov[0].iov_len = sizeof(state->query);
 
 	if (state->mailslot_name != NULL) {
diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c
index 4c11f09..98c9bcf 100644
--- a/source3/modules/vfs_zfsacl.c
+++ b/source3/modules/vfs_zfsacl.c
@@ -254,36 +254,36 @@ static NTSTATUS zfsacl_fset_nt_acl(vfs_handle_struct *handle,
    Function declarations taken from vfs_solarisacl
 */
 
-SMB_ACL_T zfsacl_fail__sys_acl_get_file(vfs_handle_struct *handle,
-					const char *path_p,
-					SMB_ACL_TYPE_T type)
+static SMB_ACL_T zfsacl_fail__sys_acl_get_file(vfs_handle_struct *handle,
+					       const char *path_p,
+					       SMB_ACL_TYPE_T type)
 {
 	return (SMB_ACL_T)NULL;
 }
-SMB_ACL_T zfsacl_fail__sys_acl_get_fd(vfs_handle_struct *handle,
-				      files_struct *fsp,
-				      int fd)
+
+static SMB_ACL_T zfsacl_fail__sys_acl_get_fd(vfs_handle_struct *handle,
+					     files_struct *fsp)
 {
 	return (SMB_ACL_T)NULL;
 }
 
-int zfsacl_fail__sys_acl_set_file(vfs_handle_struct *handle,
-				  const char *name,
-				  SMB_ACL_TYPE_T type,
-				  SMB_ACL_T theacl)
+static int zfsacl_fail__sys_acl_set_file(vfs_handle_struct *handle,
+					 const char *name,
+					 SMB_ACL_TYPE_T type,
+					 SMB_ACL_T theacl)
 {
 	return -1;
 }
 
-int zfsacl_fail__sys_acl_set_fd(vfs_handle_struct *handle,
-				files_struct *fsp,
-				int fd, SMB_ACL_T theacl)
+static int zfsacl_fail__sys_acl_set_fd(vfs_handle_struct *handle,
+				       files_struct *fsp,
+				       SMB_ACL_T theacl)
 {
 	return -1;
 }
 
-int zfsacl_fail__sys_acl_delete_def_file(vfs_handle_struct *handle,
-					 const char *path)
+static int zfsacl_fail__sys_acl_delete_def_file(vfs_handle_struct *handle,
+						const char *path)
 {
 	return -1;
 }
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c
index 29cb09c..2ffd1c8 100644
--- a/source3/rpc_client/cli_lsarpc.c
+++ b/source3/rpc_client/cli_lsarpc.c
@@ -41,14 +41,12 @@
  * security authority", which is half of a password database.
  **/
 
-/** Open a LSA policy handle
- *
- * @param cli Handle on an initialised SMB connection */
-
-NTSTATUS rpccli_lsa_open_policy(struct rpc_pipe_client *cli,
+NTSTATUS dcerpc_lsa_open_policy(struct dcerpc_binding_handle *h,
 				TALLOC_CTX *mem_ctx,
-				bool sec_qos, uint32 des_access,
-				struct policy_handle *pol)
+				bool sec_qos,
+				uint32_t des_access,
+				struct policy_handle *pol,
+				NTSTATUS *result)
 {
 	struct lsa_ObjectAttribute attr;
 	struct lsa_QosInfo qos;
@@ -67,21 +65,47 @@ NTSTATUS rpccli_lsa_open_policy(struct rpc_pipe_client *cli,
 		attr.sec_qos		= &qos;
 	}
 
-	return rpccli_lsa_OpenPolicy(cli, mem_ctx,
+	return dcerpc_lsa_OpenPolicy(h,
+				     mem_ctx,
 				     &system_name,
 				     &attr,
 				     des_access,
-				     pol);
+				     pol,
+				     result);
 }
 
 /** Open a LSA policy handle
-  *
-  * @param cli Handle on an initialised SMB connection
-  */
+ *
+ * @param cli Handle on an initialised SMB connection */
 
-NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
-				 TALLOC_CTX *mem_ctx, bool sec_qos,
-				 uint32 des_access, struct policy_handle *pol)
+NTSTATUS rpccli_lsa_open_policy(struct rpc_pipe_client *cli,
+				TALLOC_CTX *mem_ctx,
+				bool sec_qos, uint32 des_access,
+				struct policy_handle *pol)
+{
+	NTSTATUS status;
+	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+
+	status = dcerpc_lsa_open_policy(cli->binding_handle,
+					mem_ctx,
+					sec_qos,
+					des_access,
+					pol,
+					&result);
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
+	return result;
+}
+
+NTSTATUS dcerpc_lsa_open_policy2(struct dcerpc_binding_handle *h,
+				 TALLOC_CTX *mem_ctx,
+				 const char *srv_name_slash,
+				 bool sec_qos,
+				 uint32_t des_access,
+				 struct policy_handle *pol,
+				 NTSTATUS *result)
 {
 	struct lsa_ObjectAttribute attr;
 	struct lsa_QosInfo qos;
@@ -99,11 +123,38 @@ NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
 		attr.sec_qos		= &qos;
 	}
 
-	return rpccli_lsa_OpenPolicy2(cli, mem_ctx,
-				      cli->srv_name_slash,
+	return dcerpc_lsa_OpenPolicy2(h,
+				      mem_ctx,
+				      srv_name_slash,
 				      &attr,
 				      des_access,
-				      pol);
+				      pol,
+				      result);
+}
+
+/** Open a LSA policy handle
+  *
+  * @param cli Handle on an initialised SMB connection
+  */
+
+NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
+				 TALLOC_CTX *mem_ctx, bool sec_qos,
+				 uint32 des_access, struct policy_handle *pol)
+{
+	NTSTATUS status;
+	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
+
+	status = dcerpc_lsa_open_policy(cli->binding_handle,
+					mem_ctx,
+					sec_qos,
+					des_access,
+					pol,
+					&result);
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
+
+	return result;
 }
 
 /* Lookup a list of sids
@@ -111,7 +162,7 @@ NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli,
  * internal version withOUT memory allocation of the target arrays.
  * this assumes suffciently sized arrays to store domains, names and types. */
 
-static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli,
+static NTSTATUS dcerpc_lsa_lookup_sids_noalloc(struct dcerpc_binding_handle *h,
 					       TALLOC_CTX *mem_ctx,
 					       struct policy_handle *pol,
 					       int num_sids,
@@ -119,29 +170,23 @@ static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli,
 					       char **domains,
 					       char **names,
 					       enum lsa_SidType *types,
-					       bool use_lookupsids3)
+					       bool use_lookupsids3,
+					       NTSTATUS *presult)
 {
-	NTSTATUS result = NT_STATUS_OK;
-	TALLOC_CTX *tmp_ctx = NULL;
-	int i;
+	NTSTATUS status = NT_STATUS_OK;
+	NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
 	struct lsa_SidArray sid_array;
 	struct lsa_RefDomainList *ref_domains = NULL;
 	struct lsa_TransNameArray lsa_names;
+	enum lsa_LookupNamesLevel level = LSA_LOOKUP_NAMES_ALL;
 	uint32_t count = 0;
-	uint16_t level = 1;
+	int i;
 
 	ZERO_STRUCT(lsa_names);
 
-	tmp_ctx = talloc_new(mem_ctx);
-	if (!tmp_ctx) {
-		DEBUG(0, ("rpccli_lsa_lookup_sids_noalloc: out of memory!\n"));
-		result = NT_STATUS_UNSUCCESSFUL;
-		goto done;
-	}
-
 	sid_array.num_sids = num_sids;
 	sid_array.sids = TALLOC_ARRAY(mem_ctx, struct lsa_SidPtr, num_sids);
-	if (!sid_array.sids) {
+	if (sid_array.sids == NULL) {
 		return NT_STATUS_NO_MEMORY;
 	}
 
@@ -158,19 +203,26 @@ static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli,
 
 		ZERO_STRUCT(lsa_names2);
 
-		result = rpccli_lsa_LookupSids3(cli, mem_ctx,
+		status = dcerpc_lsa_LookupSids3(h,
+						mem_ctx,
 						&sid_array,
 						&ref_domains,
 						&lsa_names2,
 						level,
 						&count,
-						0,
-						0);
+						LSA_LOOKUP_OPTION_SEARCH_ISOLATED_NAMES,
+						LSA_CLIENT_REVISION_2,
+						&result);
+		if (NT_STATUS_IS_OK(status)) {
+			return status;
+		}
 
-		if (!NT_STATUS_IS_ERR(result)) {
-			lsa_names.count	= lsa_names2.count;
-			lsa_names.names = talloc_array(mem_ctx, struct lsa_TranslatedName, lsa_names.count);
-			if (!lsa_names.names) {
+		if(!NT_STATUS_IS_ERR(result)) {
+			lsa_names.count = lsa_names2.count;
+			lsa_names.names = talloc_array(mem_ctx,
+						       struct lsa_TranslatedName,
+						       lsa_names.count);
+			if (lsa_names.names == NULL) {
 				return NT_STATUS_NO_MEMORY;
 			}
 			for (n=0; n < lsa_names.count; n++) {
@@ -181,28 +233,34 @@ static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli,
 		}
 
 	} else {
-		result = rpccli_lsa_LookupSids(cli, mem_ctx,
+		status = dcerpc_lsa_LookupSids(h,
+					       mem_ctx,
 					       pol,
 					       &sid_array,
 					       &ref_domains,
 					       &lsa_names,
 					       level,
-					       &count);
+					       &count,
+					       &result);
 	}
 
-	DEBUG(10, ("LSA_LOOKUPSIDS returned '%s', mapped count = %d'\n",
-		   nt_errstr(result), count));
+	DEBUG(10, ("LSA_LOOKUPSIDS returned status: '%s', result: '%s', "
+		   "mapped count = %d'\n",
+		   nt_errstr(status), nt_errstr(result), count));
+
+	if (!NT_STATUS_IS_OK(status)) {
+		return status;
+	}
 
 	if (!NT_STATUS_IS_OK(result) &&
 	    !NT_STATUS_EQUAL(result, NT_STATUS_NONE_MAPPED) &&
 	    !NT_STATUS_EQUAL(result, STATUS_SOME_UNMAPPED))
 	{
-		/* An actual error occured */
-		goto done;
+		*presult = result;
+		return status;
 	}
 
 	/* Return output parameters */
-
 	if (NT_STATUS_EQUAL(result, NT_STATUS_NONE_MAPPED) ||
 	    (count == 0))
 	{
@@ -211,8 +269,8 @@ static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli,
 			(domains)[i] = NULL;
 			(types)[i] = SID_NAME_UNKNOWN;
 		}
-		result = NT_STATUS_NONE_MAPPED;
-		goto done;
+		*presult = NT_STATUS_NONE_MAPPED;
+		return status;
 	}
 
 	for (i = 0; i < num_sids; i++) {
@@ -230,8 +288,8 @@ static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli,
 				(names)[i] = talloc_strdup(names, name);
 				if ((names)[i] == NULL) {
 					DEBUG(0, ("cli_lsa_lookup_sids_noalloc(): out of memory\n"));
-					result = NT_STATUS_UNSUCCESSFUL;
-					goto done;
+					*presult = NT_STATUS_UNSUCCESSFUL;
+					return status;
 				}
 			} else {
 				(names)[i] = NULL;
@@ -241,8 +299,8 @@ static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli,
 			(types)[i] = lsa_names.names[i].sid_type;
 			if (((domains)[i] == NULL)) {
 				DEBUG(0, ("cli_lsa_lookup_sids_noalloc(): out of memory\n"));
-				result = NT_STATUS_UNSUCCESSFUL;
-				goto done;
+				*presult = NT_STATUS_UNSUCCESSFUL;
+				return status;
 			}
 
 		} else {
@@ -252,9 +310,8 @@ static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli,
 		}
 	}
 
-done:
-	TALLOC_FREE(tmp_ctx);
-	return result;
+	*presult = NT_STATUS_OK;
+	return status;
 }
 
 /* Lookup a list of sids
@@ -269,7 +326,7 @@ done:
  * at 20480 for win2k3, but we keep it at a save 1000 for now. */
 #define LOOKUP_SIDS_HUNK_SIZE 1000
 
-static NTSTATUS rpccli_lsa_lookup_sids_generic(struct rpc_pipe_client *cli,
+static NTSTATUS dcerpc_lsa_lookup_sids_generic(struct dcerpc_binding_handle *h,
 					       TALLOC_CTX *mem_ctx,
 					       struct policy_handle *pol,
 					       int num_sids,
@@ -277,8 +334,10 @@ static NTSTATUS rpccli_lsa_lookup_sids_generic(struct rpc_pipe_client *cli,
 					       char ***pdomains,
 					       char ***pnames,
 					       enum lsa_SidType **ptypes,
-					       bool use_lookupsids3)
+					       bool use_lookupsids3,
+					       NTSTATUS *presult)
 {
+	NTSTATUS status;
 	NTSTATUS result = NT_STATUS_OK;
 	int sids_left = 0;
 	int sids_processed = 0;
@@ -319,7 +378,7 @@ static NTSTATUS rpccli_lsa_lookup_sids_generic(struct rpc_pipe_client *cli,
 
 	while (sids_left > 0) {
 		int hunk_num_sids;
-		NTSTATUS hunk_result = NT_STATUS_OK;
+		NTSTATUS hunk_result;
 
 		hunk_num_sids = ((sids_left > LOOKUP_SIDS_HUNK_SIZE)
 				? LOOKUP_SIDS_HUNK_SIZE
@@ -331,22 +390,26 @@ static NTSTATUS rpccli_lsa_lookup_sids_generic(struct rpc_pipe_client *cli,
 			   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,
-							     use_lookupsids3);
+		status = dcerpc_lsa_lookup_sids_noalloc(h,
+							mem_ctx,
+							pol,
+							hunk_num_sids,
+							hunk_sids,
+							hunk_domains,
+							hunk_names,
+							hunk_types,
+							use_lookupsids3,
+							&hunk_result);
+		if (!NT_STATUS_IS_OK(status)) {
+			goto fail;
+		}
 
 		if (!NT_STATUS_IS_OK(hunk_result) &&
 		    !NT_STATUS_EQUAL(hunk_result, STATUS_SOME_UNMAPPED) &&


-- 
Samba Shared Repository


More information about the samba-cvs mailing list