summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-04-06 08:07:07 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:50:41 -0500
commit1c5de896bc0aa58c4463dca3675b299c2555fddf (patch)
tree45133495e28ecccbc61f479a22c30c5940ee1dc7 /source4
parent7d9763325cd68f8769d01e2e311aba5356d80077 (diff)
downloadsamba-1c5de896bc0aa58c4463dca3675b299c2555fddf.tar.gz
samba-1c5de896bc0aa58c4463dca3675b299c2555fddf.tar.bz2
samba-1c5de896bc0aa58c4463dca3675b299c2555fddf.zip
r67: added a destroy hook in the policy handle -> wire handle code to allow backends
to cleanup handle data (This used to be commit af0c21c1e175ca2ebb687dc6dff83da919280271)
Diffstat (limited to 'source4')
-rw-r--r--source4/rpc_server/dcerpc_server.c4
-rw-r--r--source4/rpc_server/dcerpc_server.h1
-rw-r--r--source4/rpc_server/handles.c4
3 files changed, 6 insertions, 3 deletions
diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c
index a17910e1d5..2d448f61de 100644
--- a/source4/rpc_server/dcerpc_server.c
+++ b/source4/rpc_server/dcerpc_server.c
@@ -315,9 +315,7 @@ void dcesrv_endpoint_disconnect(struct dcesrv_connection *p)
/* destroy any handles */
while (p->handles) {
- TALLOC_CTX *m = p->handles->mem_ctx;
- DLIST_REMOVE(p->handles, p->handles);
- talloc_destroy(m);
+ dcesrv_handle_destroy(p, p->handles);
}
talloc_destroy(p->mem_ctx);
diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h
index 08f3178689..c2bbe8073a 100644
--- a/source4/rpc_server/dcerpc_server.h
+++ b/source4/rpc_server/dcerpc_server.h
@@ -86,6 +86,7 @@ struct dcesrv_handle {
struct policy_handle wire_handle;
TALLOC_CTX *mem_ctx;
void *data;
+ void (*destroy)(struct dcesrv_connection *, struct dcesrv_handle *);
};
/* hold the authentication state information */
diff --git a/source4/rpc_server/handles.c b/source4/rpc_server/handles.c
index 043318c075..df6abd65a5 100644
--- a/source4/rpc_server/handles.c
+++ b/source4/rpc_server/handles.c
@@ -42,6 +42,7 @@ struct dcesrv_handle *dcesrv_handle_new(struct dcesrv_connection *dce_conn,
}
h->mem_ctx = mem_ctx;
h->data = NULL;
+ h->destroy = NULL;
h->wire_handle.handle_type = handle_type;
uuid_generate_random(&h->wire_handle.uuid);
@@ -57,6 +58,9 @@ struct dcesrv_handle *dcesrv_handle_new(struct dcesrv_connection *dce_conn,
void dcesrv_handle_destroy(struct dcesrv_connection *dce_conn,
struct dcesrv_handle *h)
{
+ if (h->destroy) {
+ h->destroy(dce_conn, h);
+ }
DLIST_REMOVE(dce_conn->handles, h);
talloc_destroy(h->mem_ctx);
}