r67: added a destroy hook in the policy handle -> wire handle code to allow backends
authorAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2004 08:07:07 +0000 (08:07 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:50:41 +0000 (12:50 -0500)
to cleanup handle data
(This used to be commit af0c21c1e175ca2ebb687dc6dff83da919280271)

source4/rpc_server/dcerpc_server.c
source4/rpc_server/dcerpc_server.h
source4/rpc_server/handles.c

index a17910e1d5e0975c3ea43efbe2a75283c00d034c..2d448f61de589bc57f3aa5da9ee4c78f1c2431be 100644 (file)
@@ -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);
index 08f3178689800be43ccb29189a39f39a50cee7de..c2bbe8073af919d1a26792c3fa3c8de1d39ab9a7 100644 (file)
@@ -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 */
index 043318c075c81d760b758afd2f3ff9d04f97033d..df6abd65a5383015f78c5ded77ca92c58966e2c4 100644 (file)
@@ -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);
 }