Final patch in preparing for NETLOGON dissector.
authorsahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 11 Mar 2002 00:28:21 +0000 (00:28 +0000)
committersahlberg <sahlberg@f5534014-38df-0310-8fa8-9805f1628bb7>
Mon, 11 Mar 2002 00:28:21 +0000 (00:28 +0000)
Exported some functions from packet-dcerpc-samr.c and added two
more functions the netlogon dissector will need.

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

packet-dcerpc-nt.h
packet-dcerpc-samr.c

index f72568eb9296436008222c2162bed1d8bcb0f3df..d1af9aa1065120c945d1bf82f1eb00a6c4051eec 100644 (file)
@@ -2,7 +2,7 @@
  * Routines for DCERPC over SMB packet disassembly
  * Copyright 2001, Tim Potter <tpot@samba.org>
  *
- * $Id: packet-dcerpc-nt.h,v 1.10 2002/03/11 00:15:20 sahlberg Exp $
+ * $Id: packet-dcerpc-nt.h,v 1.11 2002/03/11 00:28:21 sahlberg Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -103,6 +103,28 @@ int
 dissect_ndr_nt_LOGON_HOURS(tvbuff_t *tvb, int offset, 
                        packet_info *pinfo, proto_tree *parent_tree,
                        char *drep);
+int
+dissect_ndr_nt_SID(tvbuff_t *tvb, int offset, 
+                       packet_info *pinfo, proto_tree *tree, 
+                       char *drep);
+int
+dissect_ndr_nt_PSID(tvbuff_t *tvb, int offset, 
+                             packet_info *pinfo, proto_tree *parent_tree,
+                             char *drep);
+int
+dissect_ndr_nt_PSID_ARRAY(tvbuff_t *tvb, int offset, 
+                       packet_info *pinfo, proto_tree *parent_tree,
+                       char *drep);
+
+int
+dissect_ndr_nt_SID_AND_ATTRIBUTES_ARRAY(tvbuff_t *tvb, int offset, 
+                       packet_info *pinfo, proto_tree *parent_tree,
+                       char *drep);
+int
+dissect_ndr_nt_SID_AND_ATTRIBUTES(tvbuff_t *tvb, int offset, 
+                       packet_info *pinfo, proto_tree *parent_tree,
+                       char *drep);
+
 
 
 #endif /* packet-dcerpc-nt.h */
index 24cb2b14b1fc6ea42a14fc2fb1ba0a92686e95fb..edaa7bad4c3e5aadc1ebb45dd93575b2d4a361bf 100644 (file)
@@ -3,7 +3,7 @@
  * Copyright 2001, Tim Potter <tpot@samba.org>
  *   2002 Added all command dissectors  Ronnie Sahlberg
  *
- * $Id: packet-dcerpc-samr.c,v 1.23 2002/03/11 00:15:20 sahlberg Exp $
+ * $Id: packet-dcerpc-samr.c,v 1.24 2002/03/11 00:28:21 sahlberg Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -180,6 +180,8 @@ static gint ett_samr_member_array = -1;
 static gint ett_samr_names = -1;
 static gint ett_samr_rids = -1;
 static gint ett_nt_acct_ctrl = -1;
