Give "dissect_rpc_string()" an extra "char **" argument; if it's
non-null, it returns through that argument a pointer to the displayed version of the string, otherwise it just frees that string. Use that to put, in the tree item for READDIR and READDIRPLUS reply directory entry items, the file name from the directory entry. svn path=/trunk/; revision=1521
This commit is contained in:
parent
0b41709f86
commit
167999e61e
|
@ -1,7 +1,7 @@
|
|||
/* packet-bootparams.c
|
||||
* Routines for bootparams dissection
|
||||
*
|
||||
* $Id: packet-bootparams.c,v 1.7 2000/01/07 22:05:30 guy Exp $
|
||||
* $Id: packet-bootparams.c,v 1.8 2000/01/22 05:49:07 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -90,8 +90,8 @@ int dissect_getfile_call(const u_char *pd, int offset, frame_data *fd,
|
|||
{
|
||||
if ( tree )
|
||||
{
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_bootparams_host);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_bootparams_fileid);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_bootparams_host,NULL);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_bootparams_fileid,NULL);
|
||||
}
|
||||
|
||||
return offset;
|
||||
|
@ -103,9 +103,9 @@ int dissect_getfile_reply(const u_char *pd, int offset, frame_data *fd,
|
|||
{
|
||||
if ( tree )
|
||||
{
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_bootparams_host);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_bootparams_host,NULL);
|
||||
offset = dissect_bp_address(pd,offset,fd,tree,hf_bootparams_hostaddr);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_bootparams_filepath);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_bootparams_filepath,NULL);
|
||||
}
|
||||
|
||||
return offset;
|
||||
|
@ -129,8 +129,8 @@ int dissect_whoami_reply(const u_char *pd, int offset, frame_data *fd,
|
|||
{
|
||||
if ( tree )
|
||||
{
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_bootparams_host);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_bootparams_domain);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_bootparams_host,NULL);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_bootparams_domain,NULL);
|
||||
offset = dissect_bp_address(pd,offset,fd,tree,hf_bootparams_routeraddr);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* packet-mount.c
|
||||
* Routines for mount dissection
|
||||
*
|
||||
* $Id: packet-mount.c,v 1.9 2000/01/07 22:05:32 guy Exp $
|
||||
* $Id: packet-mount.c,v 1.10 2000/01/22 05:49:07 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -99,7 +99,7 @@ dissect_mount_dirpath_call(const u_char *pd, int offset, frame_data *fd,
|
|||
{
|
||||
if ( tree )
|
||||
{
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_mount_path);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_mount_path,NULL);
|
||||
}
|
||||
|
||||
return offset;
|
||||
|
|
48
packet-nfs.c
48
packet-nfs.c
|
@ -2,7 +2,7 @@
|
|||
* Routines for nfs dissection
|
||||
* Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
|
||||
*
|
||||
* $Id: packet-nfs.c,v 1.19 2000/01/18 11:56:15 girlich Exp $
|
||||
* $Id: packet-nfs.c,v 1.20 2000/01/22 05:49:04 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -473,9 +473,10 @@ dissect_sattr(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, ch
|
|||
|
||||
/* RFC 1094, Page 17 */
|
||||
int
|
||||
dissect_filename(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int hf)
|
||||
dissect_filename(const u_char *pd, int offset, frame_data *fd,
|
||||
proto_tree *tree, int hf, char **string_ret)
|
||||
{
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf,string_ret);
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
@ -484,7 +485,7 @@ dissect_filename(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
|
|||
int
|
||||
dissect_path(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int hf)
|
||||
{
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf,NULL);
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
@ -534,7 +535,7 @@ dissect_diropargs(const u_char *pd, int offset, frame_data *fd, proto_tree *tree
|
|||
}
|
||||
|
||||
offset = dissect_fhandle (pd,offset,fd,diropargs_tree,"dir");
|
||||
offset = dissect_filename(pd,offset,fd,diropargs_tree,hf_nfs_name);
|
||||
offset = dissect_filename(pd,offset,fd,diropargs_tree,hf_nfs_name,NULL);
|
||||
|
||||
/* now we know, that diropargs is shorter */
|
||||
if (diropargs_item) {
|
||||
|
@ -782,6 +783,7 @@ dissect_readdir_entry(const u_char* pd, int offset, frame_data* fd, proto_tree*
|
|||
int old_offset = offset;
|
||||
guint32 fileid;
|
||||
guint32 cookie;
|
||||
char *name;
|
||||
|
||||
if (tree) {
|
||||
entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry,
|
||||
|
@ -790,14 +792,21 @@ dissect_readdir_entry(const u_char* pd, int offset, frame_data* fd, proto_tree*
|
|||
entry_tree = proto_item_add_subtree(entry_item, ett_nfs_readdir_entry);
|
||||
}
|
||||
|
||||
if (!BYTES_ARE_IN_FRAME(offset, 4)) return offset;
|
||||
if (!BYTES_ARE_IN_FRAME(offset, 4)) {
|
||||
proto_item_set_text(entry_item, "Entry: <TRUNCATED>");
|
||||
return offset;
|
||||
}
|
||||
fileid = EXTRACT_UINT(pd, offset + 0);
|
||||
if (entry_tree)
|
||||
proto_tree_add_item(entry_tree, hf_nfs_readdir_entry_fileid,
|
||||
offset+0, 4, fileid);
|
||||
offset += 4;
|
||||
|
||||
offset = dissect_filename(pd, offset, fd, entry_tree, hf_nfs_readdir_entry_name);
|
||||
offset = dissect_filename(pd, offset, fd, entry_tree,
|
||||
hf_nfs_readdir_entry_name, &name);
|
||||
proto_item_set_text(entry_item, "Entry: file ID %u, name %s",
|
||||
fileid, name);
|
||||
g_free(name);
|
||||
|
||||
if (!BYTES_ARE_IN_FRAME(offset, 4)) return offset;
|
||||
cookie = EXTRACT_UINT(pd, offset + 0);
|
||||
|
@ -968,9 +977,10 @@ char* name)
|
|||
|
||||
/* RFC 1813, Page 15 */
|
||||
int
|
||||
dissect_filename3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int hf)
|
||||
dissect_filename3(const u_char *pd, int offset, frame_data *fd,
|
||||
proto_tree *tree, int hf, char **string_ret)
|
||||
{
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf,string_ret);
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
@ -979,7 +989,7 @@ dissect_filename3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree
|
|||
int
|
||||
dissect_nfspath3(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int hf)
|
||||
{
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf,NULL);
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
@ -1898,7 +1908,7 @@ dissect_diropargs3(const u_char *pd, int offset, frame_data *fd, proto_tree *tre
|
|||
}
|
||||
|
||||
offset = dissect_nfs_fh3 (pd, offset, fd, diropargs3_tree, "dir");
|
||||
offset = dissect_filename3(pd, offset, fd, diropargs3_tree, hf_nfs_name);
|
||||
offset = dissect_filename3(pd, offset, fd, diropargs3_tree, hf_nfs_name,NULL);
|
||||
|
||||
/* now we know, that diropargs3 is shorter */
|
||||
if (diropargs3_item) {
|
||||
|
@ -2496,6 +2506,7 @@ dissect_entry3(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
|
|||
proto_item* entry_item = NULL;
|
||||
proto_tree* entry_tree = NULL;
|
||||
int old_offset = offset;
|
||||
char *name;
|
||||
|
||||
if (tree) {
|
||||
entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry,
|
||||
|
@ -2506,8 +2517,11 @@ dissect_entry3(const u_char* pd, int offset, frame_data* fd, proto_tree* tree)
|
|||
|
||||
offset = dissect_fileid3(pd, offset, fd, entry_tree, "fileid");
|
||||
|
||||
offset = dissect_filename3(pd, offset, fd, entry_tree, hf_nfs_readdir_entry_name);
|
||||
|
||||
offset = dissect_filename3(pd, offset, fd, entry_tree,
|
||||
hf_nfs_readdir_entry_name, &name);
|
||||
proto_item_set_text(entry_item, "Entry: name %s", name);
|
||||
g_free(name);
|
||||
|
||||
offset = dissect_cookie3(pd, offset, fd, entry_tree, "cookie");
|
||||
|
||||
/* now we know, that a readdir entry is shorter */
|
||||
|
@ -2582,6 +2596,7 @@ dissect_entryplus3(const u_char* pd, int offset, frame_data* fd, proto_tree* tre
|
|||
proto_item* entry_item = NULL;
|
||||
proto_tree* entry_tree = NULL;
|
||||
int old_offset = offset;
|
||||
char *name;
|
||||
|
||||
if (tree) {
|
||||
entry_item = proto_tree_add_item(tree, hf_nfs_readdir_entry,
|
||||
|
@ -2592,8 +2607,11 @@ dissect_entryplus3(const u_char* pd, int offset, frame_data* fd, proto_tree* tre
|
|||
|
||||
offset = dissect_fileid3(pd, offset, fd, entry_tree, "fileid");
|
||||
|
||||
offset = dissect_filename3(pd, offset, fd, entry_tree, hf_nfs_readdirplus_entry_name);
|
||||
|
||||
offset = dissect_filename3(pd, offset, fd, entry_tree,
|
||||
hf_nfs_readdirplus_entry_name, &name);
|
||||
proto_item_set_text(entry_item, "Entry: name %s", name);
|
||||
g_free(name);
|
||||
|
||||
offset = dissect_cookie3(pd, offset, fd, entry_tree, "cookie");
|
||||
|
||||
offset = dissect_post_op_attr(pd, offset, fd, entry_tree, "name_attributes");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* packet-portmap.c
|
||||
* Routines for portmap dissection
|
||||
*
|
||||
* $Id: packet-portmap.c,v 1.11 2000/01/07 22:05:35 guy Exp $
|
||||
* $Id: packet-portmap.c,v 1.12 2000/01/22 05:49:06 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -285,9 +285,9 @@ int dissect_rpcb(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
|
|||
offset+0, 4, version);
|
||||
offset += 4;
|
||||
|
||||
offset = dissect_rpc_string(pd, offset, fd, rpcb_tree, hf_portmap_rpcb_netid);
|
||||
offset = dissect_rpc_string(pd, offset, fd, rpcb_tree, hf_portmap_rpcb_addr);
|
||||
offset = dissect_rpc_string(pd, offset, fd, rpcb_tree, hf_portmap_rpcb_owner);
|
||||
offset = dissect_rpc_string(pd, offset, fd, rpcb_tree, hf_portmap_rpcb_netid,NULL);
|
||||
offset = dissect_rpc_string(pd, offset, fd, rpcb_tree, hf_portmap_rpcb_addr,NULL);
|
||||
offset = dissect_rpc_string(pd, offset, fd, rpcb_tree, hf_portmap_rpcb_owner,NULL);
|
||||
|
||||
/* now we know, that rpcb is shorter */
|
||||
if (rpcb_item) {
|
||||
|
@ -313,7 +313,7 @@ int dissect_rpcb3_getaddr_call(const u_char *pd, int offset, frame_data *fd,
|
|||
int dissect_rpcb3_getaddr_reply(const u_char *pd, int offset, frame_data *fd,
|
||||
proto_tree *tree)
|
||||
{
|
||||
offset = dissect_rpc_string(pd, offset, fd, tree, hf_portmap_uaddr);
|
||||
offset = dissect_rpc_string(pd, offset, fd, tree, hf_portmap_uaddr,NULL);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
|
29
packet-rpc.c
29
packet-rpc.c
|
@ -2,7 +2,7 @@
|
|||
* Routines for rpc dissection
|
||||
* Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
|
||||
*
|
||||
* $Id: packet-rpc.c,v 1.25 2000/01/07 22:05:36 guy Exp $
|
||||
* $Id: packet-rpc.c,v 1.26 2000/01/22 05:49:06 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -404,8 +404,10 @@ char* name, char* type)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
dissect_rpc_opaque_data(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int hfindex, int string_data)
|
||||
static int
|
||||
dissect_rpc_opaque_data(const u_char *pd, int offset, frame_data *fd,
|
||||
proto_tree *tree, int hfindex, gboolean string_data,
|
||||
char **string_buffer_ret)
|
||||
{
|
||||
proto_item *string_item = NULL;
|
||||
proto_tree *string_tree = NULL;
|
||||
|
@ -557,24 +559,33 @@ dissect_rpc_opaque_data(const u_char *pd, int offset, frame_data *fd, proto_tree
|
|||
}
|
||||
|
||||
if (string_buffer != NULL) g_free (string_buffer );
|
||||
if (string_buffer_print != NULL) g_free (string_buffer_print);
|
||||
if (string_buffer_print != NULL) {
|
||||
if (string_buffer_ret != NULL)
|
||||
*string_buffer_ret = string_buffer_print;
|
||||
else
|
||||
g_free (string_buffer_print);
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
dissect_rpc_string(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int hfindex)
|
||||
dissect_rpc_string(const u_char *pd, int offset, frame_data *fd,
|
||||
proto_tree *tree, int hfindex, char **string_buffer_ret)
|
||||
{
|
||||
offset = dissect_rpc_opaque_data(pd, offset, fd, tree, hfindex, 1);
|
||||
offset = dissect_rpc_opaque_data(pd, offset, fd, tree, hfindex, TRUE,
|
||||
string_buffer_ret);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
dissect_rpc_data(const u_char *pd, int offset, frame_data *fd, proto_tree *tree, int hfindex)
|
||||
dissect_rpc_data(const u_char *pd, int offset, frame_data *fd,
|
||||
proto_tree *tree, int hfindex)
|
||||
{
|
||||
offset = dissect_rpc_opaque_data(pd, offset, fd, tree, hfindex, 0);
|
||||
offset = dissect_rpc_opaque_data(pd, offset, fd, tree, hfindex, FALSE,
|
||||
NULL);
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
@ -622,7 +633,7 @@ dissect_rpc_auth( const u_char *pd, int offset, frame_data *fd, proto_tree *tree
|
|||
offset += 4;
|
||||
|
||||
offset = dissect_rpc_string(pd,offset,fd,
|
||||
tree,hf_rpc_auth_machinename);
|
||||
tree,hf_rpc_auth_machinename,NULL);
|
||||
|
||||
if (!BYTES_ARE_IN_FRAME(offset,4)) return;
|
||||
uid = EXTRACT_UINT(pd,offset+0);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* packet-rpc.h (c) 1999 Uwe Girlich */
|
||||
/* $Id: packet-rpc.h,v 1.11 1999/12/14 11:40:27 girlich Exp $ */
|
||||
/* $Id: packet-rpc.h,v 1.12 2000/01/22 05:49:08 guy Exp $ */
|
||||
|
||||
#ifndef __PACKET_RPC_H__
|
||||
#define __PACKET_RPC_H__
|
||||
|
@ -100,7 +100,7 @@ extern unsigned int rpc_roundup(unsigned int a);
|
|||
extern int dissect_rpc_bool(const u_char *pd, int offset, frame_data *fd,
|
||||
proto_tree *tree, int hfindex);
|
||||
extern int dissect_rpc_string(const u_char *pd, int offset, frame_data *fd,
|
||||
proto_tree *tree, int hfindex);
|
||||
proto_tree *tree, int hfindex, char **string_buffer_ret);
|
||||
extern int dissect_rpc_data(const u_char *pd, int offset, frame_data *fd,
|
||||
proto_tree *tree, int hfindex);
|
||||
extern int dissect_rpc_uint32(const u_char *pd, int offset, frame_data *fd,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* packet-ypserv.c
|
||||
* Routines for ypserv dissection
|
||||
*
|
||||
* $Id: packet-ypserv.c,v 1.7 2000/01/07 22:05:42 guy Exp $
|
||||
* $Id: packet-ypserv.c,v 1.8 2000/01/22 05:49:05 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@zing.org>
|
||||
|
@ -53,7 +53,7 @@ int dissect_domain_call(const u_char *pd, int offset, frame_data *fd,
|
|||
{
|
||||
if ( tree )
|
||||
{
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_domain);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_domain,NULL);
|
||||
}
|
||||
|
||||
return offset;
|
||||
|
@ -80,9 +80,9 @@ int dissect_next_call(const u_char *pd, int offset, frame_data *fd,
|
|||
{
|
||||
if ( tree )
|
||||
{
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_domain);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_map);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_key);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_domain,NULL);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_map,NULL);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_key,NULL);
|
||||
}
|
||||
|
||||
return offset;
|
||||
|
@ -93,8 +93,8 @@ int dissect_first_call(const u_char *pd, int offset, frame_data *fd,
|
|||
{
|
||||
if ( tree )
|
||||
{
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_domain);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_map);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_domain,NULL);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_map,NULL);
|
||||
}
|
||||
|
||||
return offset;
|
||||
|
@ -105,9 +105,9 @@ int dissect_match_call(const u_char *pd, int offset, frame_data *fd,
|
|||
{
|
||||
if ( tree )
|
||||
{
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_domain);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_map);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_key);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_domain,NULL);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_map,NULL);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_key,NULL);
|
||||
}
|
||||
|
||||
return offset;
|
||||
|
@ -124,7 +124,7 @@ int dissect_match_reply(const u_char *pd, int offset, frame_data *fd,
|
|||
offset, 4, pntohl(&pd[offset]));
|
||||
offset += 4;
|
||||
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_value);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_value,NULL);
|
||||
}
|
||||
|
||||
return offset;
|
||||
|
@ -141,8 +141,9 @@ int dissect_firstnext_reply(const u_char *pd, int offset, frame_data *fd,
|
|||
offset, 4, pntohl(&pd[offset]));
|
||||
offset += 4;
|
||||
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_value);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_key); }
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_value,NULL);
|
||||
offset = dissect_rpc_string(pd,offset,fd,tree,hf_ypserv_key,NULL);
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue