From 69f30a1f1273896a24a5475bc7b167d545356e3a Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 19 Nov 2003 03:53:33 +0000 Subject: [PATCH] "dissect_mailslot_browse()", "dissect_mailslot_lanman()", and "dissect_smb_logon()" always return TRUE, so just get rid of their return value. "call_dissector()" automatically calls the data dissector if the protocol for the dissector being called is disabled, so we don't have to check its result and call the data dissector if it returns 0. svn path=/trunk/; revision=9027 --- packet-smb-browse.c | 14 +++++--------- packet-smb-logon.c | 8 +++----- packet-smb-mailslot.c | 24 +++++++++++++----------- 3 files changed, 21 insertions(+), 25 deletions(-) diff --git a/packet-smb-browse.c b/packet-smb-browse.c index 2c864f0030..26bba10705 100644 --- a/packet-smb-browse.c +++ b/packet-smb-browse.c @@ -2,7 +2,7 @@ * Routines for SMB Browser packet dissection * Copyright 1999, Richard Sharpe * - * $Id: packet-smb-browse.c,v 1.33 2003/11/16 23:17:21 guy Exp $ + * $Id: packet-smb-browse.c,v 1.34 2003/11/19 03:53:32 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -563,7 +563,7 @@ dissect_smb_server_type_flags(tvbuff_t *tvb, int offset, packet_info *pinfo, } -static gboolean +static void dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) { int offset = 0; @@ -793,8 +793,6 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr offset += namelen; break; } - - return TRUE; } /* @@ -814,7 +812,7 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr * * XXX - what other browser packets go out to that mailslot? */ -static gboolean +static void dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree) { int offset = 0; @@ -898,8 +896,6 @@ dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr offset += namelen; break; } - - return TRUE; } void @@ -1164,8 +1160,8 @@ proto_register_smb_browse(void) proto_register_field_array(proto_smb_browse, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - new_register_dissector("mailslot_browse", dissect_mailslot_browse, + register_dissector("mailslot_browse", dissect_mailslot_browse, proto_smb_browse); - new_register_dissector("mailslot_lanman", dissect_mailslot_lanman, + register_dissector("mailslot_lanman", dissect_mailslot_lanman, proto_smb_browse); } diff --git a/packet-smb-logon.c b/packet-smb-logon.c index b995af6eab..5d1f2376b2 100644 --- a/packet-smb-logon.c +++ b/packet-smb-logon.c @@ -2,7 +2,7 @@ * Routines for SMB net logon packet dissection * Copyright 2000, Jeffrey C. Foster * - * $Id: packet-smb-logon.c,v 1.35 2003/11/16 23:17:21 guy Exp $ + * $Id: packet-smb-logon.c,v 1.36 2003/11/19 03:53:32 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -814,7 +814,7 @@ static int (*dissect_smb_logon_cmds[])(tvbuff_t *tvb, packet_info *pinfo, proto_ }; -static gboolean +static void dissect_smb_logon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { int offset = 0; @@ -855,8 +855,6 @@ dissect_smb_logon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = dissect_smb_unknown(tvb, pinfo, smb_logon_tree, offset); } - - return TRUE; } void @@ -1030,5 +1028,5 @@ proto_register_smb_logon( void) proto_register_field_array(proto_smb_logon, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - new_register_dissector("netlogon", dissect_smb_logon, proto_smb_logon); + register_dissector("netlogon", dissect_smb_logon, proto_smb_logon); } diff --git a/packet-smb-mailslot.c b/packet-smb-mailslot.c index ce33a8d922..381fbab32d 100644 --- a/packet-smb-mailslot.c +++ b/packet-smb-mailslot.c @@ -2,7 +2,7 @@ * Routines for SMB mailslot packet dissection * Copyright 2000, Jeffrey C. Foster * - * $Id: packet-smb-mailslot.c,v 1.34 2003/11/16 23:17:21 guy Exp $ + * $Id: packet-smb-mailslot.c,v 1.35 2003/11/19 03:53:33 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -85,7 +85,6 @@ dissect_mailslot_smb(tvbuff_t *mshdr_tvb, tvbuff_t *setup_tvb, guint16 opcode; int offset = 0; int len; - gboolean dissected; if (!proto_is_protocol_enabled(find_protocol_by_id(proto_smb_msp))) { return FALSE; @@ -184,30 +183,33 @@ dissect_mailslot_smb(tvbuff_t *mshdr_tvb, tvbuff_t *setup_tvb, proto_item_set_len(item, offset); } - dissected = FALSE; switch(trans_subcmd){ case MAILSLOT_BROWSE: - dissected = call_dissector(mailslot_browse_handle, tvb, pinfo, + call_dissector(mailslot_browse_handle, tvb, pinfo, parent_tree); break; + case MAILSLOT_LANMAN: - dissected = call_dissector(mailslot_lanman_handle, tvb, pinfo, + call_dissector(mailslot_lanman_handle, tvb, pinfo, parent_tree); break; + case MAILSLOT_NET: case MAILSLOT_TEMP_NETLOGON: case MAILSLOT_MSSP: - dissected = call_dissector(netlogon_handle, tvb, pinfo, + call_dissector(netlogon_handle, tvb, pinfo, parent_tree); break; - } - if (!dissected) { + + default: /* - * We dissected the mailslot header, but not the - * message; dissect the latter as data, but indicate - * that we successfully dissected the mailslot stuff. + * We dissected the mailslot header, but we don't know + * how to dissect the message; dissect the latter as data, + * but indicate that we successfully dissected the mailslot + * stuff. */ call_dissector(data_handle,tvb, pinfo, parent_tree); + break; } return TRUE; }