summaryrefslogtreecommitdiff
path: root/source4/rpc_server/lsa
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-08-25 06:44:23 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:58:21 -0500
commitede02ee03867d2f6582c446fcab0882072baaa5a (patch)
treeea7e56a1b9f1552cc9752cf8736084555005518c /source4/rpc_server/lsa
parent294f6f16947c56d3fac5b24e5c95e8df522e18d6 (diff)
downloadsamba-ede02ee03867d2f6582c446fcab0882072baaa5a.tar.gz
samba-ede02ee03867d2f6582c446fcab0882072baaa5a.tar.bz2
samba-ede02ee03867d2f6582c446fcab0882072baaa5a.zip
r2051: switched the samdb over to using the new destructor and reference
count features of talloc, instead of re-implementing both those features inside of samdb (which is what we did before). This makes samdb considerably simpler, and also fixes some bugs, as I found some error paths that didn't call samdb_close(). Those are now handled by the fact that a talloc_free() will auto-close and destroy the samdb context, using a destructor. (This used to be commit da60987a92266734c33b81ee217081abdc4330f3)
Diffstat (limited to 'source4/rpc_server/lsa')
-rw-r--r--source4/rpc_server/lsa/dcesrv_lsa.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/source4/rpc_server/lsa/dcesrv_lsa.c b/source4/rpc_server/lsa/dcesrv_lsa.c
index c146b6d55a..f07997f3d6 100644
--- a/source4/rpc_server/lsa/dcesrv_lsa.c
+++ b/source4/rpc_server/lsa/dcesrv_lsa.c
@@ -51,7 +51,6 @@ static void lsa_Policy_close(struct lsa_policy_state *state)
{
state->reference_count--;
if (state->reference_count == 0) {
- samdb_close(state->sam_ctx);
talloc_destroy(state->mem_ctx);
}
}
@@ -162,7 +161,7 @@ static NTSTATUS lsa_OpenPolicy2(struct dcesrv_call_state *dce_call, TALLOC_CTX *
state->mem_ctx = lsa_mem_ctx;
/* make sure the sam database is accessible */
- state->sam_ctx = samdb_connect();
+ state->sam_ctx = samdb_connect(state->mem_ctx);
if (state->sam_ctx == NULL) {
talloc_destroy(state->mem_ctx);
return NT_STATUS_INVALID_SYSTEM_SERVICE;
@@ -173,7 +172,6 @@ static NTSTATUS lsa_OpenPolicy2(struct dcesrv_call_state *dce_call, TALLOC_CTX *
state->domain_dn = samdb_search_string(state->sam_ctx, state->mem_ctx, NULL,
"dn", "(&(objectClass=domain)(!(objectclass=builtinDomain)))");
if (!state->domain_dn) {
- samdb_close(state->sam_ctx);
talloc_destroy(state->mem_ctx);
return NT_STATUS_NO_SUCH_DOMAIN;
}