Second part of fix for bug #7159 - client rpc_transport doesn't cope with bad server...
authorJeremy Allison <jra@samba.org>
Fri, 19 Feb 2010 22:24:17 +0000 (14:24 -0800)
committerStefan Metzmacher <metze@samba.org>
Wed, 7 Apr 2010 09:04:15 +0000 (11:04 +0200)
If server returns zero on a NP read. Report pipe broken.
Prevents client from looping if it thinks there should be
more data.

Jeremy.
(cherry picked from commit 0055e33dbed0e81548464d01bcf864255bab3159)
(cherry picked from commit f5ca9f84e9b511c2ba7a4280b1997daa441f9877)

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/rpc_client/rpc_transport_np.c

index fdfbab4ceac0f2cb01ca7dd5c9065b887994fd56..4ea361bc2a8508b1dbc5ba9f1ee17b6c7b234d02 100644 (file)
@@ -182,6 +182,12 @@ static void rpc_np_read_done(struct async_req *subreq)
                return;
        }
 
+       if (state->received == 0) {
+               TALLOC_FREE(subreq);
+               async_req_nterror(req, NT_STATUS_PIPE_BROKEN);
+               return;
+       }
+
        memcpy(state->data, rcvbuf, state->received);
        TALLOC_FREE(subreq);
        async_req_done(req);