diff options
author | Andreas Schneider <asn@samba.org> | 2011-08-03 23:44:21 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2011-08-09 11:55:18 +0200 |
commit | 68d79eb6efb32eb3bc416ffc3430f0e4b1eed691 (patch) | |
tree | 330ea91227a50a361707de80b5d7d3e81b4b899f /source3/rpc_server | |
parent | dd3a92795908e8e9e5456f985e17313b2a59a8cc (diff) | |
download | samba-68d79eb6efb32eb3bc416ffc3430f0e4b1eed691.tar.gz samba-68d79eb6efb32eb3bc416ffc3430f0e4b1eed691.tar.bz2 samba-68d79eb6efb32eb3bc416ffc3430f0e4b1eed691.zip |
s3-rpc_server: Fix sending of packets over named pipe proxy.
We need for named pipes we need to send each fragment on its own to be a
message.
Signed-off-by: Simo Sorce <idra@samba.org>
Autobuild-User: Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date: Tue Aug 9 11:55:18 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/rpc_server.c | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index c66d74771a..9134b958ab 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -446,6 +446,7 @@ static void named_pipe_packet_process(struct tevent_req *subreq) ssize_t data_used; char *data; uint32_t to_send; + size_t i; bool ok; status = dcerpc_read_ncacn_packet_recv(subreq, npc, &pkt, &recv_buffer); @@ -479,13 +480,6 @@ static void named_pipe_packet_process(struct tevent_req *subreq) to_send = out->frag.length - out->current_pdu_sent; if (to_send > 0) { - DEBUG(10, ("Current_pdu_len = %u, " - "current_pdu_sent = %u " - "Returning %u bytes\n", - (unsigned int)out->frag.length, - (unsigned int)out->current_pdu_sent, - (unsigned int)to_send)); - npc->iov = talloc_zero(npc, struct iovec); if (!npc->iov) { status = NT_STATUS_NO_MEMORY; @@ -522,11 +516,6 @@ static void named_pipe_packet_process(struct tevent_req *subreq) npc->iov[npc->count].iov_base = out->frag.data; npc->iov[npc->count].iov_len = out->frag.length; - DEBUG(10, ("PDU number: %d, PDU Length: %u\n", - (unsigned int)npc->count, - (unsigned int)npc->iov[npc->count].iov_len)); - dump_data(11, (const uint8_t *)npc->iov[npc->count].iov_base, - npc->iov[npc->count].iov_len); npc->count++; } @@ -544,19 +533,31 @@ static void named_pipe_packet_process(struct tevent_req *subreq) return; } - DEBUG(10, ("Sending a total of %u bytes\n", + DEBUG(10, ("Sending %u fragments in a total of %u bytes\n", + (unsigned int)npc->count, (unsigned int)npc->p->out_data.data_sent_length)); - subreq = tstream_writev_queue_send(npc, npc->ev, - npc->tstream, - npc->write_queue, - npc->iov, npc->count); - if (!subreq) { - DEBUG(2, ("Failed to send packet\n")); - status = NT_STATUS_NO_MEMORY; - goto fail; + for (i = 0; i < npc->count; i++) { + DEBUG(10, ("Sending PDU number: %d, PDU Length: %u\n", + (unsigned int)i, + (unsigned int)npc->iov[i].iov_len)); + dump_data(11, (const uint8_t *)npc->iov[i].iov_base, + npc->iov[i].iov_len); + + subreq = tstream_writev_queue_send(npc, + npc->ev, + npc->tstream, + npc->write_queue, + (npc->iov + i), + 1); + if (!subreq) { + DEBUG(2, ("Failed to send packet\n")); + status = NT_STATUS_NO_MEMORY; + goto fail; + } + tevent_req_set_callback(subreq, named_pipe_packet_done, npc); } - tevent_req_set_callback(subreq, named_pipe_packet_done, npc); + return; fail: @@ -582,6 +583,10 @@ static void named_pipe_packet_done(struct tevent_req *subreq) goto fail; } + if (tevent_queue_length(npc->write_queue) > 0) { + return; + } + /* clear out any data that may have been left around */ npc->count = 0; TALLOC_FREE(npc->iov); |