Ethereal-dev: [Ethereal-dev] SMB: New info level

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Ian Schorr <spamcontrol2@xxxxxxxxxxx>
Date: Mon, 19 Jan 2004 20:48:33 -0500
Attached is a diff against latest CVS packet-smb.c, adding a new infolevel for Query_Path_Info & Query_File_Info.

Ian
--- packet-smb.c	2004-01-19 20:43:53.571283200 -0500
+++ packet-smb.c.new	2004-01-19 19:25:41.975099200 -0500
@@ -229,6 +229,7 @@
 static int hf_smb_file_attr_not_content_indexed = -1;
 static int hf_smb_file_attr_encrypted = -1;
 static int hf_smb_file_size = -1;
+static int hf_smb_file_size64 = -1;
 static int hf_smb_search_attribute_read_only = -1;
 static int hf_smb_search_attribute_hidden = -1;
 static int hf_smb_search_attribute_system = -1;
@@ -11416,6 +11417,59 @@
 	return offset;
 }
 
+static int
+dissect_network_open_info(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree,
+    int offset, guint16 *bcp, gboolean *trunc)
+{
+	/* create time */
+	CHECK_BYTE_COUNT_SUBR(8);
+	offset = dissect_smb_64bit_time(tvb, tree, offset, hf_smb_create_time);
+	*bcp -= 8;
+
+	/* access time */
+	CHECK_BYTE_COUNT_SUBR(8);
+	offset = dissect_smb_64bit_time(tvb, tree, offset, hf_smb_access_time);
+	*bcp -= 8;
+
+	/* last write time */
+	CHECK_BYTE_COUNT_SUBR(8);
+	offset = dissect_smb_64bit_time(tvb, tree, offset,
+		hf_smb_last_write_time);
+	*bcp -= 8;
+
+	/* last change time */
+	CHECK_BYTE_COUNT_SUBR(8);
+	offset = dissect_smb_64bit_time(tvb, tree, offset, hf_smb_change_time);
+	*bcp -= 8;
+
+	/* allocation size */
+	CHECK_BYTE_COUNT_SUBR(8);
+	proto_tree_add_item(tree, hf_smb_alloc_size64, tvb, offset, 8, TRUE);
+	offset += 8;
+	*bcp -= 8;
+
+	/* file size */
+	CHECK_BYTE_COUNT_SUBR(8);
+	proto_tree_add_item(tree, hf_smb_file_size64, tvb, offset, 8, TRUE);
+	offset += 8;
+	*bcp -= 8;
+
+	/* File Attributes */
+	CHECK_BYTE_COUNT_SUBR(4);
+	offset = dissect_file_attributes(tvb, tree, offset, 4);
+	*bcp -= 4;
+
+	/* unknown 4 bytes */
+	CHECK_BYTE_COUNT_SUBR(4);
+	proto_tree_add_item(tree, hf_smb_unknown, tvb,
+		    offset, 4, TRUE);
+	offset += 4;
+	*bcp -= 4;
+
+	*trunc = FALSE;
+	return offset;
+}
+
 /*dissect the data block for TRANS2_QUERY_PATH_INFORMATION and
   TRANS2_QUERY_FILE_INFORMATION*/
 static int
@@ -11498,6 +11552,10 @@
 	case 0x0202:	/* Query File Unix HardLink*/
 		/* XXX add this from the SNIA doc */
 		break;
+	case 1034:	/* SMB_FILE_NETWORK_OPEN_INFORMATION */
+		offset = dissect_network_open_info(tvb, pinfo, tree, offset, bcp,
+		    &trunc);
+		break;
 	}
 
 	return offset;
@@ -11574,6 +11632,10 @@
 	case 1040:
 		/* XXX: TODO, extra levels discovered by tridge */
 		break;
+	case 1034:	/* SMB_FILE_NETWORK_OPEN_INFORMATION */
+		offset = dissect_network_open_info(tvb, pinfo, tree, offset, bcp,
+		    &trunc);
+		break;
 	}
 
 	return offset;
@@ -18908,6 +18970,10 @@
 		{ "Defragmentation error", "smb.segment.error", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
 			"Defragmentation error due to illegal fragments", HFILL }},
 
+	{ &hf_smb_file_size64,
+		{ "File Size", "smb.file_size64", FT_UINT64, BASE_DEC,
+		NULL, 0, "Size of file in number of bytes", HFILL }},
+
 	{ &hf_smb_segment,
 		{ "SMB Segment", "smb.segment", FT_FRAMENUM, BASE_NONE, NULL, 0x0,
 			"SMB Segment", HFILL }},