WIP: fsctl_pipe_wait
authorGregor Beck <gbeck@sernet.de>
Mon, 17 Sep 2012 09:50:45 +0000 (11:50 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 29 Jan 2014 08:18:24 +0000 (09:18 +0100)
epan/dissectors/packet-smb2.c

index b70086ed0fbb1dc1790e5cf1900bf2187b07c6b3..07de671633d9187efb0c1f1af60c99a4d8e96a9b 100644 (file)
@@ -196,6 +196,8 @@ static int hf_smb2_ioctl_function = -1;
 static int hf_smb2_ioctl_function_device = -1;
 static int hf_smb2_ioctl_function_access = -1;
 static int hf_smb2_ioctl_function_function = -1;
+static int hf_smb2_fsctl_pipe_wait_timeout = -1;
+static int hf_smb2_fsctl_pipe_wait_name = -1;
 static int hf_smb2_ioctl_function_method = -1;
 static int hf_smb2_ioctl_resiliency_timeout = -1;
 static int hf_smb2_ioctl_resiliency_reserved = -1;
@@ -4262,9 +4264,33 @@ dissect_smb2_FSCTL_PIPE_TRANSCEIVE(tvbuff_t *tvb, packet_info *pinfo, proto_tree
 }
 
 static void
-dissect_smb2_FSCTL_PIPE_WAIT(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, proto_tree *top_tree, gboolean data_in _U_)
+dissect_smb2_FSCTL_PIPE_WAIT(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree _U_, int offset, proto_tree *top_tree, gboolean data_in _U_)
 {
-       dissect_file_data_dcerpc(tvb, pinfo, tree, offset, tvb_length_remaining(tvb, offset), top_tree);
+       guint8 timeout_specified = tvb_get_guint8(tvb, offset + 12);
+       guint32 name_len = tvb_get_letohs(tvb, offset + 8);
+       const gchar *name;
+       int off = offset + 14;
+       guint16 bc = tvb_length_remaining(tvb, off);
+       int len = name_len;
+
+       /* sanity check */
+       tvb_ensure_bytes_exist(tvb, off, name_len);
+
+       name = get_unicode_or_ascii_string(tvb, &off, TRUE, &len, TRUE, TRUE, &bc);
+       if (name == NULL) {
+               name = "";
+       }
+
+       if (check_col(pinfo->cinfo, COL_INFO)) {
+               col_append_fstr(pinfo->cinfo, COL_INFO, " Pipe: %s", name);
+       }
+
+       if (top_tree) {
+               proto_tree_add_string(top_tree, hf_smb2_fsctl_pipe_wait_name, tvb, offset + 14, name_len, name);
+               if (timeout_specified) {
+                       proto_tree_add_item(top_tree, hf_smb2_fsctl_pipe_wait_timeout, tvb, 0, 8, ENC_LITTLE_ENDIAN);
+               }
+       }
 }
 
 static void
@@ -7795,6 +7821,14 @@ proto_register_smb2(void)
                  { "Method", "smb2.ioctl.function.method", FT_UINT32, BASE_HEX,
                    VALS(smb2_ioctl_method_vals), 0x00000003, "Method for Ioctl", HFILL }},
 
+               { &hf_smb2_fsctl_pipe_wait_timeout,
+                 { "Timeout", "smb2.fsctl.wait.timeout", FT_INT64, BASE_DEC,
+                   NULL, 0, "Wait timeout", HFILL }},
+
+               { &hf_smb2_fsctl_pipe_wait_name,
+                 { "Name", "smb2.fsctl.wait.name", FT_STRING, BASE_NONE,
+                   NULL, 0, "Pipe name", HFILL }},
+
                { &hf_smb2_ioctl_resiliency_timeout,
                  { "Timeout", "smb2.ioctl.resiliency.timeout", FT_UINT32, BASE_DEC,
                    NULL, 0, "Resiliency timeout", HFILL }},