Ethereal-dev: [Ethereal-dev] [packet-dcerpc-wkssvc.c] Information 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 16:27:52 +0200
Hello,

the attached patch enhances the dissection of the NetrWkstaGetInfo and
NetWkstaEnumUsers operations, by displaying in the COL_INFO column the
requested information level.

Jean-Baptiste Marchand
-- 
Jean-Baptiste.Marchand@xxxxxx
HSC - http://www.hsc.fr/
Index: packet-dcerpc-wkssvc.c
===================================================================
RCS file: /cvsroot/ethereal/packet-dcerpc-wkssvc.c,v
retrieving revision 1.32
diff -u -r1.32 packet-dcerpc-wkssvc.c
--- packet-dcerpc-wkssvc.c	12 Jun 2004 04:12:07 -0000	1.32
+++ packet-dcerpc-wkssvc.c	27 Jun 2004 14:23:50 -0000
@@ -468,12 +468,37 @@
 				    packet_info *pinfo, proto_tree *tree,
 				    guint8 *drep)
 {
+	dcerpc_info *di;
+	guint32 level;
+
+	di = pinfo->private_data;
+
         offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep,
 					      NDR_POINTER_UNIQUE, "Server", 
 					      hf_wkssvc_server, 0);
 
 	offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
-				    hf_wkssvc_info_level, 0);
+				    hf_wkssvc_info_level, &level);
+
+	if (!check_col(pinfo->cinfo, COL_INFO))
+		return offset;
+
+	switch (level) {
+		case 100:
+			col_append_str(pinfo->cinfo, COL_INFO, ", WKS_INFO_100 level");
+			break;
+		case 101:
+			col_append_str(pinfo->cinfo, COL_INFO, ", WKS_INFO_101 level");
+			break;
+		case 102:
+			col_append_str(pinfo->cinfo, COL_INFO, ", WKS_INFO_102 level");
+			break;
+		case 502:
+			col_append_str(pinfo->cinfo, COL_INFO, ", WKS_INFO_502 level");
+			break;
+		default:
+			col_append_str(pinfo->cinfo, COL_INFO, ", WKS_INFO_xxx level");
+	}	
 
 	return offset;
 
@@ -786,6 +811,9 @@
 				     guint8 *drep)
 {
 	guint32 level;
+	dcerpc_info *di;
+
+	di = pinfo->private_data;
 
 	ALIGN_TO_4_BYTES;
 
@@ -796,11 +824,15 @@
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			wkssvc_dissect_USER_INFO_0_CONTAINER,
 			NDR_POINTER_UNIQUE, "USER_INFO_0_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", USER_INFO_0 level");
 		break;
 	case 1:
 		offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
 			wkssvc_dissect_USER_INFO_1_CONTAINER,
 			NDR_POINTER_UNIQUE, "USER_INFO_1_CONTAINER:", -1);
+		if (check_col(pinfo->cinfo, COL_INFO) && di->ptype == PDU_REQ)
+			col_append_str(pinfo->cinfo, COL_INFO, ", USER_INFO_1 level");
 		break;
 	}