Ethereal-dev: [Ethereal-dev] [packet-dcerpc-srvsvc.c] Displaying info levels in COL_INFO

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

From: Jean-Baptiste Marchand <Jean-Baptiste.Marchand@xxxxxx>
Date: Sun, 27 Jun 2004 14:28:12 +0200
Hello,

the attached patch adds col_append_str() calls in functions dissecting
*Enum srvsvc operations, to display the requested information levels in
the COL_INFO column.

It also fixes the slighlty wrong dissection of the NetrShareEnumSticky
operation.

Jean-Baptiste Marchand
-- 
Jean-Baptiste.Marchand@xxxxxx
HSC - http://www.hsc.fr/
Index: packet-dcerpc-srvsvc.c
===================================================================
RCS file: /cvsroot/ethereal/packet-dcerpc-srvsvc.c,v
retrieving revision 1.64
diff -u -r1.64 packet-dcerpc-srvsvc.c
--- packet-dcerpc-srvsvc.c	19 Jan 2004 20:10:35 -0000	1.64
+++ packet-dcerpc-srvsvc.c	27 Jun 2004 12:20:18 -0000
@@ -402,6 +402,9 @@
 				     guint8 *drep)
 {
 	guint32 level;
+	dcerpc_info *di;
+
+	di = pinfo->private_data;
 
 	ALIGN_TO_4_BYTES;
 
@@ -412,11 +415,15 @@
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_CHARDEV_INFO_0_CONTAINER,
 			NDR_POINTER_UNIQUE, "CHARDEV_INFO_0_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", CHARDEV_INFO_0 level");
 		break;
 	case 1:
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_CHARDEV_INFO_1_CONTAINER,
 			NDR_POINTER_UNIQUE, "CHARDEV_INFO_1_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", CHARDEV_INFO_1 level");
 		break;
 	}
 
@@ -1145,6 +1152,9 @@
 				     guint8 *drep)
 {
 	guint32 level;
+	dcerpc_info *di;
+
+	di = pinfo->private_data;
 
 	ALIGN_TO_4_BYTES;
 
@@ -1155,11 +1165,15 @@
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_CONNECT_INFO_0_CONTAINER,
 			NDR_POINTER_UNIQUE, "CONNECT_INFO_0_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", CONNECT_INFO_0 level");
 		break;
 	case 1:
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_CONNECT_INFO_1_CONTAINER,
 			NDR_POINTER_UNIQUE, "CONNECT_INFO_1_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", CONNECT_INFO_1 level");
 		break;
 	}
 
@@ -1367,6 +1381,9 @@
 				     guint8 *drep)
 {
 	guint32 level;
+	dcerpc_info *di;
+
+	di = pinfo->private_data;
 
 	ALIGN_TO_4_BYTES;
 
@@ -1377,11 +1394,15 @@
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_FILE_INFO_2_CONTAINER,
 			NDR_POINTER_UNIQUE, "FILE_INFO_2_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", FILE_INFO_2 level");
 		break;
 	case 3:
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_FILE_INFO_3_CONTAINER,
 			NDR_POINTER_UNIQUE, "FILE_INFO_3_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", FILE_INFO_3 level");
 		break;
 	}
 
@@ -1909,6 +1930,9 @@
 				     guint8 *drep)
 {
 	guint32 level;
+	dcerpc_info *di;
+
+	di = pinfo->private_data;
 
 	ALIGN_TO_4_BYTES;
 
@@ -1919,26 +1943,37 @@
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_SESSION_INFO_0_CONTAINER,
 			NDR_POINTER_UNIQUE, "SESSION_INFO_0_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", SESSION_INFO_0 level");
 		break;
 	case 1:
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_SESSION_INFO_1_CONTAINER,
 			NDR_POINTER_UNIQUE, "SESSION_INFO_1_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", SESSION_INFO_1 level");
 		break;
 	case 2:
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_SESSION_INFO_2_CONTAINER,
 			NDR_POINTER_UNIQUE, "SESSION_INFO_2_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", SESSION_INFO_2 level");
 		break;
 	case 10:
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_SESSION_INFO_10_CONTAINER,
 			NDR_POINTER_UNIQUE, "SESSION_INFO_10_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", SESSION_INFO_10 level");
 		break;
 	case 502:
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_SESSION_INFO_502_CONTAINER,
 			NDR_POINTER_UNIQUE, "SESSION_INFO_502_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, 
+					", SESSION_INFO_502 level");
 		break;
 	}
 
@@ -2813,6 +2848,9 @@
 				     guint8 *drep)
 {
 	guint32 level;
+	dcerpc_info *di;
+
+	di = pinfo->private_data;
 
 	ALIGN_TO_4_BYTES;
 
@@ -2823,26 +2861,36 @@
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_SHARE_INFO_0_CONTAINER,
 			NDR_POINTER_UNIQUE, "SHARE_INFO_0_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", SHARE_INFO_0 level");
 		break;
 	case 1:
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_SHARE_INFO_1_CONTAINER,
 			NDR_POINTER_UNIQUE, "SHARE_INFO_1_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", SHARE_INFO_1 level");
 		break;
 	case 2:
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_SHARE_INFO_2_CONTAINER,
 			NDR_POINTER_UNIQUE, "SHARE_INFO_2_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", SHARE_INFO_2 level");
 		break;
 	case 501:
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_SHARE_INFO_501_CONTAINER,
 			NDR_POINTER_UNIQUE, "SHARE_INFO_501_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", SHARE_INFO_501 level");
 		break;
 	case 502:
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_SHARE_INFO_502_CONTAINER,
 			NDR_POINTER_UNIQUE, "SHARE_INFO_502_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", SHARE_INFO_502 level");
 		break;
 #if 0
 	case 1004:
@@ -5798,6 +5846,9 @@
 				     guint8 *drep)
 {
 	guint32 level;
+	dcerpc_info *di;
+
+	di = pinfo->private_data;
 
 	ALIGN_TO_4_BYTES;
 
@@ -5809,12 +5860,16 @@
 			srvsvc_dissect_SERVER_XPORT_INFO_0_CONTAINER,
 			NDR_POINTER_UNIQUE, "SERVER_XPORT_INFO_0_CONTAINER:",
 			-1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", TRANSPORT_INFO_0 level");
 		break;
 	case 1:
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_SERVER_XPORT_INFO_1_CONTAINER,
 			NDR_POINTER_UNIQUE, "SERVER_XPORT_INFO_1_CONTAINER:",
 			-1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", TRANSPORT_INFO_1 level");
 		break;
 	}
 
@@ -6386,6 +6441,7 @@
 /*
  * IDL long NetrShareEnumSticky(
  * IDL      [in] [string] [unique] wchar_t *ServerName,
+ * IDL	    [in] [out] level
  * IDL      [in] [out] [ref] SHARE_ENUM_STRUCT *share,
  * IDL      [in] long MaxLen,
  * IDL      [out] long Entries,
@@ -6400,6 +6456,9 @@
         offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
 			NDR_POINTER_UNIQUE, "Server", hf_srvsvc_server, 0);
 
+	offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
+			hf_srvsvc_info_level, 0);
+
 	offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_SHARE_ENUM_STRUCT,
 			NDR_POINTER_REF, "Shares", -1);
@@ -6418,6 +6477,10 @@
 				     packet_info *pinfo, proto_tree *tree,
 				     guint8 *drep)
 {
+
+	offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
+			hf_srvsvc_info_level, 0);
+
 	offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			srvsvc_dissect_SHARE_ENUM_STRUCT,
 			NDR_POINTER_REF, "Shares", -1);