diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-09-25 13:28:38 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:59:15 -0500 |
commit | 159f81ee32dbd7c832fb8c3723d0f0207d039078 (patch) | |
tree | 45ac569c2c1d1725a23bd6500f364d956d9c9d0a /source4/rpc_server/lsa/dcesrv_lsa.c | |
parent | 6310f40448f9f9e856874cbefcc25b753963a41e (diff) | |
download | samba-159f81ee32dbd7c832fb8c3723d0f0207d039078.tar.gz samba-159f81ee32dbd7c832fb8c3723d0f0207d039078.tar.bz2 samba-159f81ee32dbd7c832fb8c3723d0f0207d039078.zip |
r2635: mem_ctx cleanups on the lsa and netlogon pipes in the rpc server
(This used to be commit 1ee5ed4197f49f12372835f66160801f19ee35a6)
Diffstat (limited to 'source4/rpc_server/lsa/dcesrv_lsa.c')
-rw-r--r-- | source4/rpc_server/lsa/dcesrv_lsa.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c index f07997f3d6..f5bcae719b 100644 --- a/source4/rpc_server/lsa/dcesrv_lsa.c +++ b/source4/rpc_server/lsa/dcesrv_lsa.c @@ -38,7 +38,6 @@ enum lsa_handle { struct lsa_policy_state { int reference_count; void *sam_ctx; - TALLOC_CTX *mem_ctx; uint32_t access_mask; const char *domain_dn; }; @@ -51,7 +50,7 @@ static void lsa_Policy_close(struct lsa_policy_state *state) { state->reference_count--; if (state->reference_count == 0) { - talloc_destroy(state->mem_ctx); + talloc_free(state); } } @@ -145,40 +144,33 @@ static NTSTATUS lsa_OpenPolicy2(struct dcesrv_call_state *dce_call, TALLOC_CTX * { struct lsa_policy_state *state; struct dcesrv_handle *handle; - TALLOC_CTX *lsa_mem_ctx; ZERO_STRUCTP(r->out.handle); - lsa_mem_ctx = talloc_init("lsa_OpenPolicy"); - if (!lsa_mem_ctx) { - return NT_STATUS_NO_MEMORY; - } - - state = talloc_p(lsa_mem_ctx, struct lsa_policy_state); + state = talloc_p(dce_call->conn, struct lsa_policy_state); if (!state) { return NT_STATUS_NO_MEMORY; } - state->mem_ctx = lsa_mem_ctx; /* make sure the sam database is accessible */ - state->sam_ctx = samdb_connect(state->mem_ctx); + state->sam_ctx = samdb_connect(state); if (state->sam_ctx == NULL) { - talloc_destroy(state->mem_ctx); + talloc_free(state); return NT_STATUS_INVALID_SYSTEM_SERVICE; } /* work out the domain_dn - useful for so many calls its worth fetching here */ - state->domain_dn = samdb_search_string(state->sam_ctx, state->mem_ctx, NULL, + state->domain_dn = samdb_search_string(state->sam_ctx, state, NULL, "dn", "(&(objectClass=domain)(!(objectclass=builtinDomain)))"); if (!state->domain_dn) { - talloc_destroy(state->mem_ctx); + talloc_free(state); return NT_STATUS_NO_SUCH_DOMAIN; } handle = dcesrv_handle_new(dce_call->conn, LSA_HANDLE_POLICY); if (!handle) { - talloc_destroy(state->mem_ctx); + talloc_free(state); return NT_STATUS_NO_MEMORY; } |