packet-smb2: make smb2_set_dcerpc_file_id() more reliable
authorStefan Metzmacher <metze@samba.org>
Fri, 6 Nov 2015 14:12:51 +0000 (15:12 +0100)
committerAnders Broman <a.broman58@gmail.com>
Sat, 7 Nov 2015 07:45:05 +0000 (07:45 +0000)
In response PDUs we may only get a smb2_fid_info_t
via si->saved->file instead of si->file.

Change-Id: I1e1ecdabec6267f4e4ee9246d020fe6e51a13c1d
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-on: https://code.wireshark.org/review/11598
Reviewed-by: Michael Mann <mmann78@netscape.net>
Petri-Dish: Michael Mann <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
epan/dissectors/packet-smb2.c

index 610d560cadb9c17cb1f634111b9c3f0f52a97591..0046e67bec1bec70a28b1de6c91214ae0aba4aae 100644 (file)
@@ -4503,15 +4503,21 @@ static void
 smb2_set_dcerpc_file_id(packet_info *pinfo, smb2_info_t *si)
 {
        guint64 persistent;
+       smb2_fid_info_t *file = NULL;
 
        if (si == NULL) {
                return;
        }
-       if (si->file == NULL) {
+       if (si->file != NULL) {
+               file = si->file;
+       } else if (si->saved != NULL) {
+               file = si->saved->file;
+       }
+       if (file == NULL) {
                return;
        }
 
-       persistent = GPOINTER_TO_UINT(si->file);
+       persistent = GPOINTER_TO_UINT(file);
 
        dcerpc_set_transport_salt(persistent, pinfo);
 }
@@ -7850,6 +7856,11 @@ dissect_smb2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, gboolea
                                        PROTO_ITEM_SET_GENERATED(tmp_item);
                                }
                        }
+                       if (si->file != NULL) {
+                               ssi->file = si->file;
+                       } else {
+                               si->file = ssi->file;
+                       }
                }
                /* if we don't have ssi yet we must fake it */
                /*qqq*/