aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-smb2.c
diff options
context:
space:
mode:
authorlinzhao115 <zlbinghamton@gmail.com>2017-06-07 19:52:53 -0700
committerAnders Broman <a.broman58@gmail.com>2017-06-08 07:00:36 +0000
commit411a5342c5d9f12651ed7c8d268597bdc3db9f4a (patch)
tree955772b37b027f29d835c8cd9801898f01ea75e5 /epan/dissectors/packet-smb2.c
parent492da630829defe5ff161e38f3ef9f7b14d75c53 (diff)
export-smb2-objects: Make sure tap be called for named pipe
smb2_eo_tap is not called when smb2 packets are dissected as named pipe then exit. Basically, for the following code snippet, if (length) { int old_offset = offset; ... offset = dissect_file_data_smb2_pipe(...); if (offset != oldoffset) { /* managed to dissect pipe data */ return offset; ... dissect_file_data_smb2_pipe() always returns a different offset, thus it will never hit the smb2_eo_tap related code below that are needed for exporting smb2 objects. As a quick fix, call the tap related code before returning. Bug: 13214 Change-Id: I7a99177947c384f53424b209f7e5c1f9963b5da8 Reviewed-on: https://code.wireshark.org/review/22031 Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'epan/dissectors/packet-smb2.c')
-rw-r--r--epan/dissectors/packet-smb2.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c
index 2ff982f37f..1564697951 100644
--- a/epan/dissectors/packet-smb2.c
+++ b/epan/dissectors/packet-smb2.c
@@ -5350,6 +5350,8 @@ dissect_smb2_write_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
break;
}
+ data_tvb_len=(guint32)tvb_captured_length_remaining(tvb, offset);
+
/* data or namedpipe ?*/
if (length) {
int oldoffset = offset;
@@ -5357,19 +5359,18 @@ dissect_smb2_write_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset = dissect_file_data_smb2_pipe(tvb, pinfo, tree, offset, length, si->top_tree, si);
if (offset != oldoffset) {
/* managed to dissect pipe data */
- return offset;
+ goto out;
}
}
/* just ordinary data */
proto_tree_add_item(tree, hf_smb2_write_data, tvb, offset, length, ENC_NA);
- data_tvb_len=(guint32)tvb_captured_length_remaining(tvb, offset);
-
offset += MIN(length,(guint32)tvb_captured_length_remaining(tvb, offset));
offset = dissect_smb2_olb_tvb_max_offset(offset, &c_olb);
+out:
if (have_tap_listener(smb2_eo_tap) && (data_tvb_len == length)) {
if (si->saved && si->eo_file_info) { /* without this data we don't know wich file this belongs to */
feed_eo_smb2(tvb,pinfo,si,dataoffset,length,off);
@@ -6767,6 +6768,8 @@ dissect_smb2_read_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
proto_tree_add_item(tree, hf_smb2_reserved, tvb, offset, 4, ENC_NA);
offset += 4;
+ data_tvb_len=(guint32)tvb_captured_length_remaining(tvb, offset);
+
/* data or namedpipe ?*/
if (length) {
int oldoffset = offset;
@@ -6774,17 +6777,16 @@ dissect_smb2_read_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
offset = dissect_file_data_smb2_pipe(tvb, pinfo, tree, offset, length, si->top_tree, si);
if (offset != oldoffset) {
/* managed to dissect pipe data */
- return offset;
+ goto out;
}
}
/* data */
proto_tree_add_item(tree, hf_smb2_read_data, tvb, offset, length, ENC_NA);
- data_tvb_len=(guint32)tvb_captured_length_remaining(tvb, offset);
-
offset += MIN(length,data_tvb_len);
+out:
if (have_tap_listener(smb2_eo_tap) && (data_tvb_len == length)) {
if (si->saved && si->eo_file_info) { /* without this data we don't know wich file this belongs to */
feed_eo_smb2(tvb,pinfo,si,dataoffset,length,si->saved->file_offset);