1999-10-29 01:11:23 +00:00
|
|
|
/* packet-rpc.c
|
|
|
|
* Routines for rpc dissection
|
|
|
|
* Copyright 1999, Uwe Girlich <Uwe.Girlich@philosys.de>
|
|
|
|
*
|
2001-01-03 06:56:03 +00:00
|
|
|
* $Id: packet-rpc.c,v 1.46 2001/01/03 06:55:31 guy Exp $
|
1999-10-29 01:11:23 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
2000-01-07 22:05:43 +00:00
|
|
|
* By Gerald Combs <gerald@zing.org>
|
1999-10-29 01:11:23 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* Copied from packet-smb.c
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
# include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
1999-11-15 14:57:38 +00:00
|
|
|
#include <ctype.h>
|
1999-10-29 01:11:23 +00:00
|
|
|
#include "packet.h"
|
|
|
|
#include "conversation.h"
|
|
|
|
#include "packet-rpc.h"
|
|
|
|
|
2000-08-24 23:09:37 +00:00
|
|
|
/*
|
|
|
|
* See:
|
|
|
|
*
|
|
|
|
* RFC 1831, "RPC: Remote Procedure Call Protocol Specification
|
|
|
|
* Version 2";
|
|
|
|
*
|
|
|
|
* RFC 1832, "XDR: External Data Representation Standard";
|
|
|
|
*
|
|
|
|
* RFC 2203, "RPCSEC_GSS Protocol Specification".
|
|
|
|
*
|
|
|
|
* See also
|
|
|
|
*
|
|
|
|
* RFC 2695, "Authentication Mechanisms for ONC RPC"
|
|
|
|
*
|
|
|
|
* although we don't currently dissec AUTH_DES or AUTH_KERB.
|
|
|
|
*/
|
1999-10-29 01:11:23 +00:00
|
|
|
|
1999-11-19 13:09:56 +00:00
|
|
|
#define RPC_RM_FRAGLEN 0x7fffffffL
|
|
|
|
|
|
|
|
static struct true_false_string yesno = { "Yes", "No" };
|
|
|
|
|
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
static const value_string rpc_msg_type[] = {
|
1999-10-29 01:11:23 +00:00
|
|
|
{ RPC_CALL, "Call" },
|
|
|
|
{ RPC_REPLY, "Reply" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
static const value_string rpc_reply_state[] = {
|
1999-10-29 01:11:23 +00:00
|
|
|
{ MSG_ACCEPTED, "accepted" },
|
|
|
|
{ MSG_DENIED, "denied" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
1999-11-19 23:23:41 +00:00
|
|
|
const value_string rpc_auth_flavor[] = {
|
1999-10-29 01:11:23 +00:00
|
|
|
{ AUTH_NULL, "AUTH_NULL" },
|
|
|
|
{ AUTH_UNIX, "AUTH_UNIX" },
|
|
|
|
{ AUTH_SHORT, "AUTH_SHORT" },
|
|
|
|
{ AUTH_DES, "AUTH_DES" },
|
2000-08-24 22:58:56 +00:00
|
|
|
{ RPCSEC_GSS, "RPCSEC_GSS" },
|
1999-10-29 01:11:23 +00:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
static const value_string rpc_authgss_proc[] = {
|
2000-08-24 22:58:56 +00:00
|
|
|
{ RPCSEC_GSS_DATA, "RPCSEC_GSS_DATA" },
|
|
|
|
{ RPCSEC_GSS_INIT, "RPCSEC_GSS_INIT" },
|
|
|
|
{ RPCSEC_GSS_CONTINUE_INIT, "RPCSEC_GSS_CONTINUE_INIT" },
|
|
|
|
{ RPCSEC_GSS_DESTROY, "RPCSEC_GSS_DESTROY" },
|
2000-07-17 20:34:00 +00:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string rpc_authgss_svc[] = {
|
2000-08-24 22:58:56 +00:00
|
|
|
{ RPCSEC_GSS_SVC_NONE, "rpcsec_gss_svc_none" },
|
|
|
|
{ RPCSEC_GSS_SVC_INTEGRITY, "rpcsec_gss_svc_integrity" },
|
|
|
|
{ RPCSEC_GSS_SVC_PRIVACY, "rpcsec_gss_svc_privacy" },
|
2000-07-17 20:34:00 +00:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static const value_string rpc_accept_state[] = {
|
1999-10-29 01:11:23 +00:00
|
|
|
{ SUCCESS, "RPC executed successfully" },
|
|
|
|
{ PROG_UNAVAIL, "remote hasn't exported program" },
|
|
|
|
{ PROG_MISMATCH, "remote can't support version #" },
|
|
|
|
{ PROC_UNAVAIL, "program can't support procedure" },
|
|
|
|
{ GARBAGE_ARGS, "procedure can't decode params" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
static const value_string rpc_reject_state[] = {
|
1999-10-29 01:11:23 +00:00
|
|
|
{ RPC_MISMATCH, "RPC_MISMATCH" },
|
|
|
|
{ AUTH_ERROR, "AUTH_ERROR" },
|
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
static const value_string rpc_auth_state[] = {
|
1999-10-29 01:11:23 +00:00
|
|
|
{ AUTH_BADCRED, "bad credential (seal broken)" },
|
|
|
|
{ AUTH_REJECTEDCRED, "client must begin new session" },
|
|
|
|
{ AUTH_BADVERF, "bad verifier (seal broken)" },
|
|
|
|
{ AUTH_REJECTEDVERF, "verifier expired or replayed" },
|
|
|
|
{ AUTH_TOOWEAK, "rejected for security reasons" },
|
2000-08-24 22:58:56 +00:00
|
|
|
{ RPCSEC_GSSCREDPROB, "GSS credential problem" },
|
|
|
|
{ RPCSEC_GSSCTXPROB, "GSS context problem" },
|
1999-10-29 01:11:23 +00:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* the protocol number */
|
|
|
|
static int proto_rpc = -1;
|
1999-11-19 13:09:56 +00:00
|
|
|
static int hf_rpc_lastfrag = -1;
|
|
|
|
static int hf_rpc_fraglen = -1;
|
1999-11-15 14:57:38 +00:00
|
|
|
static int hf_rpc_xid = -1;
|
|
|
|
static int hf_rpc_msgtype = -1;
|
1999-11-15 17:16:51 +00:00
|
|
|
static int hf_rpc_version = -1;
|
|
|
|
static int hf_rpc_version_min = -1;
|
|
|
|
static int hf_rpc_version_max = -1;
|
1999-11-15 14:57:38 +00:00
|
|
|
static int hf_rpc_program = -1;
|
|
|
|
static int hf_rpc_programversion = -1;
|
1999-11-15 17:16:51 +00:00
|
|
|
static int hf_rpc_programversion_min = -1;
|
|
|
|
static int hf_rpc_programversion_max = -1;
|
1999-11-15 14:57:38 +00:00
|
|
|
static int hf_rpc_procedure = -1;
|
1999-11-15 17:16:51 +00:00
|
|
|
static int hf_rpc_auth_flavor = -1;
|
|
|
|
static int hf_rpc_auth_length = -1;
|
|
|
|
static int hf_rpc_auth_machinename = -1;
|
|
|
|
static int hf_rpc_auth_stamp = -1;
|
|
|
|
static int hf_rpc_auth_uid = -1;
|
|
|
|
static int hf_rpc_auth_gid = -1;
|
2000-07-17 20:34:00 +00:00
|
|
|
static int hf_rpc_authgss_v = -1;
|
|
|
|
static int hf_rpc_authgss_proc = -1;
|
|
|
|
static int hf_rpc_authgss_seq = -1;
|
|
|
|
static int hf_rpc_authgss_svc = -1;
|
|
|
|
static int hf_rpc_authgss_ctx = -1;
|
|
|
|
static int hf_rpc_authgss_major = -1;
|
|
|
|
static int hf_rpc_authgss_minor = -1;
|
|
|
|
static int hf_rpc_authgss_window = -1;
|
|
|
|
static int hf_rpc_authgss_token = -1;
|
|
|
|
static int hf_rpc_authgss_data_length = -1;
|
|
|
|
static int hf_rpc_authgss_data = -1;
|
|
|
|
static int hf_rpc_authgss_checksum = -1;
|
1999-11-15 17:16:51 +00:00
|
|
|
static int hf_rpc_state_accept = -1;
|
|
|
|
static int hf_rpc_state_reply = -1;
|
|
|
|
static int hf_rpc_state_reject = -1;
|
|
|
|
static int hf_rpc_state_auth = -1;
|
1999-12-14 11:43:59 +00:00
|
|
|
static int hf_rpc_dup = -1;
|
|
|
|
static int hf_rpc_call_dup = -1;
|
|
|
|
static int hf_rpc_reply_dup = -1;
|
2000-03-09 12:09:53 +00:00
|
|
|
static int hf_rpc_value_follows = -1;
|
1999-10-29 01:11:23 +00:00
|
|
|
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint ett_rpc = -1;
|
|
|
|
static gint ett_rpc_string = -1;
|
|
|
|
static gint ett_rpc_cred = -1;
|
|
|
|
static gint ett_rpc_verf = -1;
|
|
|
|
static gint ett_rpc_gids = -1;
|
2000-07-17 20:34:00 +00:00
|
|
|
static gint ett_rpc_gss_data = -1;
|
1999-10-29 01:11:23 +00:00
|
|
|
|
|
|
|
/* Hash table with info on RPC program numbers */
|
1999-11-16 11:44:20 +00:00
|
|
|
static GHashTable *rpc_progs;
|
1999-10-29 01:11:23 +00:00
|
|
|
|
|
|
|
/* Hash table with info on RPC procedure numbers */
|
1999-11-16 11:44:20 +00:00
|
|
|
static GHashTable *rpc_procs;
|
1999-10-29 01:11:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
/***********************************/
|
|
|
|
/* Hash array with procedure names */
|
|
|
|
/***********************************/
|
|
|
|
|
|
|
|
/* compare 2 keys */
|
|
|
|
gint
|
|
|
|
rpc_proc_equal(gconstpointer k1, gconstpointer k2)
|
|
|
|
{
|
|
|
|
rpc_proc_info_key* key1 = (rpc_proc_info_key*) k1;
|
|
|
|
rpc_proc_info_key* key2 = (rpc_proc_info_key*) k2;
|
|
|
|
|
|
|
|
return ((key1->prog == key2->prog &&
|
|
|
|
key1->vers == key2->vers &&
|
|
|
|
key1->proc == key2->proc) ?
|
|
|
|
TRUE : FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* calculate a hash key */
|
|
|
|
guint
|
|
|
|
rpc_proc_hash(gconstpointer k)
|
|
|
|
{
|
|
|
|
rpc_proc_info_key* key = (rpc_proc_info_key*) k;
|
|
|
|
|
|
|
|
return (key->prog ^ (key->vers<<16) ^ (key->proc<<24));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* insert some entries */
|
|
|
|
void
|
|
|
|
rpc_init_proc_table(guint prog, guint vers, const vsff *proc_table)
|
|
|
|
{
|
|
|
|
const vsff *proc;
|
|
|
|
|
|
|
|
for (proc = proc_table ; proc->strptr!=NULL; proc++) {
|
|
|
|
rpc_proc_info_key *key;
|
|
|
|
rpc_proc_info_value *value;
|
|
|
|
|
|
|
|
key = (rpc_proc_info_key *) g_malloc(sizeof(rpc_proc_info_key));
|
|
|
|
key->prog = prog;
|
|
|
|
key->vers = vers;
|
|
|
|
key->proc = proc->value;
|
|
|
|
|
|
|
|
value = (rpc_proc_info_value *) g_malloc(sizeof(rpc_proc_info_value));
|
|
|
|
value->name = proc->strptr;
|
|
|
|
value->dissect_call = proc->dissect_call;
|
|
|
|
value->dissect_reply = proc->dissect_reply;
|
|
|
|
|
|
|
|
g_hash_table_insert(rpc_procs,key,value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*----------------------------------------*/
|
|
|
|
/* end of Hash array with procedure names */
|
|
|
|
/*----------------------------------------*/
|
|
|
|
|
|
|
|
|
|
|
|
/*********************************/
|
|
|
|
/* Hash array with program names */
|
|
|
|
/*********************************/
|
|
|
|
|
|
|
|
/* compare 2 keys */
|
|
|
|
gint
|
|
|
|
rpc_prog_equal(gconstpointer k1, gconstpointer k2)
|
|
|
|
{
|
|
|
|
rpc_prog_info_key* key1 = (rpc_prog_info_key*) k1;
|
|
|
|
rpc_prog_info_key* key2 = (rpc_prog_info_key*) k2;
|
|
|
|
|
|
|
|
return ((key1->prog == key2->prog) ?
|
|
|
|
TRUE : FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* calculate a hash key */
|
|
|
|
guint
|
|
|
|
rpc_prog_hash(gconstpointer k)
|
|
|
|
{
|
|
|
|
rpc_prog_info_key* key = (rpc_prog_info_key*) k;
|
|
|
|
|
|
|
|
return (key->prog);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
rpc_init_prog(int proto, guint32 prog, int ett)
|
|
|
|
{
|
|
|
|
rpc_prog_info_key *key;
|
|
|
|
rpc_prog_info_value *value;
|
|
|
|
|
|
|
|
key = (rpc_prog_info_key *) g_malloc(sizeof(rpc_prog_info_key));
|
|
|
|
key->prog = prog;
|
|
|
|
|
|
|
|
value = (rpc_prog_info_value *) g_malloc(sizeof(rpc_prog_info_value));
|
|
|
|
value->proto = proto;
|
|
|
|
value->ett = ett;
|
2001-01-03 06:56:03 +00:00
|
|
|
value->progname = proto_get_protocol_short_name(proto);
|
1999-10-29 01:11:23 +00:00
|
|
|
|
|
|
|
g_hash_table_insert(rpc_progs,key,value);
|
|
|
|
}
|
|
|
|
|
1999-11-11 21:22:00 +00:00
|
|
|
/* return the name associated with a previously registered program. This
|
|
|
|
should probably eventually be expanded to use the rpc YP/NIS map
|
|
|
|
so that it can give names for programs not handled by ethereal */
|
|
|
|
char *rpc_prog_name(guint32 prog)
|
|
|
|
{
|
|
|
|
char *progname = NULL;
|
|
|
|
rpc_prog_info_key rpc_prog_key;
|
|
|
|
rpc_prog_info_value *rpc_prog;
|
|
|
|
|
|
|
|
rpc_prog_key.prog = prog;
|
|
|
|
if ((rpc_prog = g_hash_table_lookup(rpc_progs,&rpc_prog_key)) == NULL) {
|
|
|
|
progname = "Unknown";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
progname = rpc_prog->progname;
|
|
|
|
}
|
|
|
|
return progname;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-10-29 01:11:23 +00:00
|
|
|
/*--------------------------------------*/
|
|
|
|
/* end of Hash array with program names */
|
|
|
|
/*--------------------------------------*/
|
|
|
|
|
|
|
|
/* static array, first quick implementation, I'll switch over to GList soon */
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
typedef struct _rpc_call_info {
|
|
|
|
guint32 xid;
|
|
|
|
conversation_t *conversation;
|
|
|
|
guint32 req_num; /* frame number of first request seen */
|
|
|
|
guint32 rep_num; /* frame number of first reply seen */
|
|
|
|
guint32 prog;
|
|
|
|
guint32 vers;
|
|
|
|
guint32 proc;
|
|
|
|
guint32 flavor;
|
|
|
|
guint32 gss_proc;
|
|
|
|
guint32 gss_svc;
|
|
|
|
rpc_proc_info_value* proc_info;
|
|
|
|
} rpc_call_info;
|
|
|
|
|
|
|
|
#define RPC_CALL_TABLE_LENGTH 1000
|
|
|
|
|
1999-10-29 01:11:23 +00:00
|
|
|
rpc_call_info rpc_call_table[RPC_CALL_TABLE_LENGTH];
|
|
|
|
guint32 rpc_call_index = 0;
|
|
|
|
guint32 rpc_call_firstfree = 0;
|
|
|
|
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
static void
|
1999-10-29 01:11:23 +00:00
|
|
|
rpc_call_insert(rpc_call_info *call)
|
|
|
|
{
|
|
|
|
/* some space left? */
|
|
|
|
if (rpc_call_firstfree<RPC_CALL_TABLE_LENGTH) {
|
|
|
|
/* some space left */
|
|
|
|
/* take the first free entry */
|
|
|
|
rpc_call_index = rpc_call_firstfree;
|
|
|
|
/* increase this limit */
|
|
|
|
rpc_call_firstfree++;
|
|
|
|
/* rpc_call_firstfree may now be RPC_CALL_TABLE_LENGTH */
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* no space left */
|
|
|
|
/* the next entry, with wrap around */
|
|
|
|
rpc_call_index = (rpc_call_index+1) % rpc_call_firstfree;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* put the entry in */
|
|
|
|
memcpy(&rpc_call_table[rpc_call_index],call,sizeof(*call));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
static rpc_call_info*
|
1999-10-29 01:11:23 +00:00
|
|
|
rpc_call_lookup(rpc_call_info *call)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
i = rpc_call_index;
|
|
|
|
do {
|
|
|
|
if (
|
|
|
|
rpc_call_table[i].xid == call->xid &&
|
|
|
|
rpc_call_table[i].conversation == call->conversation
|
|
|
|
) {
|
|
|
|
return &rpc_call_table[i];
|
|
|
|
}
|
|
|
|
if (rpc_call_firstfree) {
|
|
|
|
/* decrement by one, go to rpc_call_firstfree-1
|
|
|
|
at the start of the list */
|
|
|
|
i = (i-1+rpc_call_firstfree) % rpc_call_firstfree;
|
|
|
|
}
|
|
|
|
} while (i!=rpc_call_index);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
unsigned int
|
1999-11-15 14:17:20 +00:00
|
|
|
rpc_roundup(unsigned int a)
|
1999-10-29 01:11:23 +00:00
|
|
|
{
|
|
|
|
unsigned int mod = a % 4;
|
|
|
|
return a + ((mod)? 4-mod : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-12-14 11:43:59 +00:00
|
|
|
int
|
|
|
|
dissect_rpc_bool(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
|
|
|
|
int hfindex)
|
|
|
|
{
|
|
|
|
guint32 value;
|
|
|
|
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
|
|
|
|
value = EXTRACT_UINT(pd, offset+0);
|
|
|
|
if (tree)
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_boolean(tree, hfindex, NullTVB, offset, 4, value);
|
1999-12-14 11:43:59 +00:00
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-08-08 06:19:52 +00:00
|
|
|
int
|
|
|
|
dissect_rpc_bool_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
|
int hfindex, int offset)
|
|
|
|
{
|
|
|
|
if (tree)
|
|
|
|
proto_tree_add_item(tree, hfindex, tvb, offset, 4, FALSE);
|
|
|
|
return offset + 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-05 07:16:23 +00:00
|
|
|
int
|
|
|
|
dissect_rpc_uint32(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
|
2000-08-08 06:19:52 +00:00
|
|
|
char* name)
|
1999-11-05 07:16:23 +00:00
|
|
|
{
|
|
|
|
guint32 value;
|
|
|
|
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset,4)) return offset;
|
|
|
|
value = EXTRACT_UINT(pd, offset+0);
|
|
|
|
|
|
|
|
if (tree) {
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(tree, NullTVB, offset, 4,
|
1999-11-15 14:17:20 +00:00
|
|
|
"%s: %u", name, value);
|
1999-11-05 07:16:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
offset += 4;
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-08-08 06:19:52 +00:00
|
|
|
int
|
|
|
|
dissect_rpc_uint32_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
|
int hfindex, int offset)
|
|
|
|
{
|
|
|
|
if (tree)
|
|
|
|
proto_tree_add_item(tree, hfindex, tvb, offset, 4, FALSE);
|
|
|
|
return offset + 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-11-05 07:16:23 +00:00
|
|
|
int
|
|
|
|
dissect_rpc_uint64(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
|
2000-08-08 06:19:52 +00:00
|
|
|
char* name)
|
1999-11-05 07:16:23 +00:00
|
|
|
{
|
|
|
|
guint32 value_low;
|
|
|
|
guint32 value_high;
|
|
|
|
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset,8)) return offset;
|
|
|
|
value_high = EXTRACT_UINT(pd, offset+0);
|
|
|
|
value_low = EXTRACT_UINT(pd, offset+4);
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
if (value_high)
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(tree, NullTVB, offset, 8,
|
1999-12-10 10:40:54 +00:00
|
|
|
"%s: 0x%x%08x", name, value_high, value_low);
|
1999-11-05 07:16:23 +00:00
|
|
|
else
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(tree, NullTVB, offset, 8,
|
1999-11-15 14:17:20 +00:00
|
|
|
"%s: %u", name, value_low);
|
1999-11-05 07:16:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
offset += 8;
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-08-08 06:19:52 +00:00
|
|
|
int
|
|
|
|
dissect_rpc_uint64_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|
|
|
int hfindex, int offset)
|
|
|
|
{
|
|
|
|
guint32 value_low;
|
|
|
|
guint32 value_high;
|
|
|
|
|
|
|
|
value_high = tvb_get_ntohl(tvb, offset + 0);
|
|
|
|
value_low = tvb_get_ntohl(tvb, offset + 4);
|
|
|
|
|
|
|
|
if (tree) {
|
|
|
|
if (value_high)
|
|
|
|
proto_tree_add_text(tree, tvb, offset, 8,
|
|
|
|
"%s: 0x%x%08x", proto_registrar_get_name(hfindex), value_high, value_low);
|
|
|
|
else
|
|
|
|
proto_tree_add_uint(tree, hfindex, tvb, offset, 8, value_low);
|
|
|
|
}
|
|
|
|
|
|
|
|
return offset + 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-01-22 05:49:08 +00:00
|
|
|
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)
|
1999-11-11 16:20:25 +00:00
|
|
|
{
|
1999-11-19 13:09:56 +00:00
|
|
|
proto_item *string_item = NULL;
|
1999-11-11 16:20:25 +00:00
|
|
|
proto_tree *string_tree = NULL;
|
1999-11-19 13:09:56 +00:00
|
|
|
int old_offset = offset;
|
1999-11-11 16:20:25 +00:00
|
|
|
|
1999-12-02 10:20:42 +00:00
|
|
|
int length_truncated = 0;
|
|
|
|
|
|
|
|
int string_truncated = 0;
|
1999-11-19 13:09:56 +00:00
|
|
|
guint32 string_length = 0;
|
1999-12-02 10:20:42 +00:00
|
|
|
guint32 string_length_full;
|
1999-11-19 13:09:56 +00:00
|
|
|
guint32 string_length_packet;
|
|
|
|
guint32 string_length_copy = 0;
|
1999-12-02 10:20:42 +00:00
|
|
|
|
|
|
|
int fill_truncated = 0;
|
|
|
|
guint32 fill_length = 0;
|
|
|
|
guint32 fill_length_packet = 0;
|
|
|
|
guint32 fill_length_copy = 0;
|
|
|
|
|
1999-11-19 13:09:56 +00:00
|
|
|
char *string_buffer = NULL;
|
|
|
|
char *string_buffer_print = NULL;
|
|
|
|
|
|
|
|
if (BYTES_ARE_IN_FRAME(offset,4)) {
|
|
|
|
string_length = EXTRACT_UINT(pd,offset+0);
|
|
|
|
string_length_full = rpc_roundup(string_length);
|
|
|
|
string_length_packet = pi.captured_len - (offset + 4);
|
1999-12-02 10:20:42 +00:00
|
|
|
if (string_length_packet < string_length) {
|
|
|
|
/* truncated string */
|
|
|
|
string_truncated = 1;
|
1999-11-19 13:09:56 +00:00
|
|
|
string_length_copy = string_length_packet;
|
1999-12-02 10:20:42 +00:00
|
|
|
fill_truncated = 2;
|
|
|
|
fill_length = 0;
|
|
|
|
fill_length_packet = 0;
|
|
|
|
fill_length_copy = 0;
|
1999-11-19 13:09:56 +00:00
|
|
|
}
|
|
|
|
else {
|
1999-12-02 10:20:42 +00:00
|
|
|
/* full string data */
|
|
|
|
string_truncated = 0;
|
1999-11-19 13:09:56 +00:00
|
|
|
string_length_copy = string_length;
|
1999-12-02 10:20:42 +00:00
|
|
|
fill_length = string_length_full - string_length;
|
|
|
|
fill_length_packet = pi.captured_len - (offset + 4 + string_length);
|
|
|
|
if (fill_length_packet < fill_length) {
|
|
|
|
/* truncated fill bytes */
|
|
|
|
fill_length_copy = fill_length_packet;
|
|
|
|
fill_truncated = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* full fill bytes */
|
|
|
|
fill_length_copy = fill_length;
|
|
|
|
fill_truncated = 0;
|
|
|
|
}
|
1999-11-19 13:09:56 +00:00
|
|
|
}
|
1999-12-02 10:20:42 +00:00
|
|
|
string_buffer = (char*)g_malloc(string_length_copy +
|
|
|
|
(string_data ? 1 : 0));
|
1999-11-19 13:09:56 +00:00
|
|
|
memcpy(string_buffer,pd+offset+4,string_length_copy);
|
1999-12-02 10:20:42 +00:00
|
|
|
if (string_data)
|
|
|
|
string_buffer[string_length_copy] = '\0';
|
1999-11-19 13:09:56 +00:00
|
|
|
|
|
|
|
/* calculate a nice printable string */
|
|
|
|
if (string_length) {
|
|
|
|
if (string_length != string_length_copy) {
|
1999-12-02 10:20:42 +00:00
|
|
|
if (string_data) {
|
1999-12-06 09:51:56 +00:00
|
|
|
/* alloc maximum data area */
|
|
|
|
string_buffer_print = (char*)g_malloc(string_length_copy + 12 + 1);
|
|
|
|
/* copy over the data */
|
1999-12-02 10:20:42 +00:00
|
|
|
memcpy(string_buffer_print,string_buffer,string_length_copy);
|
1999-12-06 09:51:56 +00:00
|
|
|
/* append a 0 byte for sure printing */
|
|
|
|
string_buffer_print[string_length_copy] = '\0';
|
|
|
|
/* append <TRUNCATED> */
|
|
|
|
/* This way, we get the TRUNCATED even
|
|
|
|
in the case of totally wrong packets,
|
|
|
|
where \0 are inside the string.
|
|
|
|
TRUNCATED will appear at the
|
|
|
|
first \0 or at the end (where we
|
|
|
|
put the securing \0).
|
|
|
|
*/
|
|
|
|
strcat(string_buffer_print,"<TRUNCATED>");
|
1999-12-02 10:20:42 +00:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
string_buffer_print = g_strdup("<DATA><TRUNCATED>");
|
|
|
|
}
|
1999-11-19 13:09:56 +00:00
|
|
|
}
|
|
|
|
else {
|
1999-12-02 10:20:42 +00:00
|
|
|
if (string_data) {
|
|
|
|
string_buffer_print = g_strdup(string_buffer);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
string_buffer_print = g_strdup("<DATA>");
|
|
|
|
}
|
1999-11-19 13:09:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
string_buffer_print = g_strdup("<EMPTY>");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
1999-12-02 10:20:42 +00:00
|
|
|
length_truncated = 1;
|
|
|
|
string_truncated = 2;
|
|
|
|
fill_truncated = 2;
|
1999-11-19 13:09:56 +00:00
|
|
|
string_buffer = g_strdup("");
|
|
|
|
string_buffer_print = g_strdup("<TRUNCATED>");
|
|
|
|
}
|
1999-11-11 16:20:25 +00:00
|
|
|
|
|
|
|
if (tree) {
|
2000-05-11 08:18:09 +00:00
|
|
|
string_item = proto_tree_add_text(tree, NullTVB,offset+0, END_OF_FRAME,
|
1999-11-19 13:09:56 +00:00
|
|
|
"%s: %s", proto_registrar_get_name(hfindex), string_buffer_print);
|
1999-12-02 10:20:42 +00:00
|
|
|
if (string_data) {
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_string_hidden(tree, hfindex, NullTVB, offset+4,
|
1999-12-02 10:20:42 +00:00
|
|
|
string_length_copy, string_buffer);
|
|
|
|
}
|
1999-11-11 16:20:25 +00:00
|
|
|
if (string_item) {
|
1999-11-16 11:44:20 +00:00
|
|
|
string_tree = proto_item_add_subtree(string_item, ett_rpc_string);
|
1999-11-11 16:20:25 +00:00
|
|
|
}
|
|
|
|
}
|
1999-12-02 10:20:42 +00:00
|
|
|
if (length_truncated) {
|
|
|
|
if (string_tree)
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(string_tree, NullTVB,
|
1999-11-19 13:09:56 +00:00
|
|
|
offset,pi.captured_len-offset,
|
|
|
|
"length: <TRUNCATED>");
|
1999-12-02 10:20:42 +00:00
|
|
|
offset = pi.captured_len;
|
|
|
|
} else {
|
|
|
|
if (string_tree)
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(string_tree, NullTVB,offset+0,4,
|
1999-11-19 13:09:56 +00:00
|
|
|
"length: %u", string_length);
|
1999-12-02 10:20:42 +00:00
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
if (string_tree)
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(string_tree, NullTVB,offset,string_length_copy,
|
1999-12-02 10:20:42 +00:00
|
|
|
"contents: %s", string_buffer_print);
|
1999-11-19 13:09:56 +00:00
|
|
|
offset += string_length_copy;
|
1999-12-02 10:20:42 +00:00
|
|
|
if (fill_length) {
|
|
|
|
if (string_tree) {
|
|
|
|
if (fill_truncated) {
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(string_tree, NullTVB,
|
1999-12-02 10:20:42 +00:00
|
|
|
offset,fill_length_copy,
|
|
|
|
"fill bytes: opaque data<TRUNCATED>");
|
|
|
|
}
|
|
|
|
else {
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(string_tree, NullTVB,
|
1999-12-02 10:20:42 +00:00
|
|
|
offset,fill_length_copy,
|
|
|
|
"fill bytes: opaque data");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
offset += fill_length_copy;
|
1999-11-19 13:09:56 +00:00
|
|
|
}
|
1999-11-11 16:20:25 +00:00
|
|
|
}
|
1999-12-02 10:20:42 +00:00
|
|
|
|
1999-11-19 13:09:56 +00:00
|
|
|
if (string_item) {
|
|
|
|
proto_item_set_len(string_item, offset - old_offset);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (string_buffer != NULL) g_free (string_buffer );
|
2000-01-22 05:49:08 +00:00
|
|
|
if (string_buffer_print != NULL) {
|
|
|
|
if (string_buffer_ret != NULL)
|
|
|
|
*string_buffer_ret = string_buffer_print;
|
|
|
|
else
|
|
|
|
g_free (string_buffer_print);
|
|
|
|
}
|
1999-11-11 16:20:25 +00:00
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
1999-11-05 07:16:23 +00:00
|
|
|
|
1999-12-02 10:20:42 +00:00
|
|
|
int
|
2000-01-22 05:49:08 +00:00
|
|
|
dissect_rpc_string(const u_char *pd, int offset, frame_data *fd,
|
|
|
|
proto_tree *tree, int hfindex, char **string_buffer_ret)
|
1999-12-02 10:20:42 +00:00
|
|
|
{
|
2000-01-22 05:49:08 +00:00
|
|
|
offset = dissect_rpc_opaque_data(pd, offset, fd, tree, hfindex, TRUE,
|
|
|
|
string_buffer_ret);
|
1999-12-02 10:20:42 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-08-08 06:19:52 +00:00
|
|
|
int
|
|
|
|
dissect_rpc_string_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int hfindex, int offset, char **string_buffer_ret)
|
|
|
|
{
|
|
|
|
const guint8 *pd;
|
|
|
|
int compat_offset;
|
|
|
|
int compat_offset_new;
|
|
|
|
|
|
|
|
tvb_compat(tvb, &pd, &compat_offset);
|
|
|
|
compat_offset += offset;
|
|
|
|
|
|
|
|
compat_offset_new = dissect_rpc_string(pd, compat_offset, pinfo->fd,
|
|
|
|
tree, hfindex, string_buffer_ret);
|
|
|
|
offset += (compat_offset_new - compat_offset);
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-12-02 10:20:42 +00:00
|
|
|
int
|
2000-01-22 05:49:08 +00:00
|
|
|
dissect_rpc_data(const u_char *pd, int offset, frame_data *fd,
|
|
|
|
proto_tree *tree, int hfindex)
|
1999-12-02 10:20:42 +00:00
|
|
|
{
|
2000-01-22 05:49:08 +00:00
|
|
|
offset = dissect_rpc_opaque_data(pd, offset, fd, tree, hfindex, FALSE,
|
|
|
|
NULL);
|
1999-12-02 10:20:42 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-08-08 06:19:52 +00:00
|
|
|
int
|
|
|
|
dissect_rpc_data_tvb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int hfindex, int offset)
|
|
|
|
{
|
|
|
|
const guint8 *pd;
|
|
|
|
int compat_offset;
|
|
|
|
int compat_offset_new;
|
|
|
|
|
|
|
|
tvb_compat(tvb, &pd, &compat_offset);
|
|
|
|
compat_offset += offset;
|
|
|
|
|
|
|
|
compat_offset_new = dissect_rpc_data(pd, compat_offset, pinfo->fd,
|
|
|
|
tree, hfindex);
|
|
|
|
offset += (compat_offset_new - compat_offset);
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-03-09 12:09:53 +00:00
|
|
|
int
|
|
|
|
dissect_rpc_list(const u_char *pd, int offset, frame_data *fd,
|
|
|
|
proto_tree *tree, dissect_function_t *rpc_list_dissector)
|
|
|
|
{
|
|
|
|
guint32 value_follows;
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
if (!BYTES_ARE_IN_FRAME(offset,4)) break;
|
|
|
|
value_follows = EXTRACT_UINT(pd, offset+0);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_boolean(tree,hf_rpc_value_follows, NullTVB,
|
2000-03-09 12:09:53 +00:00
|
|
|
offset+0, 4, value_follows);
|
|
|
|
offset += 4;
|
|
|
|
if (value_follows == 1) {
|
|
|
|
offset = rpc_list_dissector(pd, offset, fd, tree);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
static int
|
2000-11-21 14:58:07 +00:00
|
|
|
dissect_rpc_authunix_cred(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, int offset)
|
1999-10-29 01:11:23 +00:00
|
|
|
{
|
2000-07-17 20:34:00 +00:00
|
|
|
guint stamp;
|
|
|
|
guint uid;
|
|
|
|
guint gid;
|
|
|
|
guint gids_count;
|
|
|
|
guint gids_i;
|
|
|
|
guint gids_entry;
|
|
|
|
proto_item *gitem;
|
|
|
|
proto_tree *gtree = NULL;
|
1999-10-29 01:11:23 +00:00
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,4)) return offset;
|
|
|
|
stamp = tvb_get_ntohl(tvb,offset+0);
|
2000-07-17 20:34:00 +00:00
|
|
|
if (tree)
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(tree, hf_rpc_auth_stamp, tvb,
|
2000-07-17 20:34:00 +00:00
|
|
|
offset+0, 4, stamp);
|
|
|
|
offset += 4;
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
offset = dissect_rpc_string_tvb(tvb, pinfo, tree,
|
|
|
|
hf_rpc_auth_machinename, offset, NULL);
|
2000-07-17 20:34:00 +00:00
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,4)) return offset;
|
|
|
|
uid = tvb_get_ntohl(tvb,offset+0);
|
2000-07-17 20:34:00 +00:00
|
|
|
if (tree)
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(tree, hf_rpc_auth_uid, tvb,
|
2000-07-17 20:34:00 +00:00
|
|
|
offset+0, 4, uid);
|
|
|
|
offset += 4;
|
1999-10-29 01:11:23 +00:00
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,4)) return offset;
|
|
|
|
gid = tvb_get_ntohl(tvb,offset+0);
|
2000-07-17 20:34:00 +00:00
|
|
|
if (tree)
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(tree, hf_rpc_auth_gid, tvb,
|
2000-07-17 20:34:00 +00:00
|
|
|
offset+0, 4, gid);
|
|
|
|
offset += 4;
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,4)) return offset;
|
|
|
|
gids_count = tvb_get_ntohl(tvb,offset+0);
|
1999-10-29 01:11:23 +00:00
|
|
|
if (tree) {
|
2000-11-21 14:58:07 +00:00
|
|
|
gitem = proto_tree_add_text(tree, tvb,
|
|
|
|
offset, 4+gids_count*4, "Auxiliary GIDs");
|
2000-07-17 20:34:00 +00:00
|
|
|
gtree = proto_item_add_subtree(gitem, ett_rpc_gids);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
2000-07-17 20:34:00 +00:00
|
|
|
offset += 4;
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,4*gids_count)) return offset;
|
2000-07-17 20:34:00 +00:00
|
|
|
for (gids_i = 0 ; gids_i < gids_count ; gids_i++) {
|
2000-11-21 14:58:07 +00:00
|
|
|
gids_entry = tvb_get_ntohl(tvb,offset+0);
|
2000-07-17 20:34:00 +00:00
|
|
|
if (gtree)
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(gtree, hf_rpc_auth_gid, tvb,
|
2000-07-17 20:34:00 +00:00
|
|
|
offset, 4, gids_entry);
|
|
|
|
offset+=4;
|
|
|
|
}
|
|
|
|
/* how can I NOW change the gitem to print a list with
|
|
|
|
the first 16 gids? */
|
1999-10-29 01:11:23 +00:00
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
return offset;
|
|
|
|
}
|
1999-10-29 01:11:23 +00:00
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
static int
|
2000-11-21 14:58:07 +00:00
|
|
|
dissect_rpc_authgss_cred(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, int offset)
|
2000-07-17 20:34:00 +00:00
|
|
|
{
|
|
|
|
guint agc_v;
|
|
|
|
guint agc_proc;
|
|
|
|
guint agc_seq;
|
|
|
|
guint agc_svc;
|
1999-10-29 01:11:23 +00:00
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,4)) return offset;
|
|
|
|
agc_v = tvb_get_ntohl(tvb, offset+0);
|
2000-07-17 20:34:00 +00:00
|
|
|
if (tree)
|
|
|
|
proto_tree_add_uint(tree, hf_rpc_authgss_v,
|
2000-11-21 14:58:07 +00:00
|
|
|
tvb, offset+0, 4, agc_v);
|
2000-07-17 20:34:00 +00:00
|
|
|
offset += 4;
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,4)) return offset;
|
|
|
|
agc_proc = tvb_get_ntohl(tvb, offset+0);
|
2000-07-17 20:34:00 +00:00
|
|
|
if (tree)
|
|
|
|
proto_tree_add_uint(tree, hf_rpc_authgss_proc,
|
2000-11-21 14:58:07 +00:00
|
|
|
tvb, offset+0, 4, agc_proc);
|
2000-07-17 20:34:00 +00:00
|
|
|
offset += 4;
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,4)) return offset;
|
|
|
|
agc_seq = tvb_get_ntohl(tvb, offset+0);
|
2000-07-17 20:34:00 +00:00
|
|
|
if (tree)
|
|
|
|
proto_tree_add_uint(tree, hf_rpc_authgss_seq,
|
2000-11-21 14:58:07 +00:00
|
|
|
tvb, offset+0, 4, agc_seq);
|
2000-07-17 20:34:00 +00:00
|
|
|
offset += 4;
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,4)) return offset;
|
|
|
|
agc_svc = tvb_get_ntohl(tvb, offset+0);
|
2000-07-17 20:34:00 +00:00
|
|
|
if (tree)
|
|
|
|
proto_tree_add_uint(tree, hf_rpc_authgss_svc,
|
2000-11-21 14:58:07 +00:00
|
|
|
tvb, offset+0, 4, agc_svc);
|
2000-07-17 20:34:00 +00:00
|
|
|
offset += 4;
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
offset = dissect_rpc_data_tvb(tvb, pinfo, tree, hf_rpc_authgss_ctx,
|
|
|
|
offset);
|
2000-07-17 20:34:00 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
1999-10-29 01:11:23 +00:00
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
static int
|
2000-11-21 14:58:07 +00:00
|
|
|
dissect_rpc_cred(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, int offset)
|
2000-07-17 20:34:00 +00:00
|
|
|
{
|
|
|
|
guint flavor;
|
|
|
|
guint length;
|
1999-10-29 01:11:23 +00:00
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
proto_item *citem;
|
|
|
|
proto_tree *ctree;
|
1999-10-29 01:11:23 +00:00
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb, offset,8)) return offset;
|
|
|
|
flavor = tvb_get_ntohl(tvb,offset+0);
|
|
|
|
length = tvb_get_ntohl(tvb,offset+4);
|
2000-07-17 20:34:00 +00:00
|
|
|
length = rpc_roundup(length);
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset+8,length)) return offset;
|
2000-07-17 20:34:00 +00:00
|
|
|
|
|
|
|
if (tree) {
|
2000-11-21 14:58:07 +00:00
|
|
|
citem = proto_tree_add_text(tree, tvb, offset,
|
2000-07-17 20:34:00 +00:00
|
|
|
8+length, "Credentials");
|
|
|
|
ctree = proto_item_add_subtree(citem, ett_rpc_cred);
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(ctree, hf_rpc_auth_flavor, tvb,
|
2000-07-17 20:34:00 +00:00
|
|
|
offset+0, 4, flavor);
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(ctree, hf_rpc_auth_length, tvb,
|
2000-07-17 20:34:00 +00:00
|
|
|
offset+4, 4, length);
|
|
|
|
|
|
|
|
switch (flavor) {
|
|
|
|
case AUTH_UNIX:
|
2000-11-21 14:58:07 +00:00
|
|
|
dissect_rpc_authunix_cred(tvb, pinfo, ctree, offset+8);
|
2000-07-17 20:34:00 +00:00
|
|
|
break;
|
1999-10-29 01:11:23 +00:00
|
|
|
/*
|
|
|
|
case AUTH_SHORT:
|
|
|
|
|
|
|
|
break;
|
|
|
|
*/
|
|
|
|
/* I have no tcpdump file with such a packet to verify the
|
|
|
|
info from the RFC 1050 */
|
|
|
|
/*
|
|
|
|
case AUTH_DES:
|
|
|
|
|
|
|
|
break;
|
|
|
|
*/
|
2000-08-24 22:58:56 +00:00
|
|
|
case RPCSEC_GSS:
|
2000-11-21 14:58:07 +00:00
|
|
|
dissect_rpc_authgss_cred(tvb, pinfo, ctree, offset+8);
|
2000-07-17 20:34:00 +00:00
|
|
|
break;
|
1999-10-29 01:11:23 +00:00
|
|
|
default:
|
2000-07-17 20:34:00 +00:00
|
|
|
if (length)
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_text(ctree, tvb, offset+8,
|
2000-07-17 20:34:00 +00:00
|
|
|
length,"opaque data");
|
2000-11-21 14:58:07 +00:00
|
|
|
break;
|
|
|
|
}
|
2000-07-17 20:34:00 +00:00
|
|
|
}
|
|
|
|
offset += 8 + length;
|
|
|
|
|
|
|
|
return offset;
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
static int
|
2000-11-21 14:58:07 +00:00
|
|
|
dissect_rpc_verf(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, int offset)
|
1999-10-29 01:11:23 +00:00
|
|
|
{
|
2000-07-17 20:34:00 +00:00
|
|
|
guint flavor;
|
1999-10-29 01:11:23 +00:00
|
|
|
guint length;
|
2000-07-17 20:34:00 +00:00
|
|
|
|
|
|
|
proto_item *vitem;
|
|
|
|
proto_tree *vtree;
|
1999-10-29 01:11:23 +00:00
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,8)) return offset;
|
|
|
|
flavor = tvb_get_ntohl(tvb,offset+0);
|
|
|
|
length = tvb_get_ntohl(tvb,offset+4);
|
2000-07-17 20:34:00 +00:00
|
|
|
length = rpc_roundup(length);
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset+8,length)) return offset;
|
1999-10-29 01:11:23 +00:00
|
|
|
|
|
|
|
if (tree) {
|
2000-11-21 14:58:07 +00:00
|
|
|
vitem = proto_tree_add_text(tree, tvb, offset,
|
2000-07-17 20:34:00 +00:00
|
|
|
8+length, "Verifier");
|
|
|
|
vtree = proto_item_add_subtree(vitem, ett_rpc_verf);
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(vtree, hf_rpc_auth_flavor, tvb,
|
2000-07-17 20:34:00 +00:00
|
|
|
offset+0, 4, flavor);
|
|
|
|
|
|
|
|
switch (flavor) {
|
|
|
|
case AUTH_UNIX:
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(vtree, hf_rpc_auth_length, tvb,
|
2000-07-17 20:34:00 +00:00
|
|
|
offset+4, 4, length);
|
2000-11-21 14:58:07 +00:00
|
|
|
dissect_rpc_authunix_cred(tvb, pinfo, vtree, offset+8);
|
2000-07-17 20:34:00 +00:00
|
|
|
break;
|
2000-08-24 22:58:56 +00:00
|
|
|
case RPCSEC_GSS:
|
2000-11-21 14:58:07 +00:00
|
|
|
dissect_rpc_data_tvb(tvb, pinfo, vtree,
|
|
|
|
hf_rpc_authgss_checksum, offset+4);
|
2000-07-17 20:34:00 +00:00
|
|
|
break;
|
|
|
|
default:
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(vtree, hf_rpc_auth_length, tvb,
|
2000-07-17 20:34:00 +00:00
|
|
|
offset+4, 4, length);
|
|
|
|
if (length)
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_text(vtree, tvb, offset+8,
|
2000-07-17 20:34:00 +00:00
|
|
|
length, "opaque data");
|
|
|
|
break;
|
|
|
|
}
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
2000-07-17 20:34:00 +00:00
|
|
|
offset += 8 + length;
|
1999-10-29 01:11:23 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
static int
|
2000-11-21 14:58:07 +00:00
|
|
|
dissect_rpc_authgss_initarg(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, int offset)
|
2000-07-17 20:34:00 +00:00
|
|
|
{
|
2000-11-21 14:58:07 +00:00
|
|
|
offset = dissect_rpc_data_tvb(tvb, pinfo, tree, hf_rpc_authgss_token,
|
|
|
|
offset);
|
2000-07-17 20:34:00 +00:00
|
|
|
return offset;
|
|
|
|
}
|
1999-10-29 01:11:23 +00:00
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
static int
|
2000-11-21 14:58:07 +00:00
|
|
|
dissect_rpc_authgss_initres(tvbuff_t* tvb, packet_info* pinfo, proto_tree* tree, int offset)
|
1999-10-29 01:11:23 +00:00
|
|
|
{
|
2000-07-17 20:34:00 +00:00
|
|
|
int major, minor, window;
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
offset = dissect_rpc_data_tvb(tvb, pinfo, tree, hf_rpc_authgss_ctx,
|
|
|
|
offset);
|
2000-07-17 20:34:00 +00:00
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,4)) return offset;
|
|
|
|
major = tvb_get_ntohl(tvb,offset+0);
|
2000-07-17 20:34:00 +00:00
|
|
|
if (tree)
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(tree, hf_rpc_authgss_major, tvb,
|
2000-07-17 20:34:00 +00:00
|
|
|
offset+0, 4, major);
|
|
|
|
offset += 4;
|
1999-10-29 01:11:23 +00:00
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,4)) return offset;
|
|
|
|
minor = tvb_get_ntohl(tvb,offset+0);
|
2000-07-17 20:34:00 +00:00
|
|
|
if (tree)
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(tree, hf_rpc_authgss_minor, tvb,
|
2000-07-17 20:34:00 +00:00
|
|
|
offset+0, 4, minor);
|
|
|
|
offset += 4;
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,4)) return offset;
|
|
|
|
window = tvb_get_ntohl(tvb,offset+0);
|
2000-07-17 20:34:00 +00:00
|
|
|
if (tree)
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(tree, hf_rpc_authgss_window, tvb,
|
2000-07-17 20:34:00 +00:00
|
|
|
offset+0, 4, window);
|
|
|
|
offset += 4;
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
offset = dissect_rpc_data_tvb(tvb, pinfo, tree, hf_rpc_authgss_token,
|
|
|
|
offset);
|
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
call_dissect_function(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, dissect_function_t* dissect_function)
|
|
|
|
{
|
|
|
|
if (dissect_function != NULL) {
|
|
|
|
tvbuff_t *next_tvb;
|
|
|
|
const guint8 *next_pd;
|
|
|
|
int next_offset;
|
|
|
|
int offset_diff;
|
|
|
|
|
|
|
|
/* make a new tvbuff subset */
|
|
|
|
next_tvb = tvb_new_subset(tvb, offset, -1, -1);
|
|
|
|
|
|
|
|
/* make a new pd,offset pair */
|
|
|
|
tvb_compat(next_tvb, &next_pd, &next_offset);
|
|
|
|
|
|
|
|
/* with this difference we can switch to/from old offsets */
|
|
|
|
offset_diff = next_offset - offset;
|
|
|
|
|
|
|
|
/* call the dissector for the next level */
|
|
|
|
next_offset = dissect_function(next_pd, next_offset,
|
|
|
|
pinfo->fd, tree);
|
|
|
|
|
|
|
|
/* correct the tvb offset */
|
|
|
|
offset = next_offset - offset_diff;
|
|
|
|
}
|
2000-07-17 20:34:00 +00:00
|
|
|
|
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
static int
|
2000-11-21 14:58:07 +00:00
|
|
|
dissect_rpc_authgss_integ_data(tvbuff_t *tvb, packet_info *pinfo,
|
|
|
|
proto_tree *tree, int offset, dissect_function_t* dissect_function)
|
2000-07-17 20:34:00 +00:00
|
|
|
{
|
|
|
|
guint32 length, seq;
|
|
|
|
|
|
|
|
proto_item *gitem;
|
|
|
|
proto_tree *gtree;
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb, offset, 8)) return offset;
|
|
|
|
length = tvb_get_ntohl(tvb, offset+0);
|
2000-07-17 20:34:00 +00:00
|
|
|
length = rpc_roundup(length);
|
2000-11-21 14:58:07 +00:00
|
|
|
seq = tvb_get_ntohl(tvb, offset+4);
|
1999-10-29 01:11:23 +00:00
|
|
|
|
|
|
|
if (tree) {
|
2000-11-21 14:58:07 +00:00
|
|
|
gitem = proto_tree_add_text(tree, tvb, offset,
|
2000-07-17 20:34:00 +00:00
|
|
|
4+length, "GSS Data");
|
|
|
|
gtree = proto_item_add_subtree(gitem, ett_rpc_gss_data);
|
|
|
|
proto_tree_add_uint(gtree, hf_rpc_authgss_data_length,
|
2000-11-21 14:58:07 +00:00
|
|
|
tvb, offset+0, 4, length);
|
2000-07-17 20:34:00 +00:00
|
|
|
proto_tree_add_uint(gtree, hf_rpc_authgss_seq,
|
2000-11-21 14:58:07 +00:00
|
|
|
tvb, offset+4, 4, seq);
|
2000-07-17 20:34:00 +00:00
|
|
|
if (dissect_function != NULL)
|
2000-11-21 14:58:07 +00:00
|
|
|
/* offset = */
|
|
|
|
call_dissect_function(tvb, pinfo, gtree,
|
|
|
|
offset, dissect_function);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
2000-07-17 20:34:00 +00:00
|
|
|
offset += 8 + length;
|
2000-11-21 14:58:07 +00:00
|
|
|
offset = dissect_rpc_data_tvb(tvb, pinfo, tree, hf_rpc_authgss_checksum,
|
|
|
|
offset);
|
1999-10-29 01:11:23 +00:00
|
|
|
return offset;
|
|
|
|
}
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
static int
|
2000-11-21 14:58:07 +00:00
|
|
|
dissect_rpc_authgss_priv_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset)
|
2000-07-17 20:34:00 +00:00
|
|
|
{
|
2000-11-21 14:58:07 +00:00
|
|
|
offset = dissect_rpc_data_tvb(tvb, pinfo, tree, hf_rpc_authgss_data,
|
|
|
|
offset);
|
2000-07-17 20:34:00 +00:00
|
|
|
return offset;
|
|
|
|
}
|
1999-10-29 01:11:23 +00:00
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
|
1999-11-14 20:44:52 +00:00
|
|
|
gboolean
|
2000-11-21 14:58:07 +00:00
|
|
|
dissect_rpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
1999-10-29 01:11:23 +00:00
|
|
|
{
|
2000-11-21 14:58:07 +00:00
|
|
|
int offset = 0;
|
1999-11-14 20:44:52 +00:00
|
|
|
guint32 msg_type;
|
|
|
|
rpc_call_info rpc_key;
|
|
|
|
rpc_call_info *rpc_call = NULL;
|
|
|
|
rpc_prog_info_value *rpc_prog = NULL;
|
|
|
|
rpc_prog_info_key rpc_prog_key;
|
|
|
|
|
1999-10-29 01:11:23 +00:00
|
|
|
unsigned int xid;
|
|
|
|
unsigned int rpcvers;
|
1999-11-15 17:16:51 +00:00
|
|
|
unsigned int prog = 0;
|
1999-10-29 01:11:23 +00:00
|
|
|
unsigned int vers = 0;
|
|
|
|
unsigned int proc = 0;
|
2000-07-17 20:34:00 +00:00
|
|
|
unsigned int flavor = 0;
|
|
|
|
unsigned int gss_proc = 0;
|
|
|
|
unsigned int gss_svc = 0;
|
1999-10-29 01:11:23 +00:00
|
|
|
int proto = 0;
|
|
|
|
int ett = 0;
|
|
|
|
|
|
|
|
unsigned int reply_state;
|
|
|
|
unsigned int accept_state;
|
|
|
|
unsigned int reject_state;
|
|
|
|
|
|
|
|
char *msg_type_name = NULL;
|
|
|
|
char *progname;
|
|
|
|
char *procname = NULL;
|
|
|
|
static char procname_static[20];
|
|
|
|
|
|
|
|
unsigned int vers_low;
|
|
|
|
unsigned int vers_high;
|
|
|
|
|
|
|
|
unsigned int auth_state;
|
|
|
|
|
|
|
|
proto_item *rpc_item=NULL;
|
|
|
|
proto_tree *rpc_tree = NULL;
|
|
|
|
|
|
|
|
proto_item *pitem=NULL;
|
|
|
|
proto_tree *ptree = NULL;
|
|
|
|
int offset_old = offset;
|
|
|
|
|
1999-11-19 13:09:56 +00:00
|
|
|
int use_rm = 0;
|
|
|
|
guint32 rpc_rm = 0;
|
|
|
|
|
1999-10-29 01:11:23 +00:00
|
|
|
rpc_call_info rpc_call_msg;
|
|
|
|
rpc_proc_info_key key;
|
|
|
|
rpc_proc_info_value *value = NULL;
|
|
|
|
conversation_t* conversation;
|
For ONC RPC, when constructing conversations, use a null address as the
destination address for calls and the source address of the reply - we
should't require the server address to be the same for a call and reply,
as they may not be on a multi-homed server (clients presumably check the
XID only, or perhaps the XID and the port whence the reply came,
although with TI-RPC I don't think they can check the port without
checking the address as well).
This requires that the conversation code not assume that the source and
destination addresses for a given packet in a conversation have the same
type, so, when comparing addresses for equality, it must explicitly
check the address types.
In said code, also check the port numbers before we check the addresses
- testing ports is cheaper, as they're just integers, and there's
probably a decent chance that you won't see two conversations between
different pairs of hosts and the *same* pair of ports in a capture file,
so the cheaper port tests are probably decently likely to fail first.
svn path=/trunk/; revision=1031
1999-11-14 21:16:58 +00:00
|
|
|
static address null_address = { AT_NONE, 0, NULL };
|
1999-10-29 01:11:23 +00:00
|
|
|
|
|
|
|
dissect_function_t *dissect_function = NULL;
|
|
|
|
|
Add the "Edit:Protocols..." feature which currently only implements
the following:
It is now possible to enable/disable a particular protocol decoding
(i.e. the protocol dissector is void or not). When a protocol
is disabled, it is displayed as Data and of course, all linked
sub-protocols are disabled as well.
Disabling a protocol could be interesting:
- in case of buggy dissectors
- in case of wrong heuristics
- for performance reasons
- to decode the data as another protocol (TODO)
Currently (if I am not wrong), all dissectors but NFS can be disabled
(and dissectors that do not register protocols :-)
I do not like the way the RPC sub-dissectors are disabled (in the
sub-dissectors) since this could be done in the RPC dissector itself,
knowing the sub-protocol hfinfo entry (this is why, I've not modified
the NFS one yet).
Two functions are added in proto.c :
gboolean proto_is_protocol_enabled(int n);
void proto_set_decoding(int n, gboolean enabled);
and two MACROs which can be used in dissectors:
OLD_CHECK_DISPLAY_AS_DATA(index, pd, offset, fd, tree)
CHECK_DISPLAY_AS_DATA(index, tvb, pinfo, tree)
See also the XXX in proto_dlg.c and proto.c around the new functions.
svn path=/trunk/; revision=2267
2000-08-13 14:09:15 +00:00
|
|
|
if (!proto_is_protocol_enabled(proto_rpc))
|
|
|
|
return FALSE;
|
|
|
|
|
2000-11-22 01:39:10 +00:00
|
|
|
pinfo->current_proto = "RPC";
|
|
|
|
|
1999-11-19 13:09:56 +00:00
|
|
|
/* TCP uses record marking */
|
2000-11-22 01:39:10 +00:00
|
|
|
use_rm = (pinfo->ptype == PT_TCP);
|
1999-11-19 13:09:56 +00:00
|
|
|
|
|
|
|
/* the first 4 bytes are special in "record marking mode" */
|
|
|
|
if (use_rm) {
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb, offset, 4))
|
1999-11-19 13:09:56 +00:00
|
|
|
return FALSE;
|
2000-11-21 14:58:07 +00:00
|
|
|
rpc_rm = tvb_get_ntohl(tvb, offset);
|
1999-11-19 13:09:56 +00:00
|
|
|
offset += 4;
|
|
|
|
}
|
|
|
|
|
1999-11-14 20:44:52 +00:00
|
|
|
/*
|
|
|
|
* Check to see whether this looks like an RPC call or reply.
|
|
|
|
*/
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb, offset, 8)) {
|
1999-11-14 20:44:52 +00:00
|
|
|
/* Captured data in packet isn't enough to let us tell. */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* both directions need at least this */
|
2000-11-21 14:58:07 +00:00
|
|
|
msg_type = tvb_get_ntohl(tvb, offset + 4);
|
1999-11-14 20:44:52 +00:00
|
|
|
|
|
|
|
switch (msg_type) {
|
|
|
|
|
|
|
|
case RPC_CALL:
|
|
|
|
/* check for RPC call */
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb, offset, 16)) {
|
1999-11-14 20:44:52 +00:00
|
|
|
/* Captured data in packet isn't enough to let us
|
|
|
|
tell. */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* XID can be anything, we don't check it.
|
|
|
|
We already have the message type.
|
|
|
|
Check whether an RPC version number of 2 is in the
|
|
|
|
location where it would be, and that an RPC program
|
|
|
|
number we know about is in the locaton where it would be. */
|
2000-11-21 14:58:07 +00:00
|
|
|
rpc_prog_key.prog = tvb_get_ntohl(tvb, offset + 12);
|
|
|
|
if (tvb_get_ntohl(tvb, offset + 8) != 2 ||
|
1999-11-14 20:44:52 +00:00
|
|
|
((rpc_prog = g_hash_table_lookup(rpc_progs, &rpc_prog_key))
|
|
|
|
== NULL)) {
|
|
|
|
/* They're not, so it's probably not an RPC call. */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RPC_REPLY:
|
For ONC RPC, when constructing conversations, use a null address as the
destination address for calls and the source address of the reply - we
should't require the server address to be the same for a call and reply,
as they may not be on a multi-homed server (clients presumably check the
XID only, or perhaps the XID and the port whence the reply came,
although with TI-RPC I don't think they can check the port without
checking the address as well).
This requires that the conversation code not assume that the source and
destination addresses for a given packet in a conversation have the same
type, so, when comparing addresses for equality, it must explicitly
check the address types.
In said code, also check the port numbers before we check the addresses
- testing ports is cheaper, as they're just integers, and there's
probably a decent chance that you won't see two conversations between
different pairs of hosts and the *same* pair of ports in a capture file,
so the cheaper port tests are probably decently likely to fail first.
svn path=/trunk/; revision=1031
1999-11-14 21:16:58 +00:00
|
|
|
/* Check for RPC reply. A reply must match a call that
|
|
|
|
we've seen, and the reply must be sent to the same
|
|
|
|
port and address that the call came from, and must
|
|
|
|
come from the port to which the call was sent. (We
|
|
|
|
don't worry about the address to which the call was
|
|
|
|
sent and from which the reply was sent, because there's
|
|
|
|
no guarantee that the reply will come from the address
|
|
|
|
to which the call was sent.) */
|
2000-11-22 01:39:10 +00:00
|
|
|
conversation = find_conversation(&null_address, &pinfo->dst,
|
|
|
|
pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
|
1999-11-14 20:44:52 +00:00
|
|
|
if (conversation == NULL) {
|
|
|
|
/* We haven't seen an RPC call for that conversation,
|
|
|
|
so we can't check for a reply to that call. */
|
|
|
|
return FALSE;
|
|
|
|
}
|
For ONC RPC, when constructing conversations, use a null address as the
destination address for calls and the source address of the reply - we
should't require the server address to be the same for a call and reply,
as they may not be on a multi-homed server (clients presumably check the
XID only, or perhaps the XID and the port whence the reply came,
although with TI-RPC I don't think they can check the port without
checking the address as well).
This requires that the conversation code not assume that the source and
destination addresses for a given packet in a conversation have the same
type, so, when comparing addresses for equality, it must explicitly
check the address types.
In said code, also check the port numbers before we check the addresses
- testing ports is cheaper, as they're just integers, and there's
probably a decent chance that you won't see two conversations between
different pairs of hosts and the *same* pair of ports in a capture file,
so the cheaper port tests are probably decently likely to fail first.
svn path=/trunk/; revision=1031
1999-11-14 21:16:58 +00:00
|
|
|
|
|
|
|
/* The XIDs of the call and reply must match. */
|
2000-11-21 14:58:07 +00:00
|
|
|
rpc_key.xid = tvb_get_ntohl(tvb, offset + 0);
|
1999-11-14 20:44:52 +00:00
|
|
|
rpc_key.conversation = conversation;
|
|
|
|
if ((rpc_call = rpc_call_lookup(&rpc_key)) == NULL) {
|
|
|
|
/* The XID doesn't match a call from that
|
|
|
|
conversation, so it's probably not an RPC reply. */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* The putative message type field contains neither
|
|
|
|
RPC_CALL nor RPC_REPLY, so it's not an RPC call or
|
|
|
|
reply. */
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (check_col(pinfo->fd, COL_PROTOCOL))
|
|
|
|
col_set_str(pinfo->fd, COL_PROTOCOL, "RPC");
|
1999-10-29 01:11:23 +00:00
|
|
|
|
|
|
|
if (tree) {
|
2000-11-21 14:58:07 +00:00
|
|
|
rpc_item = proto_tree_add_item(tree, proto_rpc, tvb, 0,
|
|
|
|
tvb_length(tvb), FALSE);
|
1999-10-29 01:11:23 +00:00
|
|
|
if (rpc_item) {
|
1999-11-16 11:44:20 +00:00
|
|
|
rpc_tree = proto_item_add_subtree(rpc_item, ett_rpc);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-11-19 13:09:56 +00:00
|
|
|
if (use_rm && rpc_tree) {
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_boolean(rpc_tree,hf_rpc_lastfrag, tvb,
|
1999-11-19 13:09:56 +00:00
|
|
|
offset-4, 4, (rpc_rm >> 31) & 0x1);
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(rpc_tree,hf_rpc_fraglen, tvb,
|
1999-11-19 13:09:56 +00:00
|
|
|
offset-4, 4, rpc_rm & RPC_RM_FRAGLEN);
|
|
|
|
}
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
xid = tvb_get_ntohl(tvb, offset + 0);
|
1999-10-29 01:11:23 +00:00
|
|
|
if (rpc_tree) {
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint_format(rpc_tree,hf_rpc_xid, tvb,
|
1999-11-15 17:16:51 +00:00
|
|
|
offset+0, 4, xid, "XID: 0x%x (%u)", xid, xid);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
1999-11-05 07:16:23 +00:00
|
|
|
msg_type_name = val_to_str(msg_type,rpc_msg_type,"%u");
|
1999-10-29 01:11:23 +00:00
|
|
|
if (rpc_tree) {
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(rpc_tree, hf_rpc_msgtype, tvb,
|
1999-11-15 17:16:51 +00:00
|
|
|
offset+4, 4, msg_type);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
offset += 8;
|
|
|
|
|
|
|
|
if (msg_type==RPC_CALL) {
|
1999-11-14 20:44:52 +00:00
|
|
|
/* we know already the proto-entry, the ETT-const,
|
|
|
|
and "rpc_prog" */
|
1999-10-29 01:11:23 +00:00
|
|
|
proto = rpc_prog->proto;
|
|
|
|
ett = rpc_prog->ett;
|
|
|
|
progname = rpc_prog->progname;
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
rpcvers = tvb_get_ntohl(tvb, offset + 0);
|
1999-10-29 01:11:23 +00:00
|
|
|
if (rpc_tree) {
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(rpc_tree,
|
2000-11-21 14:58:07 +00:00
|
|
|
hf_rpc_version, tvb, offset+0, 4, rpcvers);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
prog = tvb_get_ntohl(tvb, offset + 4);
|
1999-10-29 01:11:23 +00:00
|
|
|
|
|
|
|
if (rpc_tree) {
|
2000-03-12 04:48:32 +00:00
|
|
|
proto_tree_add_uint_format(rpc_tree,
|
2000-11-21 14:58:07 +00:00
|
|
|
hf_rpc_program, tvb, offset+4, 4, prog,
|
1999-11-05 07:16:23 +00:00
|
|
|
"Program: %s (%u)", progname, prog);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (check_col(pinfo->fd, COL_PROTOCOL)) {
|
1999-10-29 02:25:54 +00:00
|
|
|
/* Set the protocol name to the underlying
|
|
|
|
program name. */
|
2000-11-21 14:58:07 +00:00
|
|
|
col_add_fstr(pinfo->fd, COL_PROTOCOL, "%s", progname);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb, offset+8,4))
|
1999-11-14 20:44:52 +00:00
|
|
|
return TRUE;
|
2000-11-21 14:58:07 +00:00
|
|
|
vers = tvb_get_ntohl(tvb, offset+8);
|
1999-10-29 01:11:23 +00:00
|
|
|
if (rpc_tree) {
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(rpc_tree,
|
2000-11-21 14:58:07 +00:00
|
|
|
hf_rpc_programversion, tvb, offset+8, 4, vers);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb, offset+12,4))
|
1999-11-14 20:44:52 +00:00
|
|
|
return TRUE;
|
2000-11-21 14:58:07 +00:00
|
|
|
proc = tvb_get_ntohl(tvb, offset+12);
|
1999-10-29 01:11:23 +00:00
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
/* Check for RPCSEC_GSS */
|
2000-11-21 14:58:07 +00:00
|
|
|
if (proc == 0 && tvb_bytes_exist(tvb, offset+16,28)) {
|
|
|
|
flavor = tvb_get_ntohl(tvb, offset+16);
|
2000-08-24 22:58:56 +00:00
|
|
|
if (flavor == RPCSEC_GSS) {
|
2000-11-21 14:58:07 +00:00
|
|
|
gss_proc = tvb_get_ntohl(tvb, offset+28);
|
|
|
|
gss_svc = tvb_get_ntohl(tvb, offset+34);
|
2000-07-17 20:34:00 +00:00
|
|
|
}
|
|
|
|
}
|
1999-10-29 01:11:23 +00:00
|
|
|
key.prog = prog;
|
|
|
|
key.vers = vers;
|
|
|
|
key.proc = proc;
|
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
if ((value = g_hash_table_lookup(rpc_procs,&key)) != NULL) {
|
1999-10-29 01:11:23 +00:00
|
|
|
dissect_function = value->dissect_call;
|
|
|
|
procname = value->name;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* happens only with strange program versions or
|
|
|
|
non-existing dissectors */
|
|
|
|
dissect_function = NULL;
|
1999-11-05 07:16:23 +00:00
|
|
|
sprintf(procname_static, "proc-%u", proc);
|
1999-10-29 01:11:23 +00:00
|
|
|
procname = procname_static;
|
|
|
|
}
|
2000-07-17 20:34:00 +00:00
|
|
|
|
1999-10-29 01:11:23 +00:00
|
|
|
if (rpc_tree) {
|
2000-03-12 04:48:32 +00:00
|
|
|
proto_tree_add_uint_format(rpc_tree,
|
2000-11-21 14:58:07 +00:00
|
|
|
hf_rpc_procedure, tvb, offset+12, 4, proc,
|
1999-11-05 07:16:23 +00:00
|
|
|
"Procedure: %s (%u)", procname, proc);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (check_col(pinfo->fd, COL_INFO)) {
|
|
|
|
col_add_fstr(pinfo->fd, COL_INFO,"V%u %s %s XID 0x%x",
|
1999-10-29 02:25:54 +00:00
|
|
|
vers,
|
1999-10-29 01:11:23 +00:00
|
|
|
procname,
|
1999-10-29 02:25:54 +00:00
|
|
|
msg_type_name,
|
|
|
|
xid);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
For ONC RPC, when constructing conversations, use a null address as the
destination address for calls and the source address of the reply - we
should't require the server address to be the same for a call and reply,
as they may not be on a multi-homed server (clients presumably check the
XID only, or perhaps the XID and the port whence the reply came,
although with TI-RPC I don't think they can check the port without
checking the address as well).
This requires that the conversation code not assume that the source and
destination addresses for a given packet in a conversation have the same
type, so, when comparing addresses for equality, it must explicitly
check the address types.
In said code, also check the port numbers before we check the addresses
- testing ports is cheaper, as they're just integers, and there's
probably a decent chance that you won't see two conversations between
different pairs of hosts and the *same* pair of ports in a capture file,
so the cheaper port tests are probably decently likely to fail first.
svn path=/trunk/; revision=1031
1999-11-14 21:16:58 +00:00
|
|
|
/* Keep track of the address and port whence the call came,
|
|
|
|
and the port to which the call is being sent, so that
|
|
|
|
we can match up calls wityh replies. (We don't worry
|
|
|
|
about the address to which the call was sent and from
|
|
|
|
which the reply was sent, because there's no
|
|
|
|
guarantee that the reply will come from the address
|
|
|
|
to which the call was sent.) */
|
2000-11-22 01:39:10 +00:00
|
|
|
conversation = find_conversation(&pinfo->src, &null_address,
|
|
|
|
pinfo->ptype, pinfo->srcport, pinfo->destport, 0);
|
1999-10-29 01:11:23 +00:00
|
|
|
if (conversation == NULL) {
|
2000-11-22 01:39:10 +00:00
|
|
|
/* It's not part of any conversation - create a new
|
|
|
|
one. */
|
|
|
|
conversation = conversation_new(&pinfo->src,
|
|
|
|
&null_address, pinfo->ptype, pinfo->srcport,
|
|
|
|
pinfo->destport, NULL, 0);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* prepare the key data */
|
|
|
|
rpc_call_msg.xid = xid;
|
|
|
|
rpc_call_msg.conversation = conversation;
|
|
|
|
|
|
|
|
/* look up the request */
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
if ((rpc_call = rpc_call_lookup(&rpc_call_msg)) != NULL) {
|
|
|
|
/* We've seen a request with this XID, with the same
|
|
|
|
source and destination, before - but was it
|
|
|
|
*this* request? */
|
2000-11-21 14:58:07 +00:00
|
|
|
if (pinfo->fd->num != rpc_call->req_num) {
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
/* No, so it's a duplicate request.
|
|
|
|
Mark it as such. */
|
2000-11-21 14:58:07 +00:00
|
|
|
if (check_col(pinfo->fd, COL_INFO)) {
|
|
|
|
col_append_fstr(pinfo->fd, COL_INFO,
|
|
|
|
" dup XID 0x%x", xid);
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
if (rpc_tree) {
|
|
|
|
proto_tree_add_uint_hidden(rpc_tree,
|
2000-11-21 14:58:07 +00:00
|
|
|
hf_rpc_dup, tvb, 0,0, xid);
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
proto_tree_add_uint_hidden(rpc_tree,
|
2000-11-21 14:58:07 +00:00
|
|
|
hf_rpc_call_dup, tvb, 0,0, xid);
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
}
|
1999-12-14 11:43:59 +00:00
|
|
|
}
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2000-08-24 08:55:30 +00:00
|
|
|
/* Prepare the value data.
|
|
|
|
"req_num" and "rep_num" are frame numbers;
|
|
|
|
frame numbers are 1-origin, so we use 0
|
|
|
|
to mean "we don't yet know in which frame
|
|
|
|
the reply for this call appears". */
|
2000-11-21 14:58:07 +00:00
|
|
|
rpc_call_msg.req_num = pinfo->fd->num;
|
2000-08-24 08:55:30 +00:00
|
|
|
rpc_call_msg.rep_num = 0;
|
1999-10-29 01:11:23 +00:00
|
|
|
rpc_call_msg.prog = prog;
|
|
|
|
rpc_call_msg.vers = vers;
|
|
|
|
rpc_call_msg.proc = proc;
|
2000-07-17 20:34:00 +00:00
|
|
|
rpc_call_msg.flavor = flavor;
|
|
|
|
rpc_call_msg.gss_proc = gss_proc;
|
|
|
|
rpc_call_msg.gss_svc = gss_svc;
|
1999-10-29 01:11:23 +00:00
|
|
|
rpc_call_msg.proc_info = value;
|
|
|
|
/* store it */
|
|
|
|
rpc_call_insert(&rpc_call_msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
offset += 16;
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
offset = dissect_rpc_cred(tvb, pinfo, rpc_tree, offset);
|
|
|
|
offset = dissect_rpc_verf(tvb, pinfo, rpc_tree, offset);
|
1999-10-29 01:11:23 +00:00
|
|
|
|
|
|
|
/* go to the next dissector */
|
|
|
|
|
|
|
|
} /* end of RPC call */
|
|
|
|
else if (msg_type == RPC_REPLY)
|
|
|
|
{
|
1999-11-14 20:44:52 +00:00
|
|
|
/* we know already the type from the calling routine,
|
|
|
|
and we already have "rpc_call" set above. */
|
1999-10-29 01:11:23 +00:00
|
|
|
prog = rpc_call->prog;
|
|
|
|
vers = rpc_call->vers;
|
|
|
|
proc = rpc_call->proc;
|
2000-07-17 20:34:00 +00:00
|
|
|
flavor = rpc_call->flavor;
|
|
|
|
gss_proc = rpc_call->gss_proc;
|
|
|
|
gss_svc = rpc_call->gss_svc;
|
|
|
|
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
/* Indicate the frame to which this is a reply. */
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_text(rpc_tree, tvb, 0, 0,
|
2000-08-24 08:55:30 +00:00
|
|
|
"This is a reply to a request starting in frame %u",
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
rpc_call->req_num);
|
|
|
|
|
1999-10-29 01:11:23 +00:00
|
|
|
if (rpc_call->proc_info != NULL) {
|
|
|
|
dissect_function = rpc_call->proc_info->dissect_reply;
|
|
|
|
if (rpc_call->proc_info->name != NULL) {
|
|
|
|
procname = rpc_call->proc_info->name;
|
|
|
|
}
|
|
|
|
else {
|
1999-11-05 07:16:23 +00:00
|
|
|
sprintf(procname_static, "proc-%u", proc);
|
1999-10-29 01:11:23 +00:00
|
|
|
procname = procname_static;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dissect_function = NULL;
|
1999-11-05 07:16:23 +00:00
|
|
|
sprintf(procname_static, "proc-%u", proc);
|
1999-10-29 01:11:23 +00:00
|
|
|
procname = procname_static;
|
|
|
|
}
|
|
|
|
|
|
|
|
rpc_prog_key.prog = prog;
|
|
|
|
if ((rpc_prog = g_hash_table_lookup(rpc_progs,&rpc_prog_key)) == NULL) {
|
|
|
|
proto = 0;
|
|
|
|
ett = 0;
|
|
|
|
progname = "Unknown";
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
proto = rpc_prog->proto;
|
|
|
|
ett = rpc_prog->ett;
|
|
|
|
progname = rpc_prog->progname;
|
1999-10-29 02:25:54 +00:00
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (check_col(pinfo->fd, COL_PROTOCOL)) {
|
1999-10-29 02:25:54 +00:00
|
|
|
/* Set the protocol name to the underlying
|
|
|
|
program name. */
|
2000-11-21 14:58:07 +00:00
|
|
|
col_add_fstr(pinfo->fd, COL_PROTOCOL, "%s",
|
1999-10-29 02:25:54 +00:00
|
|
|
progname);
|
|
|
|
}
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (check_col(pinfo->fd, COL_INFO)) {
|
|
|
|
col_add_fstr(pinfo->fd, COL_INFO,"V%u %s %s XID 0x%x",
|
1999-10-29 02:25:54 +00:00
|
|
|
vers,
|
1999-10-29 01:11:23 +00:00
|
|
|
procname,
|
1999-10-29 02:25:54 +00:00
|
|
|
msg_type_name,
|
|
|
|
xid);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (rpc_tree) {
|
2000-03-12 04:48:32 +00:00
|
|
|
proto_tree_add_uint_format(rpc_tree,
|
2000-11-21 14:58:07 +00:00
|
|
|
hf_rpc_program, tvb, 0, 0, prog,
|
1999-11-15 17:16:51 +00:00
|
|
|
"Program: %s (%u)", progname, prog);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(rpc_tree,
|
2000-11-21 14:58:07 +00:00
|
|
|
hf_rpc_programversion, tvb, 0, 0, vers);
|
2000-03-12 04:48:32 +00:00
|
|
|
proto_tree_add_uint_format(rpc_tree,
|
2000-11-21 14:58:07 +00:00
|
|
|
hf_rpc_procedure, tvb, 0, 0, proc,
|
1999-11-05 07:16:23 +00:00
|
|
|
"Procedure: %s (%u)", procname, proc);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
2000-08-24 08:55:30 +00:00
|
|
|
if (rpc_call->rep_num == 0) {
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
/* We have not yet seen a reply to that call, so
|
|
|
|
this must be the first reply; remember its
|
|
|
|
frame number. */
|
2000-11-21 14:58:07 +00:00
|
|
|
rpc_call->rep_num = pinfo->fd->num;
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
} else {
|
|
|
|
/* We have seen a reply to this call - but was it
|
|
|
|
*this* reply? */
|
2000-11-21 14:58:07 +00:00
|
|
|
if (rpc_call->rep_num != pinfo->fd->num) {
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
/* No, so it's a duplicate reply.
|
|
|
|
Mark it as such. */
|
2000-11-21 14:58:07 +00:00
|
|
|
if (check_col(pinfo->fd, COL_INFO)) {
|
|
|
|
col_append_fstr(pinfo->fd, COL_INFO,
|
|
|
|
" dup XID 0x%x", xid);
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
if (rpc_tree) {
|
|
|
|
proto_tree_add_uint_hidden(rpc_tree,
|
2000-11-21 14:58:07 +00:00
|
|
|
hf_rpc_dup, tvb, 0,0, xid);
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
proto_tree_add_uint_hidden(rpc_tree,
|
2000-11-21 14:58:07 +00:00
|
|
|
hf_rpc_reply_dup, tvb, 0,0, xid);
|
Instead of keeping in the information about an RPC call a count of the
number of replies seen, keep the frame number of the first request seen
for that call and the first reply seen for that call. Use that to
determine whether a request or reply is a duplicate or not.
That means that we don't have to reset the table of RPC calls on a
rescan of the capture (which didn't even fix all the cases where we'd
have misreported the original call or reply as a duplicate due to having
seen it once on the initial pass through the file and once again when,
for example, the user clicked on the packet); doing so causes plenty of
other problems, so don't do that - and don't clear the "visited" flag on
frames on a rescan, either, as that's only done because we were clearing
out conversations and calling all protocols' "init" routines.
As a free bonus, this means that, for a reply, we know what frame the
request was in; put that information into the protocol tree for the
reply, snoop-style.
Make the table of RPC call information, and the routines that manipulate
it, static to "packet-rpc.c"; nobody outside "packet-rpc.c" uses them.
svn path=/trunk/; revision=2358
2000-08-24 06:19:53 +00:00
|
|
|
}
|
1999-12-14 11:43:59 +00:00
|
|
|
}
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb, offset,4))
|
1999-11-14 20:44:52 +00:00
|
|
|
return TRUE;
|
2000-11-21 14:58:07 +00:00
|
|
|
reply_state = tvb_get_ntohl(tvb,offset+0);
|
1999-10-29 01:11:23 +00:00
|
|
|
if (rpc_tree) {
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(rpc_tree, hf_rpc_state_reply, tvb,
|
1999-11-15 17:16:51 +00:00
|
|
|
offset+0, 4, reply_state);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
if (reply_state == MSG_ACCEPTED) {
|
2000-11-21 14:58:07 +00:00
|
|
|
offset = dissect_rpc_verf(tvb, pinfo, rpc_tree, offset);
|
|
|
|
if (!tvb_bytes_exist(tvb, offset,4))
|
1999-11-14 20:44:52 +00:00
|
|
|
return TRUE;
|
2000-11-21 14:58:07 +00:00
|
|
|
accept_state = tvb_get_ntohl(tvb,offset+0);
|
1999-10-29 01:11:23 +00:00
|
|
|
if (rpc_tree) {
|
2000-11-21 14:58:07 +00:00
|
|
|
proto_tree_add_uint(rpc_tree, hf_rpc_state_accept, tvb,
|
1999-11-15 17:16:51 +00:00
|
|
|
offset+0, 4, accept_state);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
offset += 4;
|
|
|
|
switch (accept_state) {
|
|
|
|
case SUCCESS:
|
2000-08-14 07:47:19 +00:00
|
|
|
/* go to the next dissector */
|
1999-10-29 01:11:23 +00:00
|
|
|
break;
|
|
|
|
case PROG_MISMATCH:
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,8))
|
1999-11-14 20:44:52 +00:00
|
|
|
return TRUE;
|
2000-11-21 14:58:07 +00:00
|
|
|
vers_low = tvb_get_ntohl(tvb,offset+0);
|
|
|
|
vers_high = tvb_get_ntohl(tvb,offset+4);
|
1999-10-29 01:11:23 +00:00
|
|
|
if (rpc_tree) {
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(rpc_tree,
|
1999-11-15 17:16:51 +00:00
|
|
|
hf_rpc_programversion_min,
|
2000-11-21 14:58:07 +00:00
|
|
|
tvb, offset+0, 4, vers_low);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(rpc_tree,
|
1999-11-15 17:16:51 +00:00
|
|
|
hf_rpc_programversion_max,
|
2000-11-21 14:58:07 +00:00
|
|
|
tvb, offset+4, 4, vers_high);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
offset += 8;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* void */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else if (reply_state == MSG_DENIED) {
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,4))
|
1999-11-14 20:44:52 +00:00
|
|
|
return TRUE;
|
2000-11-21 14:58:07 +00:00
|
|
|
reject_state = tvb_get_ntohl(tvb,offset+0);
|
1999-10-29 01:11:23 +00:00
|
|
|
if (rpc_tree) {
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(rpc_tree,
|
2000-11-21 14:58:07 +00:00
|
|
|
hf_rpc_state_reject, tvb, offset+0, 4,
|
1999-10-29 01:11:23 +00:00
|
|
|
reject_state);
|
|
|
|
}
|
|
|
|
offset += 4;
|
|
|
|
|
|
|
|
if (reject_state==RPC_MISMATCH) {
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,8))
|
1999-11-14 20:44:52 +00:00
|
|
|
return TRUE;
|
2000-11-21 14:58:07 +00:00
|
|
|
vers_low = tvb_get_ntohl(tvb,offset+0);
|
|
|
|
vers_high = tvb_get_ntohl(tvb,offset+4);
|
1999-10-29 01:11:23 +00:00
|
|
|
if (rpc_tree) {
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(rpc_tree,
|
1999-11-15 17:16:51 +00:00
|
|
|
hf_rpc_version_min,
|
2000-11-21 14:58:07 +00:00
|
|
|
tvb, offset+0, 4, vers_low);
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(rpc_tree,
|
1999-11-15 17:16:51 +00:00
|
|
|
hf_rpc_version_max,
|
2000-11-21 14:58:07 +00:00
|
|
|
tvb, offset+4, 4, vers_high);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
offset += 8;
|
|
|
|
} else if (reject_state==AUTH_ERROR) {
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!tvb_bytes_exist(tvb,offset,4))
|
1999-11-14 20:44:52 +00:00
|
|
|
return TRUE;
|
2000-11-21 14:58:07 +00:00
|
|
|
auth_state = tvb_get_ntohl(tvb,offset+0);
|
1999-10-29 01:11:23 +00:00
|
|
|
if (rpc_tree) {
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(rpc_tree,
|
2000-11-21 14:58:07 +00:00
|
|
|
hf_rpc_state_auth, tvb, offset+0, 4,
|
1999-10-29 01:11:23 +00:00
|
|
|
auth_state);
|
|
|
|
}
|
|
|
|
offset += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} /* end of RPC reply */
|
|
|
|
|
|
|
|
/* now we know, that RPC was shorter */
|
|
|
|
if (rpc_item) {
|
|
|
|
proto_item_set_len(rpc_item, offset - offset_old);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* create here the program specific sub-tree */
|
|
|
|
if (tree) {
|
2000-11-21 14:58:07 +00:00
|
|
|
pitem = proto_tree_add_item(tree, proto, tvb,
|
|
|
|
offset, tvb_length(tvb) - offset, FALSE);
|
1999-11-15 17:16:51 +00:00
|
|
|
if (pitem) {
|
1999-10-29 01:11:23 +00:00
|
|
|
ptree = proto_item_add_subtree(pitem, ett);
|
|
|
|
}
|
|
|
|
|
1999-11-15 17:16:51 +00:00
|
|
|
if (ptree) {
|
2000-05-31 05:09:07 +00:00
|
|
|
proto_tree_add_uint(ptree,
|
2000-05-11 08:18:09 +00:00
|
|
|
hf_rpc_programversion, NullTVB, 0, 0, vers);
|
2000-03-12 04:48:32 +00:00
|
|
|
proto_tree_add_uint_format(ptree,
|
2000-05-11 08:18:09 +00:00
|
|
|
hf_rpc_procedure, NullTVB, 0, 0, proc,
|
1999-11-15 17:16:51 +00:00
|
|
|
"Procedure: %s (%u)", procname, proc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-11-21 14:58:07 +00:00
|
|
|
if (!proto_is_protocol_enabled(proto)) {
|
|
|
|
dissect_function = NULL;
|
|
|
|
}
|
|
|
|
|
2000-07-17 20:34:00 +00:00
|
|
|
/* RPCSEC_GSS processing. */
|
2000-08-24 22:58:56 +00:00
|
|
|
if (flavor == RPCSEC_GSS) {
|
2000-07-17 20:34:00 +00:00
|
|
|
switch (gss_proc) {
|
2000-08-24 22:58:56 +00:00
|
|
|
case RPCSEC_GSS_INIT:
|
|
|
|
case RPCSEC_GSS_CONTINUE_INIT:
|
2000-07-17 20:34:00 +00:00
|
|
|
if (msg_type == RPC_CALL) {
|
2000-11-21 14:58:07 +00:00
|
|
|
offset = dissect_rpc_authgss_initarg(tvb,
|
|
|
|
pinfo, ptree, offset);
|
2000-07-17 20:34:00 +00:00
|
|
|
}
|
|
|
|
else {
|
2000-11-21 14:58:07 +00:00
|
|
|
offset = dissect_rpc_authgss_initres(tvb,
|
|
|
|
pinfo, ptree, offset);
|
2000-07-17 20:34:00 +00:00
|
|
|
}
|
|
|
|
break;
|
2000-08-24 22:58:56 +00:00
|
|
|
case RPCSEC_GSS_DATA:
|
|
|
|
if (gss_svc == RPCSEC_GSS_SVC_NONE) {
|
2000-11-21 14:58:07 +00:00
|
|
|
offset = call_dissect_function(tvb,
|
|
|
|
pinfo, ptree, offset,
|
|
|
|
dissect_function);
|
2000-07-17 20:34:00 +00:00
|
|
|
}
|
2000-08-24 22:58:56 +00:00
|
|
|
else if (gss_svc == RPCSEC_GSS_SVC_INTEGRITY) {
|
2000-11-21 14:58:07 +00:00
|
|
|
offset = dissect_rpc_authgss_integ_data(tvb,
|
|
|
|
pinfo, ptree, offset,
|
|
|
|
dissect_function);
|
2000-07-17 20:34:00 +00:00
|
|
|
}
|
2000-08-24 22:58:56 +00:00
|
|
|
else if (gss_svc == RPCSEC_GSS_SVC_PRIVACY) {
|
2000-11-21 14:58:07 +00:00
|
|
|
offset = dissect_rpc_authgss_priv_data(tvb,
|
|
|
|
pinfo, ptree, offset);
|
2000-07-17 20:34:00 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
dissect_function = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2000-11-21 14:58:07 +00:00
|
|
|
else {
|
|
|
|
offset=call_dissect_function(tvb, pinfo, ptree, offset,
|
|
|
|
dissect_function);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* dissect any remaining bytes (incomplete dissection) as pure data in
|
|
|
|
the ptree */
|
2000-11-21 14:58:07 +00:00
|
|
|
dissect_data(tvb, offset, pinfo, ptree);
|
1999-11-14 20:44:52 +00:00
|
|
|
|
|
|
|
return TRUE;
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
|
|
|
|
1999-11-19 13:09:56 +00:00
|
|
|
|
Provide a general mechanism by which dissectors can register "init"
routines, which are called before a dissection pass is made over all the
packets in a capture - the "init" routine would clear out any state
information that needs to be initialized before such a dissection pass.
Make the NCP, SMB, AFS, and ONC RPC dissectors register their "init"
routines with that mechanism, have the code that reads in a capture file
call the routine that calls all registered "init" routines rather than
calling a wired-in set of "init" routines, and also have the code that
runs a filtering or colorizing pass over all the packets call that
routine, as a filtering or colorizing pass is a dissection pass.
Have the ONC RPC "init" routine zero out the table of RPC calls, so that
it completely erases any state from the previous dissection pass (so
that, for example, if you run a filtering pass, it doesn't mark any
non-duplicate packets as duplicates because it remembers them from the
previous pass).
svn path=/trunk/; revision=1050
1999-11-17 21:58:33 +00:00
|
|
|
/* Discard any state we've saved. */
|
|
|
|
static void
|
1999-10-29 01:11:23 +00:00
|
|
|
rpc_init_protocol(void)
|
|
|
|
{
|
Provide a general mechanism by which dissectors can register "init"
routines, which are called before a dissection pass is made over all the
packets in a capture - the "init" routine would clear out any state
information that needs to be initialized before such a dissection pass.
Make the NCP, SMB, AFS, and ONC RPC dissectors register their "init"
routines with that mechanism, have the code that reads in a capture file
call the routine that calls all registered "init" routines rather than
calling a wired-in set of "init" routines, and also have the code that
runs a filtering or colorizing pass over all the packets call that
routine, as a filtering or colorizing pass is a dissection pass.
Have the ONC RPC "init" routine zero out the table of RPC calls, so that
it completely erases any state from the previous dissection pass (so
that, for example, if you run a filtering pass, it doesn't mark any
non-duplicate packets as duplicates because it remembers them from the
previous pass).
svn path=/trunk/; revision=1050
1999-11-17 21:58:33 +00:00
|
|
|
memset(rpc_call_table, '\0', sizeof rpc_call_table);
|
1999-10-29 01:11:23 +00:00
|
|
|
rpc_call_index = 0;
|
|
|
|
rpc_call_firstfree = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* will be called once from register.c at startup time */
|
|
|
|
void
|
|
|
|
proto_register_rpc(void)
|
|
|
|
{
|
1999-11-15 14:57:38 +00:00
|
|
|
static hf_register_info hf[] = {
|
1999-11-19 13:09:56 +00:00
|
|
|
{ &hf_rpc_lastfrag, {
|
|
|
|
"Last Fragment", "rpc.lastfrag", FT_BOOLEAN, BASE_NONE,
|
|
|
|
&yesno, 0, "Last Fragment" }},
|
|
|
|
{ &hf_rpc_fraglen, {
|
|
|
|
"Fragment Length", "rpc.fraglen", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0, "Fragment Length" }},
|
1999-11-15 14:57:38 +00:00
|
|
|
{ &hf_rpc_xid, {
|
|
|
|
"XID", "rpc.xid", FT_UINT32, BASE_HEX,
|
|
|
|
NULL, 0, "XID" }},
|
|
|
|
{ &hf_rpc_msgtype, {
|
1999-11-15 17:16:51 +00:00
|
|
|
"Message Type", "rpc.msgtyp", FT_UINT32, BASE_DEC,
|
|
|
|
VALS(rpc_msg_type), 0, "Message Type" }},
|
|
|
|
{ &hf_rpc_state_reply, {
|
|
|
|
"Reply State", "rpc.replystat", FT_UINT32, BASE_DEC,
|
|
|
|
VALS(rpc_reply_state), 0, "Reply State" }},
|
|
|
|
{ &hf_rpc_state_accept, {
|
|
|
|
"Accept State", "rpc.state_accept", FT_UINT32, BASE_DEC,
|
|
|
|
VALS(rpc_accept_state), 0, "Accept State" }},
|
|
|
|
{ &hf_rpc_state_reject, {
|
|
|
|
"Reject State", "rpc.state_reject", FT_UINT32, BASE_DEC,
|
|
|
|
VALS(rpc_reject_state), 0, "Reject State" }},
|
|
|
|
{ &hf_rpc_state_auth, {
|
|
|
|
"Auth State", "rpc.state_auth", FT_UINT32, BASE_DEC,
|
|
|
|
VALS(rpc_auth_state), 0, "Auth State" }},
|
|
|
|
{ &hf_rpc_version, {
|
|
|
|
"RPC Version", "rpc.version", FT_UINT32, BASE_DEC,
|
1999-11-15 14:57:38 +00:00
|
|
|
NULL, 0, "RPC Version" }},
|
1999-11-15 17:16:51 +00:00
|
|
|
{ &hf_rpc_version_min, {
|
|
|
|
"RPC Version (Minimum)", "rpc.version.min", FT_UINT32,
|
|
|
|
BASE_DEC, NULL, 0, "Program Version (Minimum)" }},
|
|
|
|
{ &hf_rpc_version_max, {
|
|
|
|
"RPC Version (Maximum)", "rpc.version.max", FT_UINT32,
|
|
|
|
BASE_DEC, NULL, 0, "RPC Version (Maximum)" }},
|
1999-11-15 14:57:38 +00:00
|
|
|
{ &hf_rpc_program, {
|
1999-11-15 17:16:51 +00:00
|
|
|
"Program", "rpc.program", FT_UINT32, BASE_DEC,
|
1999-11-15 14:57:38 +00:00
|
|
|
NULL, 0, "Program" }},
|
|
|
|
{ &hf_rpc_programversion, {
|
|
|
|
"Program Version", "rpc.programversion", FT_UINT32,
|
1999-11-15 17:16:51 +00:00
|
|
|
BASE_DEC, NULL, 0, "Program Version" }},
|
|
|
|
{ &hf_rpc_programversion_min, {
|
|
|
|
"Program Version (Minimum)", "rpc.programversion.min", FT_UINT32,
|
|
|
|
BASE_DEC, NULL, 0, "Program Version (Minimum)" }},
|
|
|
|
{ &hf_rpc_programversion_max, {
|
|
|
|
"Program Version (Maximum)", "rpc.programversion.max", FT_UINT32,
|
|
|
|
BASE_DEC, NULL, 0, "Program Version (Maximum)" }},
|
1999-11-15 14:57:38 +00:00
|
|
|
{ &hf_rpc_procedure, {
|
1999-11-15 17:16:51 +00:00
|
|
|
"Procedure", "rpc.procedure", FT_UINT32, BASE_DEC,
|
1999-11-15 14:57:38 +00:00
|
|
|
NULL, 0, "Procedure" }},
|
1999-11-15 17:16:51 +00:00
|
|
|
{ &hf_rpc_auth_flavor, {
|
|
|
|
"Flavor", "rpc.auth.flavor", FT_UINT32, BASE_DEC,
|
|
|
|
VALS(rpc_auth_flavor), 0, "Flavor" }},
|
|
|
|
{ &hf_rpc_auth_length, {
|
|
|
|
"Length", "rpc.auth.length", FT_UINT32, BASE_DEC,
|
1999-11-15 14:57:38 +00:00
|
|
|
NULL, 0, "Length" }},
|
1999-11-15 17:16:51 +00:00
|
|
|
{ &hf_rpc_auth_stamp, {
|
|
|
|
"Stamp", "rpc.auth.stamp", FT_UINT32, BASE_HEX,
|
|
|
|
NULL, 0, "Stamp" }},
|
|
|
|
{ &hf_rpc_auth_uid, {
|
|
|
|
"UID", "rpc.auth.uid", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0, "UID" }},
|
|
|
|
{ &hf_rpc_auth_gid, {
|
|
|
|
"GID", "rpc.auth.gid", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0, "GID" }},
|
2000-07-17 20:34:00 +00:00
|
|
|
{ &hf_rpc_authgss_v, {
|
|
|
|
"GSS Version", "rpc.authgss.version", FT_UINT32,
|
|
|
|
BASE_DEC, NULL, 0, "GSS Version" }},
|
|
|
|
{ &hf_rpc_authgss_proc, {
|
|
|
|
"GSS Procedure", "rpc.authgss.procedure", FT_UINT32,
|
|
|
|
BASE_DEC, VALS(rpc_authgss_proc), 0, "GSS Procedure" }},
|
|
|
|
{ &hf_rpc_authgss_seq, {
|
|
|
|
"GSS Sequence Number", "rpc.authgss.seqnum", FT_UINT32,
|
|
|
|
BASE_DEC, NULL, 0, "GSS Sequence Number" }},
|
|
|
|
{ &hf_rpc_authgss_svc, {
|
|
|
|
"GSS Service", "rpc.authgss.service", FT_UINT32,
|
|
|
|
BASE_DEC, VALS(rpc_authgss_svc), 0, "GSS Service" }},
|
|
|
|
{ &hf_rpc_authgss_ctx, {
|
|
|
|
"GSS Context", "rpc.authgss.context", FT_BYTES,
|
|
|
|
BASE_HEX, NULL, 0, "GSS Context" }},
|
|
|
|
{ &hf_rpc_authgss_major, {
|
|
|
|
"GSS Major Status", "rpc.authgss.major", FT_UINT32,
|
|
|
|
BASE_DEC, NULL, 0, "GSS Major Status" }},
|
|
|
|
{ &hf_rpc_authgss_minor, {
|
|
|
|
"GSS Minor Status", "rpc.authgss.minor", FT_UINT32,
|
|
|
|
BASE_DEC, NULL, 0, "GSS Minor Status" }},
|
|
|
|
{ &hf_rpc_authgss_window, {
|
|
|
|
"GSS Sequence Window", "rpc.authgss.window", FT_UINT32,
|
|
|
|
BASE_DEC, NULL, 0, "GSS Sequence Window" }},
|
|
|
|
{ &hf_rpc_authgss_token, {
|
|
|
|
"GSS Token", "rpc.authgss.token", FT_BYTES,
|
|
|
|
BASE_HEX, NULL, 0, "GSS Token" }},
|
|
|
|
{ &hf_rpc_authgss_data_length, {
|
|
|
|
"Length", "rpc.authgss.data.length", FT_UINT32,
|
|
|
|
BASE_DEC, NULL, 0, "Length" }},
|
|
|
|
{ &hf_rpc_authgss_data, {
|
|
|
|
"GSS Data", "rpc.authgss.data", FT_BYTES,
|
|
|
|
BASE_HEX, NULL, 0, "GSS Data" }},
|
|
|
|
{ &hf_rpc_authgss_checksum, {
|
|
|
|
"GSS Checksum", "rpc.authgss.checksum", FT_BYTES,
|
|
|
|
BASE_HEX, NULL, 0, "GSS Checksum" }},
|
1999-11-15 17:16:51 +00:00
|
|
|
{ &hf_rpc_auth_machinename, {
|
|
|
|
"Machine Name", "rpc.auth.machinename", FT_STRING,
|
|
|
|
BASE_DEC, NULL, 0, "Machine Name" }},
|
1999-12-14 11:43:59 +00:00
|
|
|
{ &hf_rpc_dup, {
|
|
|
|
"Duplicate Transaction", "rpc.dup", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0, "Duplicate Transaction" }},
|
|
|
|
{ &hf_rpc_call_dup, {
|
|
|
|
"Duplicate Call", "rpc.call.dup", FT_UINT32, BASE_DEC,
|
|
|
|
NULL, 0, "Duplicate Call" }},
|
|
|
|
{ &hf_rpc_reply_dup, {
|
|
|
|
"Duplicate Reply", "rpc.reply.dup", FT_UINT32, BASE_DEC,
|
2000-03-09 12:09:53 +00:00
|
|
|
NULL, 0, "Duplicate Reply" }},
|
|
|
|
{ &hf_rpc_value_follows, {
|
|
|
|
"Value Follows", "rpc.value_follows", FT_BOOLEAN, BASE_NONE,
|
|
|
|
&yesno, 0, "Value Follows" }}
|
1999-11-15 14:57:38 +00:00
|
|
|
};
|
1999-11-16 11:44:20 +00:00
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_rpc,
|
|
|
|
&ett_rpc_string,
|
|
|
|
&ett_rpc_cred,
|
|
|
|
&ett_rpc_verf,
|
|
|
|
&ett_rpc_gids,
|
|
|
|
};
|
1999-11-15 14:57:38 +00:00
|
|
|
|
2001-01-03 06:56:03 +00:00
|
|
|
proto_rpc = proto_register_protocol("Remote Procedure Call",
|
|
|
|
"RPC", "rpc");
|
1999-11-15 14:57:38 +00:00
|
|
|
proto_register_field_array(proto_rpc, hf, array_length(hf));
|
1999-11-16 11:44:20 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
Provide a general mechanism by which dissectors can register "init"
routines, which are called before a dissection pass is made over all the
packets in a capture - the "init" routine would clear out any state
information that needs to be initialized before such a dissection pass.
Make the NCP, SMB, AFS, and ONC RPC dissectors register their "init"
routines with that mechanism, have the code that reads in a capture file
call the routine that calls all registered "init" routines rather than
calling a wired-in set of "init" routines, and also have the code that
runs a filtering or colorizing pass over all the packets call that
routine, as a filtering or colorizing pass is a dissection pass.
Have the ONC RPC "init" routine zero out the table of RPC calls, so that
it completely erases any state from the previous dissection pass (so
that, for example, if you run a filtering pass, it doesn't mark any
non-duplicate packets as duplicates because it remembers them from the
previous pass).
svn path=/trunk/; revision=1050
1999-11-17 21:58:33 +00:00
|
|
|
register_init_routine(&rpc_init_protocol);
|
2000-04-04 06:46:41 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Init the hash tables. Dissectors for RPC protocols must
|
|
|
|
* have a "handoff registration" routine that registers the
|
|
|
|
* protocol with RPC; they must not do it in their protocol
|
|
|
|
* registration routine, as their protocol registration
|
|
|
|
* routine might be called before this routine is called and
|
|
|
|
* thus might be called before the hash tables are initialized,
|
|
|
|
* but it's guaranteed that all protocol registration routines
|
|
|
|
* will be called before any handoff registration routines
|
|
|
|
* are called.
|
|
|
|
*/
|
|
|
|
rpc_progs = g_hash_table_new(rpc_prog_hash, rpc_prog_equal);
|
|
|
|
rpc_procs = g_hash_table_new(rpc_proc_hash, rpc_proc_equal);
|
1999-10-29 01:11:23 +00:00
|
|
|
}
|
2000-07-14 12:55:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
proto_reg_handoff_rpc(void)
|
|
|
|
{
|
2000-11-21 14:58:07 +00:00
|
|
|
heur_dissector_add("tcp", dissect_rpc);
|
|
|
|
heur_dissector_add("udp", dissect_rpc);
|
2000-07-14 12:55:58 +00:00
|
|
|
}
|