diff options
author | Michael Adam <obnox@samba.org> | 2007-05-22 13:40:01 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:22:18 -0500 |
commit | 9d6fd22e27a96f66a00103d23574939106684f9f (patch) | |
tree | a9e3ba5254bffcaae49a545ea60f7f7c74573c49 /source3/rpc_client | |
parent | b5100b1f256599ae7bc6635762546c74986f68a9 (diff) | |
download | samba-9d6fd22e27a96f66a00103d23574939106684f9f.tar.gz samba-9d6fd22e27a96f66a00103d23574939106684f9f.tar.bz2 samba-9d6fd22e27a96f66a00103d23574939106684f9f.zip |
r23073: In the internal rpccli_lsa_lookup_sids_noalloc(), use a temporary
talloc context for use with the actual rpc query and response.
So the the parent context does not get flooded by the posslibly
large amount of response data (when looking up a lot of sids).
Note: It not possible, to simply use the names and domains arrays
as talloc contexts for the talloc_strdup calls, because from
rpccli_lsa_lookup_sids_all, this is called with names + offset
and domains + offset where names and domains are talloced
arraye for the complete response.
(This used to be commit 8e60900c5c5fccbe1718b805b6b1628d32b920d0)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r-- | source3/rpc_client/cli_lsarpc.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/source3/rpc_client/cli_lsarpc.c b/source3/rpc_client/cli_lsarpc.c index d0214eb5ff..f0b4e936cd 100644 --- a/source3/rpc_client/cli_lsarpc.c +++ b/source3/rpc_client/cli_lsarpc.c @@ -129,9 +129,8 @@ NTSTATUS rpccli_lsa_open_policy2(struct rpc_pipe_client *cli, /* Lookup a list of sids * - * internal version withOUT memory allocation. - * this assumes suffciently sized arrays to store - * domains, names and types */ + * 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, TALLOC_CTX *mem_ctx, @@ -148,12 +147,20 @@ static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli, DOM_R_REF ref; LSA_TRANS_NAME_ENUM t_names; NTSTATUS result = NT_STATUS_OK; + TALLOC_CTX *tmp_ctx = NULL; int i; + 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; + } + ZERO_STRUCT(q); ZERO_STRUCT(r); - init_q_lookup_sids(mem_ctx, &q, pol, num_sids, sids, 1); + init_q_lookup_sids(tmp_ctx, &q, pol, num_sids, sids, 1); ZERO_STRUCT(ref); ZERO_STRUCT(t_names); @@ -161,7 +168,7 @@ static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli, r.dom_ref = &ref; r.names = &t_names; - CLI_DO_RPC( cli, mem_ctx, PI_LSARPC, LSA_LOOKUPSIDS, + CLI_DO_RPC( cli, tmp_ctx, PI_LSARPC, LSA_LOOKUPSIDS, q, r, qbuf, rbuf, lsa_io_q_lookup_sids, @@ -213,8 +220,8 @@ static NTSTATUS rpccli_lsa_lookup_sids_noalloc(struct rpc_pipe_client *cli, } } - done: - +done: + TALLOC_FREE(tmp_ctx); return result; } @@ -401,7 +408,8 @@ NTSTATUS rpccli_lsa_lookup_sids_all(struct rpc_pipe_client *cli, sids_processed + hunk_num_sids - 1, num_sids)); - hunk_result = rpccli_lsa_lookup_sids_noalloc(cli, mem_ctx, + hunk_result = rpccli_lsa_lookup_sids_noalloc(cli, + mem_ctx, pol, hunk_num_sids, hunk_sids, |