diff options
author | Stefan Metzmacher <metze@samba.org> | 2018-11-23 14:28:56 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-01-12 03:13:39 +0100 |
commit | 9d387919f61b64c24c99d9ea3db2425001377c30 (patch) | |
tree | 42d2b0d6b450f9680c7cb4f5bd3eea749ac6c9f7 /source4 | |
parent | a8134191ec000b236948b93d2e2290cc4dc8b110 (diff) | |
download | samba-9d387919f61b64c24c99d9ea3db2425001377c30.tar.gz |
s4:rpc_server/remote: introduce struct dcesrv_remote_call
This holds the state for async requests.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/rpc_server/remote/dcesrv_remote.c | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/source4/rpc_server/remote/dcesrv_remote.c b/source4/rpc_server/remote/dcesrv_remote.c index 7a1ec3f78f9..3fa847222c4 100644 --- a/source4/rpc_server/remote/dcesrv_remote.c +++ b/source4/rpc_server/remote/dcesrv_remote.c @@ -262,8 +262,14 @@ static NTSTATUS remote_op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_CT static void remote_op_dispatch_done(struct tevent_req *subreq); +struct dcesrv_remote_call { + struct dcesrv_call_state *dce_call; + struct dcesrv_remote_private *priv; +}; + static NTSTATUS remote_op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx, void *r) { + struct dcesrv_remote_call *rcall = NULL; struct dcesrv_remote_private *priv = NULL; uint16_t opnum = dce_call->pkt.u.request.opnum; const struct ndr_interface_table *table = dce_call->context->iface->private_data; @@ -281,6 +287,13 @@ static NTSTATUS remote_op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CT return status; } + rcall = talloc_zero(dce_call, struct dcesrv_remote_call); + if (rcall == NULL) { + return NT_STATUS_NO_MEMORY; + } + rcall->dce_call = dce_call; + rcall->priv = priv; + if (priv->c_pipe->conn->flags & DCERPC_DEBUG_PRINT_IN) { ndr_print_function_debug(call->ndr_print, name, NDR_IN | NDR_SET_VALUES, r); } @@ -288,7 +301,7 @@ static NTSTATUS remote_op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CT priv->c_pipe->conn->flags |= DCERPC_NDR_REF_ALLOC; /* we didn't use the return code of this function as we only check the last_fault_code */ - subreq = dcerpc_binding_handle_call_send(dce_call, dce_call->event_ctx, + subreq = dcerpc_binding_handle_call_send(rcall, dce_call->event_ctx, priv->c_pipe->binding_handle, NULL, table, opnum, mem_ctx, r); @@ -296,7 +309,7 @@ static NTSTATUS remote_op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CT DEBUG(0,("dcesrv_remote: call[%s] dcerpc_binding_handle_call_send() failed!\n", name)); return NT_STATUS_NO_MEMORY; } - tevent_req_set_callback(subreq, remote_op_dispatch_done, dce_call); + tevent_req_set_callback(subreq, remote_op_dispatch_done, rcall); dce_call->state_flags |= DCESRV_CALL_STATE_FLAG_ASYNC; return NT_STATUS_OK; @@ -304,10 +317,11 @@ static NTSTATUS remote_op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_CT static void remote_op_dispatch_done(struct tevent_req *subreq) { - struct dcesrv_call_state *dce_call = tevent_req_callback_data(subreq, - struct dcesrv_call_state); - struct dcesrv_remote_private *priv = talloc_get_type_abort(dce_call->context->private_data, - struct dcesrv_remote_private); + struct dcesrv_remote_call *rcall = + tevent_req_callback_data(subreq, + struct dcesrv_remote_call); + struct dcesrv_call_state *dce_call = rcall->dce_call; + struct dcesrv_remote_private *priv = rcall->priv; uint16_t opnum = dce_call->pkt.u.request.opnum; const struct ndr_interface_table *table = dce_call->context->iface->private_data; const struct ndr_interface_call *call; |