From fd1fff608c03bd45741ff89ccfefe549b3abfada Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 7 Sep 2010 15:49:00 +0200 Subject: [PATCH] s3-rpc_client: Added dcerpc_lsa_lookup_names. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Günther Deschner --- source3/rpc_client/cli_lsarpc.c | 147 +++++++++++++++++++++++++------- source3/rpc_client/cli_lsarpc.h | 21 +++++ 2 files changed, 137 insertions(+), 31 deletions(-) diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index ac6bfb8106d..6b5d7f82d4a 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -564,38 +564,41 @@ NTSTATUS rpccli_lsa_lookup_sids3(struct rpc_pipe_client *cli, /** Lookup a list of names */ -static NTSTATUS rpccli_lsa_lookup_names_generic(struct rpc_pipe_client *cli, +static NTSTATUS dcerpc_lsa_lookup_names_generic(struct dcerpc_binding_handle *h, TALLOC_CTX *mem_ctx, - struct policy_handle *pol, int num_names, + struct policy_handle *pol, + uint32_t num_names, const char **names, const char ***dom_names, - int level, + enum lsa_LookupNamesLevel level, struct dom_sid **sids, enum lsa_SidType **types, - bool use_lookupnames4) + bool use_lookupnames4, + NTSTATUS *presult) { - NTSTATUS result; - int i; + NTSTATUS status; struct lsa_String *lsa_names = NULL; struct lsa_RefDomainList *domains = NULL; struct lsa_TransSidArray sid_array; struct lsa_TransSidArray3 sid_array3; uint32_t count = 0; + uint32_t i; ZERO_STRUCT(sid_array); ZERO_STRUCT(sid_array3); lsa_names = TALLOC_ARRAY(mem_ctx, struct lsa_String, num_names); - if (!lsa_names) { + if (lsa_names == NULL) { return NT_STATUS_NO_MEMORY; } - for (i=0; ibinding_handle, + mem_ctx, + pol, + num_names, + names, + dom_names, + level, + sids, + types, + &result); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + return result; +} + +NTSTATUS dcerpc_lsa_lookup_names4(struct dcerpc_binding_handle *h, + TALLOC_CTX *mem_ctx, + struct policy_handle *pol, + uint32_t num_names, + const char **names, + const char ***dom_names, + enum lsa_LookupNamesLevel level, + struct dom_sid **sids, + enum lsa_SidType **types, + NTSTATUS *result) +{ + return dcerpc_lsa_lookup_names_generic(h, + mem_ctx, + pol, + num_names, + names, + dom_names, + level, + sids, + types, + true, + result); } NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, - struct policy_handle *pol, int num_names, + struct policy_handle *pol, + int num_names, const char **names, const char ***dom_names, int level, struct dom_sid **sids, enum lsa_SidType **types) { - return rpccli_lsa_lookup_names_generic(cli, mem_ctx, pol, num_names, - names, dom_names, level, sids, - types, true); + NTSTATUS status; + NTSTATUS result = NT_STATUS_UNSUCCESSFUL; + + status = dcerpc_lsa_lookup_names4(cli->binding_handle, + mem_ctx, + pol, + num_names, + names, + dom_names, + level, + sids, + types, + &result); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + return result; } diff --git a/source3/rpc_client/cli_lsarpc.h b/source3/rpc_client/cli_lsarpc.h index fb7760a2bf6..26fcb75fa1b 100644 --- a/source3/rpc_client/cli_lsarpc.h +++ b/source3/rpc_client/cli_lsarpc.h @@ -138,6 +138,16 @@ NTSTATUS rpccli_lsa_lookup_sids3(struct rpc_pipe_client *cli, char ***pnames, enum lsa_SidType **ptypes); +NTSTATUS dcerpc_lsa_lookup_names(struct dcerpc_binding_handle *h, + TALLOC_CTX *mem_ctx, + struct policy_handle *pol, + uint32_t num_names, + const char **names, + const char ***dom_names, + enum lsa_LookupNamesLevel level, + struct dom_sid **sids, + enum lsa_SidType **types, + NTSTATUS *result); NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *pol, int num_names, @@ -146,6 +156,17 @@ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, int level, struct dom_sid **sids, enum lsa_SidType **types); + +NTSTATUS dcerpc_lsa_lookup_names4(struct dcerpc_binding_handle *h, + TALLOC_CTX *mem_ctx, + struct policy_handle *pol, + uint32_t num_names, + const char **names, + const char ***dom_names, + enum lsa_LookupNamesLevel level, + struct dom_sid **sids, + enum lsa_SidType **types, + NTSTATUS *result); NTSTATUS rpccli_lsa_lookup_names4(struct rpc_pipe_client *cli, TALLOC_CTX *mem_ctx, struct policy_handle *pol, int num_names,