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)
committerJeremy Allison <jra@samba.org>
Fri, 19 Feb 2010 22:26:22 +0000 (14:26 -0800)
If server returns zero on a NP read. Report pipe broken.
Prevents client from looping if it thinks there should be
more data.

Jeremy.

source3/rpc_client/rpc_transport_np.c

index 501aa50b030f75baf4a33b20c38903fe80a1a482..623a8b37cfa49f43f4aa1d100d95f1c3c88ef546 100644 (file)
@@ -180,6 +180,12 @@ static void rpc_np_read_done(struct tevent_req *subreq)
                return;
        }
 
+       if (state->received == 0) {
+               TALLOC_FREE(subreq);
+               tevent_req_nterror(req, NT_STATUS_PIPE_BROKEN);
+               return;
+       }
+
        memcpy(state->data, rcvbuf, state->received);
        TALLOC_FREE(subreq);
        tevent_req_done(req);