Fixed bug in dissect_ndr_pointer(). Top level Unique and Full pointers are
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 6 Mar 2002 08:28:57 +0000 (08:28 +0000)
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 6 Mar 2002 08:28:57 +0000 (08:28 +0000)
not encoded in the same way in the NDR representation.

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

packet-dcerpc.c

index 6a41c69b621c0bb2f01d4a33cc440a781365bd88..90c9df8b6743152033043391fe6e6645567e5cc5 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for DCERPC packet disassembly
  * Copyright 2001, Todd Sabin <tas@webspan.net>
  *
- * $Id: packet-dcerpc.c,v 1.35 2002/02/13 04:12:42 guy Exp $
+ * $Id: packet-dcerpc.c,v 1.36 2002/03/06 08:28:57 sahlberg Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -706,9 +706,8 @@ dissect_ndr_pointer(tvbuff_t *tvb, gint offset, packet_info *pinfo,
        }
 
        /*TOP LEVEL FULL POINTER*/
-       /*TOP LEVEL UNIQUE POINTER*/
        if( pointers_are_top_level
-       && ((type==NDR_POINTER_PTR)||(type==NDR_POINTER_UNIQUE)) ){
+       && (type==NDR_POINTER_PTR) ){
                int idx;
                guint32 id;
                proto_item *item;
@@ -730,7 +729,7 @@ dissect_ndr_pointer(tvbuff_t *tvb, gint offset, packet_info *pinfo,
                /* we have seen this pointer before */
                if(idx>=0){
                        proto_tree_add_text(tree, tvb, offset-4, 4,
-                               "(duplicate) %s",text);
+                               "(duplicate PTR) %s",text);
                        goto after_ref_id;
                }
 
@@ -742,6 +741,32 @@ dissect_ndr_pointer(tvbuff_t *tvb, gint offset, packet_info *pinfo,
                add_pointer_to_list(pinfo, tr, fnct, id, hf_index, levels);
                goto after_ref_id;
        }
+       /*TOP LEVEL UNIQUE POINTER*/
+       if( pointers_are_top_level
+       && (type==NDR_POINTER_UNIQUE) ){
+               int idx;
+               guint32 id;
+               proto_item *item;
+               proto_tree *tr;
+
+               /* get the referent id */
+               offset = dissect_ndr_uint32(tvb, offset, pinfo, NULL, drep, -1, &id);
+       
+               /* we got a NULL pointer */
+               if(id==0){
+                       proto_tree_add_text(tree, tvb, offset-4, 4,
+                               "(NULL pointer)%s",text);
+                       goto after_ref_id;
+               }
+
+               /* new pointer */
+               item=proto_tree_add_text(tree, tvb, offset-4, 4, 
+                       "%s", text);
+               tr=proto_item_add_subtree(item,ett_dcerpc_pointer_data);
+               proto_tree_add_uint(tr, hf_dcerpc_referent_id, tvb, offset-4, 4, id);
+               add_pointer_to_list(pinfo, tr, fnct, 0xffffffff, hf_index, levels);
+               goto after_ref_id;
+       }
 
        /*EMBEDDED REFERENCE POINTER*/
        if( (!pointers_are_top_level)
@@ -812,7 +837,8 @@ dissect_ndr_pointer(tvbuff_t *tvb, gint offset, packet_info *pinfo,
 
                /* we have seen this pointer before */
                if(idx>=0){
-                       proto_tree_add_uint(tree, hf_dcerpc_referent_id, tvb, offset-4, 4, id);
+                       proto_tree_add_text(tree, tvb, offset-4, 4,
+                               "(duplicate PTR) %s",text);
                        goto after_ref_id;
                }