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 | |
parent | 08dca92499c5bd17402dda14521edb4256476639 (diff) | |
download | samba-6539eba880682b53eb867b27c40efb0fbee18b4a.tar.gz samba-6539eba880682b53eb867b27c40efb0fbee18b4a.tar.bz2 samba-6539eba880682b53eb867b27c40efb0fbee18b4a.zip |
librpc/rpc: add dcerpc_binding_handle_raw_call()
metze
-rw-r--r-- | librpc/rpc/binding_handle.c | 60 | ||||
-rw-r--r-- | librpc/rpc/rpc_common.h | 10 |
2 files changed, 70 insertions, 0 deletions
diff --git a/librpc/rpc/binding_handle.c b/librpc/rpc/binding_handle.c index 9ad7a9bde8..6c2d8a8b12 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; }; diff --git a/librpc/rpc/rpc_common.h b/librpc/rpc/rpc_common.h index f940c3f234..bd9c46dab4 100644 --- a/librpc/rpc/rpc_common.h +++ b/librpc/rpc/rpc_common.h @@ -195,6 +195,16 @@ NTSTATUS dcerpc_binding_handle_raw_call_recv(struct tevent_req *req, uint8_t **out_data, size_t *out_length, uint32_t *out_flags); +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); struct tevent_req *dcerpc_binding_handle_disconnect_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, |