diff options
author | Tim Potter <tpot@samba.org> | 2003-02-17 01:59:39 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2003-02-17 01:59:39 +0000 |
commit | 3031823bed12bd2156b1718181575718ebdfe0ec (patch) | |
tree | c4dba5f01f7eba1355c16af4360db3b90f2f94f4 | |
parent | 33b251a58ff1e9d556f88ef5ff0de13927c9b551 (diff) |
Dissect the server type bitfield in NetServerGetInfo for SERVER_INFO_101
and SERVER_INFO_102.
Modify all callers to use the new interface.
svn path=/trunk/; revision=7158
-rw-r--r-- | packet-dcerpc-srvsvc.c | 18 | ||||
-rw-r--r-- | packet-smb-browse.c | 34 | ||||
-rw-r--r-- | packet-smb-browse.h | 8 | ||||
-rw-r--r-- | packet-smb-pipe.c | 12 |
4 files changed, 37 insertions, 35 deletions
diff --git a/packet-dcerpc-srvsvc.c b/packet-dcerpc-srvsvc.c index 70241e42e6..f3d0d642b0 100644 --- a/packet-dcerpc-srvsvc.c +++ b/packet-dcerpc-srvsvc.c @@ -9,7 +9,7 @@ * 2002, some share information levels implemented based on samba * sources. * - * $Id: packet-dcerpc-srvsvc.c,v 1.52 2003/02/07 22:44:53 guy Exp $ + * $Id: packet-dcerpc-srvsvc.c,v 1.53 2003/02/17 01:59:39 tpot Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -44,6 +44,7 @@ #include "packet-dcerpc-lsa.h" #include "packet-dcerpc-nt.h" #include "packet-smb-common.h" +#include "packet-smb-browse.h" #include "smb.h" static int proto_dcerpc_srvsvc = -1; @@ -88,7 +89,6 @@ static int hf_srvsvc_rc = -1; static int hf_srvsvc_platform_id = -1; static int hf_srvsvc_ver_major = -1; static int hf_srvsvc_ver_minor = -1; -static int hf_srvsvc_server_type = -1; static int hf_srvsvc_client_type = -1; static int hf_srvsvc_comment = -1; static int hf_srvsvc_users = -1; @@ -3175,8 +3175,8 @@ srvsvc_dissect_SERVER_INFO_101(tvbuff_t *tvb, int offset, offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_srvsvc_ver_minor, NULL); - offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, - hf_srvsvc_server_type, NULL); + offset = dissect_smb_server_type_flags( + tvb, offset, pinfo, tree, drep, TRUE); offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep, NDR_POINTER_UNIQUE, "Comment", hf_srvsvc_comment, 0); @@ -3218,8 +3218,8 @@ srvsvc_dissect_SERVER_INFO_102(tvbuff_t *tvb, int offset, offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf_srvsvc_ver_minor, NULL); - offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, - hf_srvsvc_server_type, NULL); + offset = dissect_smb_server_type_flags( + tvb, offset, pinfo, tree, drep, TRUE); offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, drep, NDR_POINTER_UNIQUE, "Comment", hf_srvsvc_comment, 0); @@ -6928,12 +6928,6 @@ proto_register_dcerpc_srvsvc(void) { &hf_srvsvc_ver_minor, { "Minor Version", "srvsvc.version.minor", FT_UINT32, BASE_DEC, NULL, 0x0, "Minor Version", HFILL}}, - /* XXX - Should break this out. We know it from browsing. - See "dissect_smb_server_type_flags()" - in "packet-smb-browse.c" */ - { &hf_srvsvc_server_type, - { "Server Type", "srvsvc.server.type", FT_UINT32, - BASE_HEX, NULL, 0x0, "Server Type", HFILL}}, { &hf_srvsvc_client_type, { "Client Type", "srvsvc.client.type", FT_STRING, BASE_NONE, NULL, 0x0, "Client Type", HFILL}}, diff --git a/packet-smb-browse.c b/packet-smb-browse.c index ad684714ef..409c629e56 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 <rsharpe@ns.aus.com> * - * $Id: packet-smb-browse.c,v 1.25 2003/01/30 04:51:30 tpot Exp $ + * $Id: packet-smb-browse.c,v 1.26 2003/02/17 01:59:39 tpot Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -41,6 +41,7 @@ #include "alignment.h" #include "packet-smb-browse.h" +#include "packet-dcerpc.h" static int proto_smb_browse = -1; static int hf_command = -1; @@ -431,19 +432,18 @@ dissect_election_criterion(tvbuff_t *tvb, proto_tree *parent_tree, int offset) } -/* - * XXX - this causes non-browser packets to have browser fields. - */ -void -dissect_smb_server_type_flags(tvbuff_t *tvb, packet_info *pinfo, - proto_tree *parent_tree, int offset, gboolean infoflag) +int +dissect_smb_server_type_flags(tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *parent_tree, char *drep, + gboolean infoflag) { proto_tree *tree = NULL; proto_item *item = NULL; guint32 flags; int i; - flags = tvb_get_letohl(tvb, offset); + offset = dissect_ndr_uint32( + tvb, offset, pinfo, tree, drep, hf_server_type, &flags); if (parent_tree) { item = proto_tree_add_uint(parent_tree, hf_server_type, tvb, offset, 4, flags); @@ -512,6 +512,7 @@ dissect_smb_server_type_flags(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_boolean(tree, hf_server_type_domainenum, tvb, offset, 4, flags); + return offset; } @@ -563,7 +564,9 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr switch (cmd) { case BROWSE_DOMAIN_ANNOUNCEMENT: case BROWSE_LOCAL_MASTER_ANNOUNCEMENT: - case BROWSE_HOST_ANNOUNCE: + case BROWSE_HOST_ANNOUNCE: { + char drep = 0x10; /* Assume little endian */ + /* update count */ proto_tree_add_item(tree, hf_update_count, tvb, offset, 1, TRUE); offset += 1; @@ -599,8 +602,8 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr offset += 1; /* server type flags */ - dissect_smb_server_type_flags(tvb, pinfo, tree, offset, TRUE); - offset += 4; + offset = dissect_smb_server_type_flags( + tvb, offset, pinfo, tree, &drep, TRUE); if (cmd == BROWSE_DOMAIN_ANNOUNCEMENT) { /* @@ -637,7 +640,7 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr tvb, offset, namelen, TRUE); offset += namelen; break; - + } case BROWSE_REQUEST_ANNOUNCE: { char *computer_name; @@ -768,6 +771,7 @@ dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr guint32 periodicity; const char *host_name; guint namelen; + char drep = 0x10; /* Assume little-endian */ if (!proto_is_protocol_enabled(proto_smb_browse)) { return FALSE; @@ -804,14 +808,14 @@ dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr case BROWSE_DOMAIN_ANNOUNCEMENT: case BROWSE_LOCAL_MASTER_ANNOUNCEMENT: case BROWSE_HOST_ANNOUNCE: + /* update count */ proto_tree_add_item(tree, hf_update_count, tvb, offset, 1, TRUE); offset += 1; /* server type flags */ - dissect_smb_server_type_flags(tvb, pinfo, tree, offset, - hf_server_type); - offset += 4; + offset = dissect_smb_server_type_flags( + tvb, offset, pinfo, tree, &drep, TRUE); /* OS major version */ proto_tree_add_item(tree, hf_os_major, tvb, offset, 1, TRUE); diff --git a/packet-smb-browse.h b/packet-smb-browse.h index dc3a29e4d2..546af5a1b2 100644 --- a/packet-smb-browse.h +++ b/packet-smb-browse.h @@ -2,7 +2,7 @@ * Declaration of routines for SMB Browser packet dissection * Copyright 1999, Richard Sharpe <rsharpe@ns.aus.com> * - * $Id: packet-smb-browse.h,v 1.5 2002/08/28 21:00:31 jmayer Exp $ + * $Id: packet-smb-browse.h,v 1.6 2003/02/17 01:59:39 tpot Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -32,7 +32,9 @@ dissect_mailslot_browse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tr gboolean dissect_mailslot_lanman(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree); -void -dissect_smb_server_type_flags(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, gboolean infoflag); +int +dissect_smb_server_type_flags(tvbuff_t *tvb, int offset, packet_info *pinfo, + proto_tree *parent_tree, char *drep, + gboolean infoflag); #endif diff --git a/packet-smb-pipe.c b/packet-smb-pipe.c index ba85937000..d9c4f0a2ac 100644 --- a/packet-smb-pipe.c +++ b/packet-smb-pipe.c @@ -8,7 +8,7 @@ XXX Fixme : shouldnt show [malformed frame] for long packets * significant rewrite to tvbuffify the dissector, Ronnie Sahlberg and * Guy Harris 2001 * - * $Id: packet-smb-pipe.c,v 1.85 2002/12/19 11:22:35 sahlberg Exp $ + * $Id: packet-smb-pipe.c,v 1.86 2003/02/17 01:59:39 tpot Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -470,8 +470,9 @@ static int add_server_type(tvbuff_t *tvb, int offset, int count _U_, packet_info *pinfo, proto_tree *tree, int convert _U_, int hf_index _U_) { - dissect_smb_server_type_flags(tvb, pinfo, tree, offset, FALSE); - offset += 4; + char drep = 0x10; /* Assume little-endian */ + offset = dissect_smb_server_type_flags( + tvb, offset, pinfo, tree, &drep, FALSE); return offset; } @@ -479,8 +480,9 @@ static int add_server_type_info(tvbuff_t *tvb, int offset, int count _U_, packet_info *pinfo, proto_tree *tree, int convert _U_, int hf_index _U_) { - dissect_smb_server_type_flags(tvb, pinfo, tree, offset, TRUE); - offset += 4; + char drep = 0x10; /* Assume little-endian */ + offset = dissect_smb_server_type_flags( + tvb, offset, pinfo, tree, &drep, TRUE); return offset; } |