Ethereal-dev: [Ethereal-dev] Patch for packet-tds.c (re-send)

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

From: Yaniv Kaul <ykaul@xxxxxxxxxxxx>
Date: Thu, 05 Feb 2004 21:48:43 +0200
Thanks to Guy Harris, for helping me improve a bit the patch.
I'm afraid it's just a little better, as I still don't dissect the row data responses (0xd1 tokens), which probably require remembering the request...
Attached diff against today's CVS packet-tds.c

--- packet-tds.c	2004-02-01 23:33:12.000000000 +0200
+++ ../packet-tds.c	2004-02-05 21:37:20.000000000 +0200
@@ -3,7 +3,7 @@
  * Copyright 2000-2002, Brian Bruns <camber@xxxxxxx>
  * Copyright 2002, Steve Langasek <vorlon@xxxxxxxxxxxxxx>
  *
- * $Id: packet-tds.c,v 1.24 2004/02/01 21:33:12 guy Exp $
+ * $Id: packet-tds.c,v 1.23 2004/01/05 01:18:53 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@xxxxxxxxxxxx>
@@ -466,7 +466,7 @@
 }
 
 static void
-dissect_tds_query_packet(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
+dissect_tds_query_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
 {
 	guint offset, len;
 	gboolean is_unicode = TRUE;
@@ -1019,17 +1019,18 @@
 int 
 dissect_tds7_results_token(tvbuff_t *tvb, guint offset, guint token_sz, proto_tree *tree)
 {
-	guint16 num_columns;
+	guint16 num_columns, table_len;
 	guint8 type, msg_len;
 	int i;
 	char *msg;
 	guint16 collate_codepage, collate_flags;
 	guint8 collate_charset_id;
-
+	
 	num_columns = tvb_get_letohs(tvb, offset);
 	proto_tree_add_text(tree, tvb, offset, 2, "Columns: %u", tvb_get_letohs(tvb, offset));
 	offset +=2;
 	for(i=0; i != num_columns; i++) {
+		proto_tree_add_text(tree, tvb, offset, 0, "Column %d", i + 1);
 		proto_tree_add_text(tree, tvb, offset, 2, "usertype: %d", tvb_get_letohs(tvb, offset));
 		offset +=2;
 		proto_tree_add_text(tree, tvb, offset, 2, "flags: %d", tvb_get_letohs(tvb, offset));
@@ -1037,6 +1038,31 @@
 		type  = tvb_get_guint8(tvb, offset);
 		proto_tree_add_text(tree, tvb, offset, 1, "Type: %d", type);
 		offset +=1;
+		if(type == 38 || type == 104) { /* ugly, ugly hack. Wish I knew what it really means!*/
+			proto_tree_add_text(tree, tvb, offset, 1, "unknown 1 byte (%x)", tvb_get_guint8(tvb, offset));
+			offset +=1;
+		}
+		else if (type == 35) {
+			proto_tree_add_text(tree, tvb, offset, 4, "unknown 4 bytes (%x)", tvb_get_letohl(tvb, offset));
+			offset += 4;
+			collate_codepage = tvb_get_letohs(tvb, offset);
+			proto_tree_add_text(tree, tvb, offset, 2, "Codepage: %u" , collate_codepage);
+			offset += 2;
+			collate_flags = tvb_get_letohs(tvb, offset);
+			proto_tree_add_text(tree, tvb, offset, 2, "Flags: 0x%x", collate_flags);
+			offset += 2;
+			collate_charset_id = tvb_get_guint8(tvb, offset);
+			proto_tree_add_text(tree, tvb, offset, 1, "Charset ID: %u", collate_charset_id);
+			offset +=1;
+			table_len = tvb_get_letohs(tvb, offset);
+			offset +=2;
+			if(table_len != 0) {
+				msg = tvb_fake_unicode(tvb, offset, table_len, TRUE);
+				proto_tree_add_text(tree, tvb, offset, table_len*2, "Table name: %s", msg);
+ 				g_free(msg);
+				offset += table_len*2;
+			}
+		}
 		if(type > 128) {
 			proto_tree_add_text(tree, tvb, offset, 2, "Large type size: 0x%x", tvb_get_letohs(tvb, offset));
 			offset += 2;
@@ -1055,7 +1081,7 @@
 		offset += 1;
 		if(msg_len != 0) {
 			msg = tvb_fake_unicode(tvb, offset, msg_len, TRUE);
-			proto_tree_add_text(tree, tvb, offset, msg_len*2, "Text: %s", format_text(msg, strlen(msg)));
+			proto_tree_add_text(tree, tvb, offset, msg_len*2, "Text: %s", msg);
 			g_free(msg);
 			offset += msg_len*2;
 		}