Ethereal-dev: [Ethereal-dev] Re: [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:29:54 -0500
On Mon, Apr 01, 2002 at 02:22:44PM -0800, Guy Harris wrote: > On Mon, Apr 01, 2002 at 05:17:00PM -0500, Mike Frisch wrote: > > This one fixes the decoding of the AUTHORIZE call... > > Unfortunately, I get a "patch: **** misordered hunks! output would be > garbled" error when I try to apply it, at least with > > cranford$ patch -v > Patch version 2.0, patch level 12u8 > > Try doing a "diff -c" or a "diff -u" rather than just a "diff". Oops, my cygwin environment appears to be messed up... this one is created on Linux. Mike.
Index: packet-hclnfsd.c
===================================================================
RCS file: /cvsroot/ethereal/packet-hclnfsd.c,v
retrieving revision 1.8
diff -u -r1.8 packet-hclnfsd.c
--- packet-hclnfsd.c 2002/01/12 10:24:46 1.8
+++ packet-hclnfsd.c 2002/04/01 22:26:02
@@ -75,6 +75,7 @@
static int hf_hclnfsd_timesubmitted = -1;
static int hf_hclnfsd_size = -1;
static int hf_hclnfsd_copies = -1;
+static int hf_hclnfsd_auth_ident_obscure = -1;
static gint ett_hclnfsd = -1;
static gint ett_hclnfsd_gids = -1;
@@ -83,8 +84,8 @@
static gint ett_hclnfsd_usernames = -1;
static gint ett_hclnfsd_printqueues = -1;
static gint ett_hclnfsd_printjob = -1;
+static gint ett_hclnfsd_auth_ident = -1;
-
static int
dissect_hclnfsd_gids(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
@@ -149,15 +150,40 @@
{ 0, NULL }
};
+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;
+ }
+}
+
+
static int
dissect_hclnfsd_authorize_call(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
guint32 request_type;
guint32 ip;
+ 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;
ip = tvb_get_ntohl(tvb, offset);
- 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);
proto_tree_add_ipv4(tree, hf_hclnfsd_server_ip, tvb, offset, 4, ip);
offset += 4;
@@ -166,11 +192,51 @@
proto_tree_add_uint(tree, hf_hclnfsd_request_type, tvb, offset,
4, request_type);
offset += 4;
+
+ 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;
- offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_device, offset, NULL);
+ hclnfsd_decode_obscure(ident, ident_len);
- offset = dissect_rpc_string(tvb, pinfo, tree, hf_hclnfsd_login, offset, NULL);
+ username = ident + 2;
+ password = username + strlen(username) + 1;
+ proto_tree_add_text(ident_tree, tvb, offset, ident_len,
+ "Username: %s", username);
+
+ proto_tree_add_text(ident_tree, tvb, offset, ident_len,
+ "Password: %s", password);
+
+ offset = newoffset;
+
+ g_free(ident);
+ ident = NULL;
+ }
+ }
+ }
+ }
+
return offset;
}
@@ -229,29 +295,8 @@
static int
dissect_hclnfsd_grp_to_number_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree)
{
- 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);
}
@@ -656,11 +701,6 @@
void
proto_register_hclnfsd(void)
{
-#if 0
- static struct true_false_string okfailed = { "Ok", "Failed" };
- static struct true_false_string yesno = { "Yes", "No" };
-#endif
-
static hf_register_info hf[] = {
{ &hf_hclnfsd_request_type, {
"Request Type", "hclnfsd.request_type", FT_UINT32, BASE_DEC,
@@ -797,6 +837,10 @@
{ &hf_hclnfsd_host_ip, {
"Host IP", "hclnfsd.host_ip", FT_IPv4, BASE_DEC,
NULL, 0, "Host IP", HFILL }},
+
+ { &hf_hclnfsd_auth_ident_obscure, {
+ "Obscure Ident", "hclnfsd.authorize.ident.obscure", FT_STRING,
+ BASE_DEC , NULL, 0, "Authentication Obscure Ident", HFILL }},
};
static gint *ett[] = {
&ett_hclnfsd,
@@ -806,6 +850,7 @@
&ett_hclnfsd_usernames,
&ett_hclnfsd_printqueues,
&ett_hclnfsd_printjob,
+ &ett_hclnfsd_auth_ident
};
proto_hclnfsd = proto_register_protocol("Hummingbird NFS Daemon",
- References:
- [Ethereal-dev] [patch] Another packet-hclnfsd.c patch
- From: Mike Frisch
- Re: [Ethereal-dev] [patch] Another packet-hclnfsd.c patch
- From: Guy Harris
- [Ethereal-dev] [patch] Another packet-hclnfsd.c patch
- Prev by Date: Re: [Ethereal-dev] [patch] Another packet-hclnfsd.c patch
- Next by Date: Re: [Ethereal-dev] [patch] The real packet-hclnfsd.c patch...
- Previous by thread: Re: [Ethereal-dev] [patch] Another packet-hclnfsd.c patch
- Next by thread: [Ethereal-dev] [patch] The real packet-hclnfsd.c patch...
- Index(es):