diff options
author | Stefan Metzmacher <metze@samba.org> | 2011-03-13 14:58:12 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-03-13 16:53:05 +0100 |
commit | 6539eba880682b53eb867b27c40efb0fbee18b4a (patch) | |
tree | e26d158e5322ac6240d096044ba895a56a79af18 /librpc/rpc/binding_handle.c | |
parent | 08dca92499c5bd17402dda14521edb4256476639 (diff) | |
download | samba-6539eba880682b53eb867b27c40efb0fbee18b4a.tar.gz |
librpc/rpc: add dcerpc_binding_handle_raw_call()
metze
Diffstat (limited to 'librpc/rpc/binding_handle.c')
-rw-r--r-- | librpc/rpc/binding_handle.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/librpc/rpc/binding_handle.c b/librpc/rpc/binding_handle.c index 9ad7a9bde87..6c2d8a8b12b 100644 --- a/librpc/rpc/binding_handle.c +++ b/librpc/rpc/binding_handle.c @@ -186,6 +186,66 @@ NTSTATUS dcerpc_binding_handle_raw_call_recv(struct tevent_req *req, return NT_STATUS_OK; } +NTSTATUS dcerpc_binding_handle_raw_call(struct dcerpc_binding_handle *h, + const struct GUID *object, + uint32_t opnum, + uint32_t in_flags, + const uint8_t *in_data, + size_t in_length, + TALLOC_CTX *mem_ctx, + uint8_t **out_data, + size_t *out_length, + uint32_t *out_flags) +{ + TALLOC_CTX *frame = talloc_stackframe(); + struct tevent_context *ev; + struct tevent_req *subreq; + NTSTATUS status; + + /* + * TODO: allow only one sync call + */ + + if (h->sync_ev) { + ev = h->sync_ev; + } else { + ev = tevent_context_init(frame); + } + if (ev == NULL) { + talloc_free(frame); + return NT_STATUS_NO_MEMORY; + } + + subreq = dcerpc_binding_handle_raw_call_send(frame, ev, + h, object, opnum, + in_flags, + in_data, + in_length); + if (subreq == NULL) { + talloc_free(frame); + return NT_STATUS_NO_MEMORY; + } + + if (!tevent_req_poll(subreq, ev)) { + status = map_nt_error_from_unix(errno); + talloc_free(frame); + return status; + } + + status = dcerpc_binding_handle_raw_call_recv(subreq, + mem_ctx, + out_data, + out_length, + out_flags); + if (!NT_STATUS_IS_OK(status)) { + talloc_free(frame); + return status; + } + + TALLOC_FREE(frame); + return NT_STATUS_OK; +} + struct dcerpc_binding_handle_disconnect_state { const struct dcerpc_binding_handle_ops *ops; }; |