summaryrefslogtreecommitdiff
path: root/source4/rpc_server/dcerpc_server.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/rpc_server/dcerpc_server.c')
-rw-r--r--source4/rpc_server/dcerpc_server.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c
index 9536fd6894..220c730790 100644
--- a/source4/rpc_server/dcerpc_server.c
+++ b/source4/rpc_server/dcerpc_server.c
@@ -269,6 +269,29 @@ NTSTATUS dcesrv_fetch_session_key(struct dcesrv_connection *p,
/*
+ destroy a link to an endpoint
+*/
+static int dcesrv_endpoint_destructor(void *ptr)
+{
+ struct dcesrv_connection *p = ptr;
+ if (p->iface) {
+ p->iface->unbind(p, p->iface);
+ }
+
+ /* destroy any handles */
+ while (p->handles) {
+ dcesrv_handle_destroy(p, p->handles);
+ }
+
+ if (p->auth_state.gensec_security) {
+ gensec_end(&p->auth_state.gensec_security);
+ }
+
+ return 0;
+}
+
+
+/*
connect to a dcerpc endpoint
*/
NTSTATUS dcesrv_endpoint_connect(struct dcesrv_context *dce_ctx,
@@ -294,6 +317,8 @@ NTSTATUS dcesrv_endpoint_connect(struct dcesrv_context *dce_ctx,
(*p)->auth_state.session_key = dcesrv_generic_session_key;
(*p)->srv_conn = NULL;
+ talloc_set_destructor(*p, dcesrv_endpoint_destructor);
+
return NT_STATUS_OK;
}
@@ -332,27 +357,6 @@ NTSTATUS dcesrv_endpoint_search_connect(struct dcesrv_context *dce_ctx,
}
-/*
- disconnect a link to an endpoint
-*/
-void dcesrv_endpoint_disconnect(struct dcesrv_connection *p)
-{
- if (p->iface) {
- p->iface->unbind(p, p->iface);
- }
-
- /* destroy any handles */
- while (p->handles) {
- dcesrv_handle_destroy(p, p->handles);
- }
-
- if (p->auth_state.gensec_security) {
- gensec_end(&p->auth_state.gensec_security);
- }
-
- talloc_free(p);
-}
-
static void dcesrv_init_hdr(struct dcerpc_packet *pkt)
{
pkt->rpc_vers = 5;