Dissect the server type bitfield in NetServerGetInfo for SERVER_INFO_101
authortpot <tpot@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 17 Feb 2003 01:59:39 +0000 (01:59 +0000)
committertpot <tpot@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 17 Feb 2003 01:59:39 +0000 (01:59 +0000)
and SERVER_INFO_102.

Modify all callers to use the new interface.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@7158 f5534014-38df-0310-8fa8-9805f1628bb7

packet-dcerpc-srvsvc.c
packet-smb-browse.c
packet-smb-browse.h
packet-smb-pipe.c

index 70241e42e67570acc08619b212f97a9d13f4ed92..f3d0d642b09e781aa701ed5897c2f977424219ed 100644 (file)
@@ -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}},
index ad684714efb0a78bcfe33f00bcddb84f3a2f62df..409c629e56ca49ae3cb1ef365b32eb57eb32577a 100644 (file)
@@ -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);
index dc3a29e4d2312161b8f20d8f44754e156a904d53..546af5a1b266b048c99df3d383fa197c62b1c18f 100644 (file)
@@ -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
index ba859370005c079319cf8fadb1e46d8ce123ac33..d9c4f0a2ac59ef4048fdad1bef4accc224f4bcd9 100644 (file)
@@ -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;
 }