Update dissect_ndr_nt_STRING so it can also accept FT_BYTES and for that type
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 13 Mar 2002 07:38:34 +0000 (07:38 +0000)
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 13 Mar 2002 07:38:34 +0000 (07:38 +0000)
display the data as a hexadecimal string.

Update netlogon so that nt and lm challenge response bytes are displayed
in hexadecimal form and not pseudo-ascii

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

packet-dcerpc-netlogon.c
packet-dcerpc-nt.c

index 9b4065170dda51c50a1ba1bef4f2de250f601dce..ab1bafcad298d90cdc1fe1dc3c830ba08a4d0fd4 100644 (file)
@@ -3,7 +3,7 @@
  * Copyright 2001, Tim Potter <tpot@samba.org>
  *  2002 structure and command dissectors by Ronnie Sahlberg
  *
- * $Id: packet-dcerpc-netlogon.c,v 1.3 2002/03/12 08:16:41 sahlberg Exp $
+ * $Id: packet-dcerpc-netlogon.c,v 1.4 2002/03/13 07:38:33 sahlberg Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -5247,11 +5247,11 @@ static hf_register_info hf[] = {
                NULL, 0x0, "", HFILL }},
 
        { &hf_netlogon_nt_chal_resp,
-               { "NT Chal resp", "netlogon.nt_chal_resp", FT_STRING, BASE_NONE,
+               { "NT Chal resp", "netlogon.nt_chal_resp", FT_BYTES, BASE_HEX,
                NULL, 0, "Challenge response for NT authentication", HFILL }},
 
        { &hf_netlogon_lm_chal_resp,
-               { "LM Chal resp", "netlogon.lm_chal_resp", FT_STRING, BASE_NONE,
+               { "LM Chal resp", "netlogon.lm_chal_resp", FT_BYTES, BASE_HEX,
                NULL, 0, "Challenge response for LM authentication", HFILL }},
 
        { &hf_netlogon_acct_name,
index c5c4533fdb74b2fa65ce47aa1117fcd3e03db7ca..5cdc91b30dd21aab9187d87a6657a42034bd5a34 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for DCERPC over SMB packet disassembly
  * Copyright 2001, Tim Potter <tpot@samba.org>
  *
- * $Id: packet-dcerpc-nt.c,v 1.14 2002/03/12 08:16:41 sahlberg Exp $
+ * $Id: packet-dcerpc-nt.c,v 1.15 2002/03/13 07:38:34 sahlberg Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -567,16 +567,35 @@ dissect_ndr_nt_STRING_string (tvbuff_t *tvb, int offset,
                                      hf_nt_str_max_len, &max_len);
 
        old_offset=offset;
-       offset = prs_uint8s(tvb, offset, pinfo, tree, max_len, &text, NULL);
-
        hfi = proto_registrar_get_nth(di->hf_index);
-       proto_tree_add_string_format(tree, di->hf_index, 
-               tvb, old_offset, offset-old_offset,
-               text, "%s: %s", hfi->name, text);
 
-       if(tree){
-               proto_item_set_text(tree, "%s: %s", hfi->name, text);
-               proto_item_set_text(tree->parent, "%s: %s", hfi->name, text);
+       switch(hfi->type){
+       case FT_STRING:
+               offset = prs_uint8s(tvb, offset, pinfo, tree, max_len, &text, NULL);
+               proto_tree_add_string_format(tree, di->hf_index, 
+                       tvb, old_offset, offset-old_offset,
+                       text, "%s: %s", hfi->name, text);
+               break;
+       case FT_BYTES:
+               text="";
+               proto_tree_add_item(tree, di->hf_index, tvb, offset, max_len, FALSE);
+               offset += max_len;
+               break;
+       default:
+               g_assert_not_reached();
+       }
+
+       if(tree && (di->levels>-1)){
+               proto_item_append_text(tree, ": %s", text);
+               if(di->levels>-1){
+                       tree=tree->parent;
+                       proto_item_append_text(tree, ": %s", text);
+                       while(di->levels>0){
+                               tree=tree->parent;
+                               proto_item_append_text(tree, " %s", text);
+                               di->levels--;
+                       }
+               }
        }
        return offset;
 }
@@ -590,6 +609,7 @@ dissect_ndr_nt_STRING (tvbuff_t *tvb, int offset,
        proto_tree *tree=NULL;
        int old_offset=offset;
        dcerpc_info *di;
+       char *name;
 
        ALIGN_TO_4_BYTES;  /* strcture starts with short, but is aligned for longs */
 
@@ -599,9 +619,10 @@ dissect_ndr_nt_STRING (tvbuff_t *tvb, int offset,
                return offset;
        }
 
+       name = proto_registrar_get_name(hf_index);
        if(parent_tree){
-               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
-                       "string");
+               item = proto_tree_add_text(parent_tree, tvb, offset, -1,
+                       "%s", name);
                tree = proto_item_add_subtree(item, ett_nt_unicode_string);
        }
 
@@ -611,7 +632,7 @@ dissect_ndr_nt_STRING (tvbuff_t *tvb, int offset,
                                      hf_nt_string_size, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
                        dissect_ndr_nt_STRING_string, NDR_POINTER_UNIQUE,
-                       "", hf_index, levels);
+                       name, hf_index, levels);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;