From f3c9d124bb302ded239a835a6173fbfe262a0bab Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 17 Apr 2009 11:40:40 +0200 Subject: s4:librpc/rpc: only use smb_trans for sync rpc calls Over named pipes we can only do one smb_trans at a time, otherwise we're getting NT_STATUS_PIPE_BUSY. Async rpc calls need to use smb_read/write only. metze --- source4/librpc/rpc/dcerpc.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'source4/librpc/rpc') diff --git a/source4/librpc/rpc/dcerpc.c b/source4/librpc/rpc/dcerpc.c index 7a568d3c9e..15c34f5dca 100644 --- a/source4/librpc/rpc/dcerpc.c +++ b/source4/librpc/rpc/dcerpc.c @@ -1058,6 +1058,7 @@ static void dcerpc_ship_next_request(struct dcerpc_connection *c) while (remaining > 0 || first_packet) { uint32_t chunk = MIN(chunk_size, remaining); bool last_frag = false; + bool do_trans = false; first_packet = false; pkt.pfc_flags &= ~(DCERPC_PFC_FLAG_FIRST |DCERPC_PFC_FLAG_LAST); @@ -1080,14 +1081,27 @@ static void dcerpc_ship_next_request(struct dcerpc_connection *c) DLIST_REMOVE(p->conn->pending, req); return; } - - req->status = p->conn->transport.send_request(p->conn, &blob, last_frag); + + if (last_frag && !req->async_call) { + do_trans = true; + } + + req->status = p->conn->transport.send_request(p->conn, &blob, do_trans); if (!NT_STATUS_IS_OK(req->status)) { req->state = RPC_REQUEST_DONE; DLIST_REMOVE(p->conn->pending, req); return; } + if (last_frag && !do_trans) { + req->status = p->conn->transport.send_read(p->conn); + if (!NT_STATUS_IS_OK(req->status)) { + req->state = RPC_REQUEST_DONE; + DLIST_REMOVE(p->conn->pending, req); + return; + } + } + remaining -= chunk; } } -- cgit