Ethereal-dev: [Ethereal-dev] [patch] Another packet-hclnfsd.c patch

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

From: Mike Frisch <mfrisch@xxxxxxxxxx>
Date: Mon, 1 Apr 2002 17:17:00 -0500
This one fixes the decoding of the AUTHORIZE call...  (incidentally, if
anybody is interested, I can provide a capture here that seems to show a
bug in Windows Gtk when displaying unprintable chars).

Mike.
Index: packet-hclnfsd.c
===================================================================
RCS file: /cvsroot/ethereal/packet-hclnfsd.c,v
retrieving revision 1.8
diff -r1.8 packet-hclnfsd.c
77a78,83
> static int hf_hclnfsd_auth_ident_obscure = -1;
> 
> #if 0
> static int hf_hclnfsd_authorize = -1;
> static int hf_hclnfsd_auth_ident_clear = -1;
> #endif
86c92
< 
---
> static gint ett_hclnfsd_auth_ident = -1;
151a158,171
> void
> hclnfsd_decode_obscure(char *ident, int ident_len)
> {
> 	int j, x, y;
> 
> 	for (x = -1, j = 0; j < ident_len; j++)
> 	{
> 		y = *ident;
> 		x ^= *ident;
> 		*ident++ = x;
> 		x = y;
> 	}
> }
> 
157a178,185
> 	char *ident = NULL;
> 	char *username = NULL;
> 	char *password = NULL;
> 	int ident_len = 0;
> 	int newoffset;
> 	char *p;
> 	proto_item *ident_item = NULL;
> 	proto_tree *ident_tree = NULL;
160c188,191
< 	ip=((ip&0x000000ff)<<24)|((ip&0x0000ff00)<<8)|((ip&0x00ff0000)>>8)|((ip&0xff000000)>>24);
---
> 	ip = ((ip & 0x000000ff) << 24) | 
> 		((ip & 0x0000ff00) << 8) | 
> 		((ip & 0x00ff0000) >> 8) | 
> 		((ip & 0xff000000) >> 24);
170c201,231
< 	offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_device, offset, NULL);
---
> 	offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_device, offset, 
> 		NULL);
> 
> 	if (tree)
> 	{
> 		ident_item = proto_tree_add_text(tree, tvb, offset, -1,
> 			"Authentication Ident");
> 
> 		if (ident_item)
> 		{
> 			ident_tree = proto_item_add_subtree(ident_item,
> 				ett_hclnfsd_auth_ident);
> 
> 			if (ident_tree)
> 			{
> 				newoffset = dissect_rpc_string(tvb, pinfo, ident_tree,
> 					hf_hclnfsd_auth_ident_obscure, offset, &ident);
> 
> 				proto_item_set_len(ident_item, newoffset - offset);
> 
> 				if (ident)
> 				{
> 					ident_len = newoffset - offset;
> 
> 					hclnfsd_decode_obscure(ident, ident_len);
> 
> 					username = ident + 2;
> 					password = username + strlen(username) + 1;
> 
> 					proto_tree_add_text(ident_tree, tvb, offset, ident_len,
> 						"Username: %s", username);
172c233,243
< 	offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_login, offset, NULL);
---
> 					proto_tree_add_text(ident_tree, tvb, offset, ident_len,
> 						"Password: %s", password);
> 
> 					offset = newoffset;
> 
> 					g_free(ident);
> 					ident = NULL;
> 				}
> 			}
> 		}
> 	}
232,254c303,304
< 	guint32 ngrpnames, ngrpnames_i;
< 	proto_tree *grptree = NULL;
< 	proto_item *grpitem = NULL;
< 
< 	ngrpnames = tvb_get_ntohl(tvb, offset);
< 	if (tree)
< 	{
< 		grpitem = proto_tree_add_text(tree, tvb, offset, 4, "Groups: %d",
< 			ngrpnames);
< 
< 		if (grpitem)
< 			grptree = proto_item_add_subtree(grpitem, ett_hclnfsd_groups);
< 	}
< 	offset += 4;
< 
< 	if (!grptree)
< 		return offset;
< 
< 	for (ngrpnames_i = 0; ngrpnames_i < ngrpnames ; ngrpnames_i++)
< 		offset = dissect_rpc_string(tvb, pinfo, grptree, 
< 			hf_hclnfsd_grpname, offset, NULL);
< 	
< 	return offset;
---
> 	return dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_grpname, offset, 
> 		NULL);
799a850,865
> 
> #if 0
> 		{ &hf_hclnfsd_authorize, {
> 			"Authentication Client", "hclnfsd.authorize.client", FT_STRING,
> 			BASE_DEC, NULL, 0, "Authentication Client", HFILL }},
> #endif
> 
> 		{ &hf_hclnfsd_auth_ident_obscure, {
> 			"Obscure Ident", "hclnfsd.authorize.ident.obscure", FT_STRING,
> 			BASE_DEC	, NULL, 0, "Authentication Obscure Ident", HFILL }},
> 
> #if 0
> 		{ &hf_hclnfsd_auth_ident_clear, {
> 			"Clear Ident", "hclnfsd.authorize.ident.clear", FT_STRING,
> 			BASE_DEC	, NULL, 0, "Authentication Clear Ident", HFILL }},
> #endif
808a875
> 		&ett_hclnfsd_auth_ident