RSH dissector, from Robert Tsai.

svn path=/trunk/; revision=2261
This commit is contained in:
Guy Harris 2000-08-12 05:41:10 +00:00
parent 2c6e256a87
commit ce2d5b1ac3
5 changed files with 117 additions and 4 deletions

View File

@ -375,6 +375,10 @@ Wes Hardaker <wjhardaker@ucdavis.edu> {
Kerberos 5 support
}
Robert Tsai <rtsai@netapp.com> {
Rsh support
}
Alain Magloire <alainm@rcsm.ece.mcgill.ca> was kind enough to
give his permission to use his version of snprintf.c.

View File

@ -1,7 +1,7 @@
# Makefile.am
# Automake file for Ethereal
#
# $Id: Makefile.am,v 1.219 2000/08/11 03:32:42 guy Exp $
# $Id: Makefile.am,v 1.220 2000/08/12 05:41:00 guy Exp $
#
# Ethereal - Network traffic analyzer
# By Gerald Combs <gerald@zing.org>
@ -53,6 +53,7 @@ DISSECTOR_SOURCES = \
packet-cops.c \
packet-data.c \
packet-ddtp.c \
packet-diameter.c \
packet-dns.c \
packet-eigrp.c \
packet-esis.c \
@ -117,12 +118,12 @@ DISSECTOR_SOURCES = \
packet-q931.c \
packet-quake.c \
packet-radius.c\
packet-diameter.c \
packet-raw.c \
packet-rip.c \
packet-ripng.c \
packet-rlogin.c \
packet-rpc.c \
packet-rsh.c \
packet-rsvp.c \
packet-rtcp.c \
packet-rtp.c \

View File

@ -1,7 +1,7 @@
## Makefile for building ethereal.exe with Microsoft C and nmake
## Use: nmake -f makefile.nmake
#
# $Id: Makefile.nmake,v 1.51 2000/08/11 03:32:43 guy Exp $
# $Id: Makefile.nmake,v 1.52 2000/08/12 05:41:01 guy Exp $
include config.nmake
@ -38,6 +38,7 @@ DISSECTOR_SOURCES = \
packet-cops.c \
packet-data.c \
packet-ddtp.c \
packet-diameter.c \
packet-dns.c \
packet-eigrp.c \
packet-esis.c \
@ -102,12 +103,12 @@ DISSECTOR_SOURCES = \
packet-q931.c \
packet-quake.c \
packet-radius.c\
packet-diameter.c \
packet-raw.c \
packet-rip.c \
packet-ripng.c \
packet-rlogin.c \
packet-rpc.c \
packet-rsh.c \
packet-rsvp.c \
packet-rtcp.c \
packet-rtp.c \

View File

@ -936,6 +936,7 @@ B<http://ethereal.zing.org>.
Peter Kjellerstedt <pkj@axis.com>
Phil Techau <phil_t@altavista.net>
Wes Hardaker <wjhardaker@ucdavis.edu>
Robert Tsai <rtsai@netapp.com>
Alain Magloire <alainm@rcsm.ece.mcgill.ca> was kind enough to give his
permission to use his version of snprintf.c.

106
packet-rsh.c Normal file
View File

@ -0,0 +1,106 @@
/* packet-rsh.c
* Routines for rsh packet disassembly
*
* Robert Tsai <rtsai@netapp.com>
* Liberally copied from packet-http.c, by Guy Harris <guy@alum.mit.edu>
*
* $Id: packet-rsh.c,v 1.1 2000/08/12 05:41:01 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
* Copyright 1998 Gerald Combs
*
*
* 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.
*
*
*/
#include "config.h"
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <glib.h>
#include "packet.h"
static int proto_rsh = -1;
static gint ett_rsh = -1;
#define TCP_PORT_RSH 514
void
dissect_rsh(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
{
proto_item *ti;
proto_tree *rsh_tree;
const u_char *data, *dataend;
const u_char *lineend, *eol;
int linelen;
data = &pd[offset];
dataend = data + END_OF_FRAME;
if (check_col(fd, COL_PROTOCOL))
col_add_str(fd, COL_PROTOCOL, "RSH");
if (check_col(fd, COL_INFO)) {
/* Put the first line from the buffer into the summary. */
lineend = find_line_end(data, dataend, &eol);
linelen = lineend - data;
col_add_str(fd, COL_INFO, format_text(data, linelen));
}
if (tree) {
ti = proto_tree_add_item(tree, proto_rsh, NullTVB, offset,
END_OF_FRAME, FALSE);
rsh_tree = proto_item_add_subtree(ti, ett_rsh);
while (data < dataend) {
/*
* Find the end of the line.
*/
lineend = find_line_end(data, dataend, &eol);
linelen = lineend - data;
/*
* Put this line.
*/
proto_tree_add_text(rsh_tree, NullTVB, offset,
linelen, "%s", format_text(data, linelen));
offset += linelen;
data = lineend;
}
if (data < dataend)
old_dissect_data(&pd[offset], offset, fd, rsh_tree);
}
}
void
proto_register_rsh(void)
{
static gint *ett[] = {
&ett_rsh,
};
proto_rsh = proto_register_protocol("Remote Shell", "rsh");
proto_register_subtree_array(ett, array_length(ett));
}
void
proto_reg_handoff_rsh(void)
{
old_dissector_add("tcp.port", TCP_PORT_RSH, dissect_rsh);
}