aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-02-16 11:31:56 +0000
committerRonnie Sahlberg <ronnie_sahlberg@ozemail.com.au>2005-02-16 11:31:56 +0000
commitd525ccb6f97161f3f8d621d96d04a635b36dd5bd (patch)
tree5ab4829bb31604ab60d8a0aaedf1759fa3f43dc1 /epan
parent8851ebc5411affd371e81e8410539ae5cf49810c (diff)
preparations for autogenerated ms dcerpc interfaces
make it possible to prettify SIDs and control how and where their string representation should be shown in the summary line and the tree similar to how counted_strings prettification can be controlled svn path=/trunk/; revision=13413
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-dcerpc-nt.c55
-rw-r--r--epan/dissectors/packet-dcerpc-nt.h4
2 files changed, 58 insertions, 1 deletions
diff --git a/epan/dissectors/packet-dcerpc-nt.c b/epan/dissectors/packet-dcerpc-nt.c
index ab6112bf5d..b559549244 100644
--- a/epan/dissectors/packet-dcerpc-nt.c
+++ b/epan/dissectors/packet-dcerpc-nt.c
@@ -1,3 +1,6 @@
+/* TODO:
+ dissect_ndr_nt_SID_with_options see comment.
+*/
/* packet-dcerpc-nt.c
* Routines for DCERPC over SMB packet disassembly
* Copyright 2001-2003, Tim Potter <tpot@samba.org>
@@ -1144,7 +1147,7 @@ dissect_ndr_nt_SID(tvbuff_t *tvb, int offset, packet_info *pinfo,
{
dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
- char *sid_str;
+ char *sid_str=NULL;
char *name;
if(di->hf_index!=-1){
@@ -1176,6 +1179,56 @@ dissect_ndr_nt_SID(tvbuff_t *tvb, int offset, packet_info *pinfo,
return offset;
}
+/* same as dissect_ndr_nt_SID() but takes the same options as counted strings
+ do to prettify the dissect pane and the COL_INFO summary line
+*/
+int
+dissect_ndr_nt_SID_with_options(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, guint32 options)
+{
+ dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
+ dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data;
+ gint levels = CB_STR_ITEM_LEVELS(options);
+ offset=dissect_ndr_nt_SID(tvb, offset, pinfo, tree, drep);
+
+ if(dcv && dcv->private_data){
+ char *s=dcv->private_data;
+ proto_item *item=(proto_item *)tree;
+
+ if ((options & CB_STR_COL_INFO)&&(!di->conformant_run)) {
+ /* kludge, ugly, but this is called twice for all
+ dcerpc interfaces due to how we chase pointers
+ and putting the sid twice on the summary line
+ looks even worse.
+ Real solution would be to block updates to col_info
+ while we just do a conformance run, this might
+ have sideeffects so it needs some more thoughts first.
+ */
+ if (check_col(pinfo->cinfo, COL_INFO))
+ col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", s);
+ }
+
+ /* Append string to upper-level proto_items */
+
+ if (levels > 0 && item && s && s[0]) {
+ proto_item_append_text(item, ": %s", s);
+ item = item->parent;
+ levels--;
+ if (levels > 0) {
+ proto_item_append_text(item, ": %s", s);
+ item = item->parent;
+ levels--;
+ while (levels > 0) {
+ proto_item_append_text(item, " %s", s);
+ item = item->parent;
+ levels--;
+ }
+ }
+ }
+ }
+
+ return offset;
+}
+
static int
dissect_ndr_nt_SID_hf_through_ptr(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, guint8 *drep)
diff --git a/epan/dissectors/packet-dcerpc-nt.h b/epan/dissectors/packet-dcerpc-nt.h
index 6c54a57786..ab10093448 100644
--- a/epan/dissectors/packet-dcerpc-nt.h
+++ b/epan/dissectors/packet-dcerpc-nt.h
@@ -128,6 +128,10 @@ dissect_ndr_nt_SID(tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *tree,
guint8 *drep);
int
+dissect_ndr_nt_SID_with_options(tvbuff_t *tvb, int offset,
+ packet_info *pinfo, proto_tree *tree,
+ guint8 *drep, guint32 options);
+int
dissect_ndr_nt_PSID(tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *parent_tree,
guint8 *drep);