diff options
author | Michael Adam <obnox@samba.org> | 2007-05-22 21:04:56 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:22:43 -0500 |
commit | 5d1755710a9d6d2e160a2f6c394c9897993b5f6a (patch) | |
tree | 9915e29d302662415a3a68a0aa6c33bd034f02f8 /source3 | |
parent | 71ee55f98d87ff70e5feb0d2b280e9c71f7b9b6a (diff) | |
download | samba-5d1755710a9d6d2e160a2f6c394c9897993b5f6a.tar.gz samba-5d1755710a9d6d2e160a2f6c394c9897993b5f6a.tar.bz2 samba-5d1755710a9d6d2e160a2f6c394c9897993b5f6a.zip |
r23081: Reorder the lsa_lookup_sids functions so that the order makes more sense...
(This used to be commit 374dea8c6f5192224ee46e0c3c9b63221028858e)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/rpc_client/cli_lsarpc.c | 226 |
1 files changed, 113 insertions, 113 deletions
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index f0b4e936cd..d416b726ac 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -214,8 +214,8 @@ static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli, } } else { - (names)[i] = NULL; - (domains)[i] = NULL; + (names)[i] = ""; + (domains)[i] = ""; (types)[i] = SID_NAME_UNKNOWN; } } @@ -225,117 +225,6 @@ done: 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; - LSA_TRANS_NAME_ENUM t_names; - 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); - ZERO_STRUCT(t_names); - - r.dom_ref = &ref; - r.names = &t_names; - - 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 = t_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, &t_names.uni_name[i]); - - (*names)[i] = talloc_strdup(mem_ctx, name); - (*domains)[i] = talloc_strdup(mem_ctx, dom_name); - (*types)[i] = (enum lsa_SidType)t_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 sids * * do it the right way: there is a limit (of 20480 for w2k3) entries @@ -447,6 +336,117 @@ done: 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; + LSA_TRANS_NAME_ENUM t_names; + 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); + ZERO_STRUCT(t_names); + + r.dom_ref = &ref; + r.names = &t_names; + + 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 = t_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, &t_names.uni_name[i]); + + (*names)[i] = talloc_strdup(mem_ctx, name); + (*domains)[i] = talloc_strdup(mem_ctx, dom_name); + (*types)[i] = (enum lsa_SidType)t_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, |