Decode SMB requests inside NetBIOS Datagram Service packets.

svn path=/trunk/; revision=269
This commit is contained in:
Guy Harris 1999-05-10 21:50:13 +00:00
parent 7dc4edc13b
commit 93aab5c7b0
3 changed files with 17 additions and 7 deletions

View File

@ -4,7 +4,7 @@
* Gilbert Ramirez <gram@verdict.uthscsa.edu>
* Much stuff added by Guy Harris <guy@netapp.com>
*
* $Id: packet-nbns.c,v 1.17 1999/05/10 20:02:57 guy Exp $
* $Id: packet-nbns.c,v 1.18 1999/05/10 21:50:13 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -981,7 +981,8 @@ struct nbdgm_header {
};
void
dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree,
int max_data)
{
proto_tree *nbdgm_tree;
proto_item *ti;
@ -1073,6 +1074,7 @@ dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
header.src_port);
offset += 10;
max_data -= 10;
if (header.msg_type == 0x10 ||
header.msg_type == 0x11 || header.msg_type == 0x12) {
@ -1083,6 +1085,7 @@ dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
"Packet offset: %d bytes", header.pkt_offset);
offset += 4;
max_data -= 4;
/* Source name */
len = get_nbns_name(&pd[offset], pd, offset, name);
@ -1090,6 +1093,7 @@ dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
proto_tree_add_item(nbdgm_tree, offset, len, "Source name: %s",
name);
offset += len;
max_data -= len;
/* Destination name */
len = get_nbns_name(&pd[offset], pd, offset, name);
@ -1097,9 +1101,10 @@ dissect_nbdgm(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
proto_tree_add_item(nbdgm_tree, offset, len, "Destination name: %s",
name);
offset += len;
max_data -= len;
/* here we can pass the packet off to the next protocol */
dissect_data(pd, offset, fd, nbdgm_tree);
dissect_smb(pd, offset, fd, nbdgm_tree, max_data);
}
else if (header.msg_type == 0x13) {
proto_tree_add_item(nbdgm_tree, offset, 1, "Error code: %s",

View File

@ -1,7 +1,7 @@
/* packet-udp.c
* Routines for UDP packet disassembly
*
* $Id: packet-udp.c,v 1.14 1999/03/23 03:14:45 gram Exp $
* $Id: packet-udp.c,v 1.15 1999/05/10 21:50:12 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -44,6 +44,8 @@
#include "packet.h"
#include "resolv.h"
extern packet_info pi;
/* UDP structs and definitions */
typedef struct _e_udphdr {
@ -160,6 +162,7 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
struct hash_struct *dissect_routine = NULL;
proto_tree *udp_tree;
proto_item *ti;
guint payload;
/* To do: Check for {cap len,pkt len} < struct len */
/* Avoids alignment problems on many architectures. */
@ -169,6 +172,8 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
uh_ulen = ntohs(uh.uh_ulen);
uh_sum = ntohs(uh.uh_sum);
payload = pi.payload - sizeof(e_udphdr);
if (check_col(fd, COL_PROTOCOL))
col_add_str(fd, COL_PROTOCOL, "UDP");
if (check_col(fd, COL_INFO))
@ -214,7 +219,7 @@ dissect_udp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree) {
dissect_nbns(pd, offset, fd, tree);
break;
case UDP_PORT_NBDGM:
dissect_nbdgm(pd, offset, fd, tree);
dissect_nbdgm(pd, offset, fd, tree, payload);
break;
case UDP_PORT_IPX: /* RFC 1234 */
dissect_ipx(pd, offset, fd, tree);

View File

@ -1,7 +1,7 @@
/* packet.h
* Definitions for packet disassembly structures and routines
*
* $Id: packet.h,v 1.52 1999/05/10 20:51:36 gram Exp $
* $Id: packet.h,v 1.53 1999/05/10 21:50:11 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@ -362,7 +362,7 @@ void dissect_ipv6(const u_char *, int, frame_data *, proto_tree *);
void dissect_ipx(const u_char *, int, frame_data *, proto_tree *);
void dissect_llc(const u_char *, int, frame_data *, proto_tree *);
void dissect_lpd(const u_char *, int, frame_data *, proto_tree *);
void dissect_nbdgm(const u_char *, int, frame_data *, proto_tree *);
void dissect_nbdgm(const u_char *, int, frame_data *, proto_tree *, int);
void dissect_nbipx_ns(const u_char *, int, frame_data *, proto_tree *, int);
void dissect_nbns(const u_char *, int, frame_data *, proto_tree *);
void dissect_ncp(const u_char *, int, frame_data *, proto_tree *, int);