2000-02-14 04:02:21 +00:00
|
|
|
/* packet-smb-mailslot.c
|
2001-03-18 03:23:30 +00:00
|
|
|
* Routines for SMB mailslot packet dissection
|
2000-02-14 04:02:21 +00:00
|
|
|
* Copyright 2000, Jeffrey C. Foster <jfoste@woodward.com>
|
|
|
|
*
|
2001-03-18 03:34:22 +00:00
|
|
|
* $Id: packet-smb-mailslot.c,v 1.11 2001/03/18 03:34:22 guy Exp $
|
2000-02-14 04:02:21 +00:00
|
|
|
*
|
|
|
|
* Ethereal - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@zing.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* Copied from packet-pop.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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "packet-smb-common.h"
|
2001-03-18 03:23:30 +00:00
|
|
|
#include "packet-smb-mailslot.h"
|
2001-03-18 03:34:22 +00:00
|
|
|
#include "packet-smb-browse.h"
|
|
|
|
#include "packet-smb-logon.h"
|
2001-03-18 03:23:30 +00:00
|
|
|
#include "packet-smb-pipe.h"
|
2000-02-14 04:02:21 +00:00
|
|
|
|
|
|
|
static int proto_smb_msp = -1;
|
|
|
|
|
|
|
|
static int ett_smb_msp = -1;
|
|
|
|
|
2001-03-18 03:23:30 +00:00
|
|
|
gboolean
|
2000-02-14 04:02:21 +00:00
|
|
|
dissect_mailslot_smb(const u_char *pd, int offset, frame_data *fd,
|
|
|
|
proto_tree *parent, proto_tree *tree, struct smb_info si, int max_data,
|
|
|
|
int SMB_offset, int errcode, int dirn, const u_char *command,
|
|
|
|
int DataOffset, int DataCount, int ParameterOffset, int ParameterCount){
|
|
|
|
|
|
|
|
|
|
|
|
/* decode the SMB mail slot protocol */
|
|
|
|
|
|
|
|
proto_tree *smb_msp_tree = 0;
|
|
|
|
proto_item *ti;
|
|
|
|
|
|
|
|
guint16 Temp16;
|
|
|
|
const char *StrPtr;
|
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_smb_msp))
|
2001-03-18 03:23:30 +00:00
|
|
|
return FALSE;
|
2000-02-14 04:02:21 +00:00
|
|
|
|
2001-03-18 03:23:30 +00:00
|
|
|
if (check_col(fd, COL_PROTOCOL))
|
|
|
|
col_set_str(fd, COL_PROTOCOL, "SMB Mailslot");
|
|
|
|
|
|
|
|
if (DataOffset < 0) {
|
|
|
|
/* Interim reply */
|
|
|
|
col_set_str(fd, COL_INFO, "Interim reply");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2000-02-14 04:02:21 +00:00
|
|
|
/* do the Op code field */
|
|
|
|
|
|
|
|
Temp16 = GSHORT(pd, offset); /* get Op code */
|
|
|
|
|
|
|
|
if (check_col(fd, COL_INFO))
|
2001-03-18 03:23:30 +00:00
|
|
|
col_set_str(fd, COL_INFO,
|
2000-02-14 04:02:21 +00:00
|
|
|
( Temp16 == 1 ? "Write Mail slot" : "Unknown"));
|
|
|
|
|
|
|
|
|
|
|
|
if (tree) {
|
2000-05-11 08:18:09 +00:00
|
|
|
ti = proto_tree_add_item( parent, proto_smb_msp, NullTVB, offset,
|
2000-05-31 05:09:07 +00:00
|
|
|
END_OF_FRAME, FALSE);
|
2000-02-14 04:02:21 +00:00
|
|
|
smb_msp_tree = proto_item_add_subtree(ti, ett_smb_msp);
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(smb_msp_tree, NullTVB, offset, 2, "Op code: %u (%s)",
|
2000-02-14 04:02:21 +00:00
|
|
|
Temp16, ( Temp16 == 1 ? "Write Mail slot" : "Unknown"));
|
|
|
|
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
/* do the Priority field */
|
|
|
|
Temp16 = GSHORT(pd, offset);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(smb_msp_tree, NullTVB, offset, 2,
|
2000-02-14 04:02:21 +00:00
|
|
|
"Priority of transaction: %u", Temp16);
|
|
|
|
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
/* do the Class field */
|
|
|
|
Temp16 = GSHORT(pd, offset);
|
|
|
|
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(smb_msp_tree, NullTVB, offset, 2, "Class: %u (%s)",
|
2000-02-14 04:02:21 +00:00
|
|
|
Temp16, ( Temp16 == 1) ? "Reliable" : (( Temp16 == 2) ?
|
|
|
|
"Unreliable & Broadcast" : "Unknown"));
|
|
|
|
|
|
|
|
offset += 2;
|
|
|
|
|
|
|
|
/* do the data size field */
|
|
|
|
Temp16 = GSHORT(pd, offset);
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(smb_msp_tree, NullTVB, offset, 2,
|
2000-02-14 04:02:21 +00:00
|
|
|
"Total size of mail data: %u", Temp16);
|
|
|
|
|
|
|
|
offset += 2;
|
|
|
|
}else { /* no tree value adjust offset*/
|
|
|
|
offset += 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Build display for: MailSlot Name */
|
|
|
|
|
|
|
|
StrPtr = &pd[offset]; /* load pointer to name */
|
|
|
|
|
|
|
|
if (smb_msp_tree) {
|
2000-05-11 08:18:09 +00:00
|
|
|
proto_tree_add_text(smb_msp_tree, NullTVB, offset, strlen( StrPtr) + 1,
|
2000-02-14 04:02:21 +00:00
|
|
|
"Mailslot Name: %s", StrPtr);
|
|
|
|
}
|
|
|
|
|
|
|
|
offset += strlen( StrPtr) + 1;
|
|
|
|
|
|
|
|
/*** Decide what dissector to call based upon the command value ***/
|
|
|
|
|
2000-11-22 21:19:38 +00:00
|
|
|
if (command != NULL && strcmp(command, "BROWSE") == 0) { /* Decode a browse */
|
2000-02-14 04:02:21 +00:00
|
|
|
|
|
|
|
return dissect_mailslot_browse(pd, offset, fd, parent, tree,
|
|
|
|
si, max_data, SMB_offset, errcode, dirn, command,
|
|
|
|
DataOffset, DataCount);
|
|
|
|
}
|
|
|
|
|
2000-11-22 21:19:38 +00:00
|
|
|
else if (command != NULL && strcmp(command, "LANMAN") == 0) {
|
2000-02-14 04:02:21 +00:00
|
|
|
|
|
|
|
return dissect_pipe_lanman(pd, offset, fd, parent, tree, si,
|
|
|
|
max_data, SMB_offset, errcode, dirn, command,
|
|
|
|
DataOffset, DataCount, ParameterOffset, ParameterCount);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* NOTE: use TEMP\\NETLOGON and MSSP because they seems very common, */
|
|
|
|
/* NOTE: may need a look up list to check for the mailslot names passed */
|
|
|
|
/* by the logon request packet */
|
|
|
|
|
2000-11-22 21:19:38 +00:00
|
|
|
else if (((command != NULL) &&
|
|
|
|
strncmp(command, "NET", strlen("NET")) == 0) ||
|
|
|
|
(strcmp(command, "TEMP\\NETLOGON") == 0) ||
|
|
|
|
(strcmp(command, "MSSP") == 0)){
|
2000-02-14 04:02:21 +00:00
|
|
|
|
|
|
|
return dissect_smb_logon(pd, DataOffset, fd, parent, tree,
|
|
|
|
si, max_data, SMB_offset, errcode, dirn,
|
|
|
|
command, DataOffset, DataCount);
|
|
|
|
|
|
|
|
}
|
2001-03-18 03:23:30 +00:00
|
|
|
return TRUE;
|
2000-02-14 04:02:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
register_proto_smb_mailslot( void){
|
|
|
|
|
|
|
|
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_smb_msp
|
|
|
|
};
|
|
|
|
|
|
|
|
proto_smb_msp = proto_register_protocol(
|
2001-01-03 06:56:03 +00:00
|
|
|
"SMB MailSlot Protocol", "SMB Mailslot", "mailslot");
|
2000-02-14 04:02:21 +00:00
|
|
|
|
2000-02-14 04:21:04 +00:00
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
2000-02-14 04:02:21 +00:00
|
|
|
}
|