diff options
Diffstat (limited to 'source3/rpc_client/cli_lsarpc.c')
-rw-r--r-- | source3/rpc_client/cli_lsarpc.c | 132 |
1 files changed, 12 insertions, 120 deletions
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index 0f66f14288..1af31228da 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -244,14 +244,14 @@ done: * 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 rpccli_lsa_lookup_sids(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; @@ -263,19 +263,19 @@ NTSTATUS rpccli_lsa_lookup_sids_all(struct rpc_pipe_client *cli, if (num_sids) { if (!((*domains) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) { - DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n")); + DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n")); result = NT_STATUS_NO_MEMORY; goto fail; } if (!((*names) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) { - DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n")); + DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n")); result = NT_STATUS_NO_MEMORY; goto fail; } if (!((*types) = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_sids))) { - DEBUG(0, ("rpccli_lsa_lookup_sids_all(): out of memory\n")); + DEBUG(0, ("rpccli_lsa_lookup_sids(): out of memory\n")); result = NT_STATUS_NO_MEMORY; goto fail; } @@ -298,7 +298,7 @@ NTSTATUS rpccli_lsa_lookup_sids_all(struct rpc_pipe_client *cli, ? LOOKUP_SIDS_HUNK_SIZE : sids_left); - DEBUG(10, ("rpccli_lsa_lookup_sids_all: processing items " + DEBUG(10, ("rpccli_lsa_lookup_sids: processing items " "%d -- %d of %d.\n", sids_processed, sids_processed + hunk_num_sids - 1, @@ -349,114 +349,6 @@ fail: return result; } -/** Lookup a list of sids */ - -NTSTATUS rpccli_lsa_lookup_sids(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) -{ - prs_struct qbuf, rbuf; - LSA_Q_LOOKUP_SIDS q; - LSA_R_LOOKUP_SIDS r; - DOM_R_REF ref; - NTSTATUS result = NT_STATUS_OK; - int i; - - ZERO_STRUCT(q); - ZERO_STRUCT(r); - - init_q_lookup_sids(mem_ctx, &q, pol, num_sids, sids, 1); - - ZERO_STRUCT(ref); - - r.dom_ref = &ref; - - CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_LOOKUPSIDS, - q, r, - qbuf, rbuf, - lsa_io_q_lookup_sids, - lsa_io_r_lookup_sids, - NT_STATUS_UNSUCCESSFUL ); - - if (!NT_STATUS_IS_OK(r.status) && - !NT_STATUS_EQUAL(r.status, STATUS_SOME_UNMAPPED)) { - - /* An actual error occured */ - result = r.status; - - goto done; - } - - /* Return output parameters */ - - if (r.mapped_count == 0) { - result = NT_STATUS_NONE_MAPPED; - goto done; - } - - if (num_sids) { - if (!((*domains) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) { - DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n")); - result = NT_STATUS_NO_MEMORY; - goto done; - } - - if (!((*names) = TALLOC_ARRAY(mem_ctx, char *, num_sids))) { - DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n")); - result = NT_STATUS_NO_MEMORY; - goto done; - } - - if (!((*types) = TALLOC_ARRAY(mem_ctx, enum lsa_SidType, num_sids))) { - DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n")); - result = NT_STATUS_NO_MEMORY; - goto done; - } - } else { - (*domains) = NULL; - (*names) = NULL; - (*types) = NULL; - } - - for (i = 0; i < num_sids; i++) { - fstring name, dom_name; - uint32 dom_idx = r.names.name[i].domain_idx; - - /* Translate optimised name through domain index array */ - - if (dom_idx != 0xffffffff) { - - rpcstr_pull_unistr2_fstring( - dom_name, &ref.ref_dom[dom_idx].uni_dom_name); - rpcstr_pull_unistr2_fstring( - name, &r.names.uni_name[i]); - - (*names)[i] = talloc_strdup(mem_ctx, name); - (*domains)[i] = talloc_strdup(mem_ctx, dom_name); - (*types)[i] = (enum lsa_SidType)r.names.name[i].sid_name_use; - - if (((*names)[i] == NULL) || ((*domains)[i] == NULL)) { - DEBUG(0, ("cli_lsa_lookup_sids(): out of memory\n")); - result = NT_STATUS_UNSUCCESSFUL; - goto done; - } - - } else { - (*names)[i] = NULL; - (*domains)[i] = NULL; - (*types)[i] = SID_NAME_UNKNOWN; - } - } - - done: - - return result; -} - /** Lookup a list of names */ NTSTATUS rpccli_lsa_lookup_names(struct rpc_pipe_client *cli, |