librpc/rpc: read the full header in dcerpc_read_ncacn_packet_next_vector()
authorStefan Metzmacher <metze@samba.org>
Wed, 11 Sep 2013 10:23:27 +0000 (12:23 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 17 Oct 2013 05:16:15 +0000 (07:16 +0200)
This helps wireshark reassamble the PDUs generated by socket_wrapper.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
librpc/rpc/dcerpc_util.c

index 980b0709dbaed2ceaa87f7823b85162d35aae9ed..80140b38c8b5a74905a7f3ae9d31a6966097a6a0 100644 (file)
@@ -209,15 +209,21 @@ static int dcerpc_read_ncacn_packet_next_vector(struct tstream_context *stream,
        off_t ofs = 0;
 
        if (state->buffer.length == 0) {
-               /* first get enough to read the fragment length */
+               /*
+                * first get enough to read the fragment length
+                *
+                * We read the full fixed ncacn_packet header
+                * in order to make wireshark happy with
+                * pcap files from socket_wrapper.
+                */
                ofs = 0;
-               state->buffer.length = DCERPC_FRAG_LEN_OFFSET + 2;
+               state->buffer.length = DCERPC_NCACN_PAYLOAD_OFFSET;
                state->buffer.data = talloc_array(state, uint8_t,
                                                  state->buffer.length);
                if (!state->buffer.data) {
                        return -1;
                }
-       } else if (state->buffer.length == (DCERPC_FRAG_LEN_OFFSET + 2)) {
+       } else if (state->buffer.length == DCERPC_NCACN_PAYLOAD_OFFSET) {
                /* now read the fragment length and allocate the full buffer */
                size_t frag_len = dcerpc_get_frag_length(&state->buffer);