diff options
-rw-r--r-- | source3/include/proto.h | 1 | ||||
-rw-r--r-- | source3/rpc_server/srv_pipe_hnd.c | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 92c757b1ef..116db698e6 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -5209,6 +5209,7 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name, const char *client_address, struct auth_serversupplied_info *server_info, struct fake_file_handle **phandle); +bool np_read_in_progress(struct fake_file_handle *handle); struct tevent_req *np_write_send(TALLOC_CTX *mem_ctx, struct event_context *ev, struct fake_file_handle *handle, const uint8_t *data, size_t len); diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 7b8602b0d6..b5b8379efa 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -1179,6 +1179,28 @@ NTSTATUS np_open(TALLOC_CTX *mem_ctx, const char *name, return NT_STATUS_OK; } +bool np_read_in_progress(struct fake_file_handle *handle) +{ + if (handle->type == FAKE_FILE_TYPE_NAMED_PIPE) { + return false; + } + + if (handle->type == FAKE_FILE_TYPE_NAMED_PIPE_PROXY) { + struct np_proxy_state *p = talloc_get_type_abort( + handle->private_data, struct np_proxy_state); + size_t read_count; + + read_count = tevent_queue_length(p->read_queue); + if (read_count > 0) { + return true; + } + + return false; + } + + return false; +} + struct np_write_state { struct event_context *ev; struct np_proxy_state *p; |