]>
Commit | Line | Data |
---|---|---|
0c2036ad JB |
1 | From c35e4be4f481312e3b0d639ae8bb980786749321 Mon Sep 17 00:00:00 2001 |
2 | From: Julien Kerihuel <j.kerihuel@openchange.org> | |
3 | Date: Mon, 6 Apr 2015 11:26:58 +0200 | |
4 | Subject: [PATCH] Add DCERPC flag to call unbind hooks without destroying the | |
5 | connection itself upon termination of a connection with outstanding pending | |
6 | calls. | |
7 | ||
8 | Reviewed-by: Stefan Metzmacher <metze@samba.org> | |
9 | Reviewed-by: Jelmer Vernooij <jelmer@samba.org> | |
10 | ||
11 | Autobuild-User(master): Jeremy Allison <jra@samba.org> | |
12 | Autobuild-Date(master): Tue Apr 14 20:39:34 CEST 2015 on sn-devel-104 | |
13 | ||
14 | (cherry picked from commit fd90d270c7e97a639f42a96b674a674d1b51aa0d) | |
15 | --- | |
16 | source4/rpc_server/dcerpc_server.c | 21 +++++++++++++++++++++ | |
17 | source4/rpc_server/dcerpc_server.h | 1 + | |
18 | 2 files changed, 22 insertions(+) | |
19 | ||
20 | diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c | |
21 | index 4681e17..f25aa68 100644 | |
22 | --- a/source4/rpc_server/dcerpc_server.c | |
23 | +++ b/source4/rpc_server/dcerpc_server.c | |
24 | @@ -504,6 +504,7 @@ static int dcesrv_connection_context_destructor(struct dcesrv_connection_context | |
25 | ||
26 | if (c->iface && c->iface->unbind) { | |
27 | c->iface->unbind(c, c->iface); | |
28 | + c->iface = NULL; | |
29 | } | |
30 | ||
31 | return 0; | |
32 | @@ -620,6 +621,10 @@ static NTSTATUS dcesrv_bind(struct dcesrv_call_state *call) | |
33 | extra_flags |= DCERPC_PFC_FLAG_CONC_MPX; | |
34 | } | |
35 | ||
36 | + if (call->state_flags & DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL) { | |
37 | + call->context->conn->state_flags |= DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL; | |
38 | + } | |
39 | + | |
40 | /* handle any authentication that is being requested */ | |
41 | if (!dcesrv_auth_bind(call)) { | |
42 | talloc_free(call->context); | |
43 | @@ -839,6 +844,10 @@ static NTSTATUS dcesrv_alter(struct dcesrv_call_state *call) | |
44 | } | |
45 | } | |
46 | ||
47 | + if (call->state_flags & DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL) { | |
48 | + call->context->conn->state_flags |= DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL; | |
49 | + } | |
50 | + | |
51 | /* setup a alter_resp */ | |
52 | dcesrv_init_hdr(&pkt, lpcfg_rpc_big_endian(call->conn->dce_ctx->lp_ctx)); | |
53 | pkt.auth_length = 0; | |
54 | @@ -1377,6 +1386,18 @@ static void dcesrv_cleanup_broken_connections(struct dcesrv_context *dce_ctx) | |
55 | cur = next; | |
56 | next = cur->next; | |
57 | ||
58 | + if (cur->state_flags & DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL) { | |
59 | + struct dcesrv_connection_context *context_cur, *context_next; | |
60 | + | |
61 | + context_next = cur->contexts; | |
62 | + while (context_next != NULL) { | |
63 | + context_cur = context_next; | |
64 | + context_next = context_cur->next; | |
65 | + | |
66 | + dcesrv_connection_context_destructor(context_cur); | |
67 | + } | |
68 | + } | |
69 | + | |
70 | dcesrv_terminate_connection(cur, cur->terminate); | |
71 | } | |
72 | } | |
73 | diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h | |
74 | index 2346876..8786cd8 100644 | |
75 | --- a/source4/rpc_server/dcerpc_server.h | |
76 | +++ b/source4/rpc_server/dcerpc_server.h | |
77 | @@ -102,6 +102,7 @@ struct dcesrv_call_state { | |
78 | #define DCESRV_CALL_STATE_FLAG_ASYNC (1<<0) | |
79 | #define DCESRV_CALL_STATE_FLAG_MAY_ASYNC (1<<1) | |
80 | #define DCESRV_CALL_STATE_FLAG_MULTIPLEXED (1<<3) | |
81 | +#define DCESRV_CALL_STATE_FLAG_PROCESS_PENDING_CALL (1<<4) | |
82 | uint32_t state_flags; | |
83 | ||
84 | /* the time the request arrived in the server */ | |
85 | -- | |
86 | 1.9.1 | |
87 |