+static gint ett_samr_sid_and_attributes_array = -1;
+static gint ett_samr_sid_and_attributes = -1;
 
 
 static e_uuid_t uuid_dcerpc_samr = {
@@ -190,8 +192,8 @@ static e_uuid_t uuid_dcerpc_samr = {
 static guint16 ver_dcerpc_samr = 1;
 
 
-static int
-samr_dissect_SID(tvbuff_t *tvb, int offset, 
+int
+dissect_ndr_nt_SID(tvbuff_t *tvb, int offset, 
                        packet_info *pinfo, proto_tree *tree, 
                        char *drep)
 {
@@ -213,12 +215,12 @@ samr_dissect_SID(tvbuff_t *tvb, int offset,
 }
 
 static int
-samr_dissect_SID_ptr(tvbuff_t *tvb, int offset, 
+dissect_ndr_nt_SID_ptr(tvbuff_t *tvb, int offset, 
                        packet_info *pinfo, proto_tree *tree, 
                        char *drep)
 {
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-                       samr_dissect_SID, NDR_POINTER_UNIQUE,
+                       dissect_ndr_nt_SID, NDR_POINTER_UNIQUE,
                        "SID pointer", -1, 1);
        return offset;
 }
@@ -995,7 +997,7 @@ samr_dissect_open_domain_rqst(tvbuff_t *tvb, int offset,
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_access, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-                       samr_dissect_SID, NDR_POINTER_REF,
+                       dissect_ndr_nt_SID, NDR_POINTER_REF,
                        "", -1, 0);
        return offset;
 }
@@ -1022,7 +1024,7 @@ samr_dissect_context_handle_SID(tvbuff_t *tvb, int offset,
         offset = dissect_ndr_ctx_hnd (tvb, offset, pinfo, tree, drep,
                                       hf_samr_hnd, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-                       samr_dissect_SID, NDR_POINTER_REF,
+                       dissect_ndr_nt_SID, NDR_POINTER_REF,
                        "SID", -1, 0);
        return offset;
 }
@@ -1863,15 +1865,15 @@ samr_dissect_lookup_domain_reply(tvbuff_t *tvb, int offset,
                              char *drep)
 {
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-                       samr_dissect_SID_ptr, NDR_POINTER_REF,
+                       dissect_ndr_nt_SID_ptr, NDR_POINTER_REF,
                        "", -1, 0);
         offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                                      hf_samr_rc, NULL);
        return offset;
 }
 
-static int
-samr_dissect_PSID(tvbuff_t *tvb, int offset, 
+int
+dissect_ndr_nt_PSID(tvbuff_t *tvb, int offset, 
                              packet_info *pinfo, proto_tree *parent_tree,
                              char *drep)
 {
@@ -1886,7 +1888,7 @@ samr_dissect_PSID(tvbuff_t *tvb, int offset,
        }
 
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-                       samr_dissect_SID, NDR_POINTER_UNIQUE,
+                       dissect_ndr_nt_SID, NDR_POINTER_UNIQUE,
                        "SID", -1, 0);
 
        proto_item_set_len(item, offset-old_offset);
@@ -1895,19 +1897,19 @@ samr_dissect_PSID(tvbuff_t *tvb, int offset,
 
 
 static int
-samr_dissect_PSID_ARRAY_sids (tvbuff_t *tvb, int offset, 
+dissect_ndr_nt_PSID_ARRAY_sids (tvbuff_t *tvb, int offset, 
                              packet_info *pinfo, proto_tree *tree,
                              char *drep)
 {
        offset = dissect_ndr_ucarray(tvb, offset, pinfo, tree, drep,
-                       samr_dissect_PSID);
+                       dissect_ndr_nt_PSID);
 
        return offset;
 }
 
 
-static int
-samr_dissect_PSID_ARRAY(tvbuff_t *tvb, int offset, 
+int
+dissect_ndr_nt_PSID_ARRAY(tvbuff_t *tvb, int offset, 
                        packet_info *pinfo, proto_tree *parent_tree,
                        char *drep)
 {
@@ -1925,13 +1927,63 @@ samr_dissect_PSID_ARRAY(tvbuff_t *tvb, int offset,
        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
                        hf_samr_count, &count);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-                       samr_dissect_PSID_ARRAY_sids, NDR_POINTER_UNIQUE,
+                       dissect_ndr_nt_PSID_ARRAY_sids, NDR_POINTER_UNIQUE,
                        "PSID_ARRAY", -1, 0);
 
        proto_item_set_len(item, offset-old_offset);
        return offset;
 }
 
+/* called from NETLOGON but placed here since where are where the hf_fields are defined */
+int
+dissect_ndr_nt_SID_AND_ATTRIBUTES(tvbuff_t *tvb, int offset, 
+                       packet_info *pinfo, proto_tree *parent_tree,
+                       char *drep)
+{
+       proto_item *item=NULL;
+       proto_tree *tree=NULL;
+       int old_offset=offset;
+
+       if(parent_tree){
+               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
+                       "SID_AND_ATTRIBUTES:");
+               tree = proto_item_add_subtree(item, ett_samr_sid_and_attributes);
+       }
+
+       offset = dissect_ndr_nt_PSID(tvb, offset, pinfo, tree, drep);
+
+        offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
+                                     hf_samr_attrib, NULL);
+
+       return offset;
+}
+
+int
+dissect_ndr_nt_SID_AND_ATTRIBUTES_ARRAY(tvbuff_t *tvb, int offset, 
+                       packet_info *pinfo, proto_tree *parent_tree,
+                       char *drep)
+{
+       guint32 count;
+       proto_item *item=NULL;
+       proto_tree *tree=NULL;
+       int old_offset=offset;
+
+       if(parent_tree){
+               item = proto_tree_add_text(parent_tree, tvb, offset, 0,
+                       "SID_AND_ATTRIBUTES array:");
+               tree = proto_item_add_subtree(item, ett_samr_sid_and_attributes_array);
+       }
+
+       offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, drep,
+                       hf_samr_count, &count);
+       offset = dissect_ndr_ucarray(tvb, offset, pinfo, tree, drep,
+                       dissect_ndr_nt_SID_AND_ATTRIBUTES);
+
+       proto_item_set_len(item, offset-old_offset);
+       return offset;
+}
+
+
 static int
 samr_dissect_index(tvbuff_t *tvb, int offset, 
                              packet_info *pinfo, proto_tree *tree,
@@ -2018,7 +2070,7 @@ samr_dissect_get_alias_membership_rqst(tvbuff_t *tvb, int offset,
         offset = dissect_ndr_ctx_hnd (tvb, offset, pinfo, tree, drep,
                                       hf_samr_hnd, NULL);
         offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-                       samr_dissect_PSID_ARRAY, NDR_POINTER_REF,
+                       dissect_ndr_nt_PSID_ARRAY, NDR_POINTER_REF,
                        "", -1, 0);
        return offset;
 }
@@ -2036,7 +2088,6 @@ samr_dissect_get_alias_membership_reply(tvbuff_t *tvb, int offset,
        return offset;
 }
 
-
 static int
 samr_dissect_IDX_AND_NAME(tvbuff_t *tvb, int offset, 
                              packet_info *pinfo, proto_tree *parent_tree,
@@ -2230,7 +2281,7 @@ samr_dissect_get_members_in_alias_reply(tvbuff_t *tvb, int offset,
                        char *drep)
 {
        offset = dissect_ndr_pointer(tvb, offset, pinfo, tree, drep,
-                       samr_dissect_PSID_ARRAY, NDR_POINTER_REF,
+                       dissect_ndr_nt_PSID_ARRAY, NDR_POINTER_REF,
                        "", -1, 0);
        offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep,
                        hf_samr_rc, NULL);
@@ -3833,6 +3884,8 @@ proto_register_dcerpc_samr(void)
                 &ett_samr_member_array,
                 &ett_samr_names,
                 &ett_samr_rids,
+                &ett_samr_sid_and_attributes_array,
+                &ett_samr_sid_and_attributes,
 
                 &ett_nt_acct_ctrl,
         };