summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicha Reiser <michafamreiser.ch>2015-04-28 14:06:06 +0200
committerMichael Mann <mmann78@netscape.net>2015-04-29 12:52:10 +0000
commitafe07a9b09bfd3951d76922cb78ea9f0b1254b7f (patch)
treee9bfaa4c16757c93df2bb3ac4b741e81a671ffd1
parent41205303a6d957057656d50f63de5bf10c2c35ea (diff)
downloadwireshark-afe07a9b09bfd3951d76922cb78ea9f0b1254b7f.tar.gz
- Mark some DCE/RPC functions as public do allow calls from plugins
- DCOM: * Mark some DCOM functions as public do allow calls from plugins * Add Support for Additional Variant Types Money, I8, UI8 * Fix an uint32 overflow when dissecting nwstringz0 where the length is 0 * Use WS_DLL_PUBLIC instead of WS_DLL_PUBLIC_DEF Change-Id: I02861a09203c6b42326f5a7b7e652e0f7c26d369 Reviewed-on: https://code.wireshark.org/review/8222 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--epan/dissectors/packet-dcerpc-nt.h1
-rw-r--r--epan/dissectors/packet-dcerpc.h4
-rw-r--r--epan/dissectors/packet-dcom.c32
-rw-r--r--epan/dissectors/packet-dcom.h4
-rw-r--r--epan/proto.h2
5 files changed, 37 insertions, 6 deletions
diff --git a/epan/dissectors/packet-dcerpc-nt.h b/epan/dissectors/packet-dcerpc-nt.h
index 40b35d976b..c822db957e 100644
--- a/epan/dissectors/packet-dcerpc-nt.h
+++ b/epan/dissectors/packet-dcerpc-nt.h
@@ -148,6 +148,7 @@ dissect_ndr_lsa_String(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *parent_tree, dcerpc_info *di, guint8 *drep,
guint32 param, int hfindex);
+WS_DLL_PUBLIC
int
dissect_ndr_nt_NTTIME (tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *tree,
diff --git a/epan/dissectors/packet-dcerpc.h b/epan/dissectors/packet-dcerpc.h
index 2bde221123..bd169d57df 100644
--- a/epan/dissectors/packet-dcerpc.h
+++ b/epan/dissectors/packet-dcerpc.h
@@ -251,11 +251,13 @@ WS_DLL_PUBLIC
int dissect_ndr_duint32 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, dcerpc_info *di, guint8 *drep,
int hfindex, guint64 *pdata);
+WS_DLL_PUBLIC
int dissect_ndr_uint64 (tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, dcerpc_info *di, guint8 *drep,
int hfindex, guint64 *pdata);
int PIDL_dissect_uint64 (tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint32 param);
int PIDL_dissect_uint64_val (tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint32 param, guint64 *pval);
+WS_DLL_PUBLIC
int dissect_ndr_float (tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, dcerpc_info *di, guint8 *drep,
int hfindex, gfloat *pdata);
@@ -263,6 +265,8 @@ WS_DLL_PUBLIC
int dissect_ndr_double (tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, dcerpc_info *di, guint8 *drep,
int hfindex, gdouble *pdata);
+
+WS_DLL_PUBLIC
int dissect_ndr_time_t (tvbuff_t *tvb, gint offset, packet_info *pinfo,
proto_tree *tree, dcerpc_info *di, guint8 *drep,
int hfindex, guint32 *pdata);
diff --git a/epan/dissectors/packet-dcom.c b/epan/dissectors/packet-dcom.c
index 63b5602efd..c0fde287e8 100644
--- a/epan/dissectors/packet-dcom.c
+++ b/epan/dissectors/packet-dcom.c
@@ -204,9 +204,11 @@ static int hf_dcom_vt_i1 = -1;
static int hf_dcom_vt_i2 = -1;
static int hf_dcom_vt_i4 = -1;
static int hf_dcom_vt_i8 = -1; /* only inside a SAFEARRAY, not in VARIANTs */
+static int hf_dcom_vt_cy = -1;
static int hf_dcom_vt_ui1 = -1;
static int hf_dcom_vt_ui2 = -1;
static int hf_dcom_vt_ui4 = -1;
+static int hf_dcom_vt_ui8 = -1;
static int hf_dcom_vt_r4 = -1;
static int hf_dcom_vt_r8 = -1;
static int hf_dcom_vt_date = -1;
@@ -1321,6 +1323,8 @@ dissect_dcom_VARIANT(tvbuff_t *tvb, int offset, packet_info *pinfo,
guint8 u8Data;
guint16 u16Data;
guint32 u32Data;
+ guint64 u64Data;
+ gint64 cyData;
gchar cData[500];
guint32 u32Pointer;
gfloat f32Data;
@@ -1391,10 +1395,26 @@ dissect_dcom_VARIANT(tvbuff_t *tvb, int offset, packet_info *pinfo,
offset = dissect_dcom_DWORD(tvb, offset, pinfo, sub_tree, di, drep,
hf_dcom_vt_i4, &u32Data);
break;
+ case(WIRESHARK_VT_I8):
+ offset = dissect_dcom_I8(tvb, offset, pinfo, sub_tree, di, drep,
+ hf_dcom_vt_i8, &u64Data);
+ break;
+ case(WIRESHARK_VT_CY):
+ offset = dissect_dcom_I8(tvb, offset, pinfo, NULL, di, drep,
+ 0, &cyData);
+ proto_tree_add_int64_format(sub_tree, hf_dcom_vt_cy, tvb, offset - 8,
+ 8, cyData, "%s: %" G_GINT64_FORMAT ".%.04" G_GINT64_FORMAT,
+ proto_registrar_get_name(hf_dcom_vt_cy),
+ cyData / 10000, ABS(cyData % 10000));
+ break;
case(WIRESHARK_VT_UI4):
offset = dissect_dcom_DWORD(tvb, offset, pinfo, sub_tree, di, drep,
hf_dcom_vt_ui4, &u32Data);
break;
+ case(WIRESHARK_VT_UI8):
+ offset = dissect_dcom_I8(tvb, offset, pinfo, sub_tree, di, drep,
+ hf_dcom_vt_ui8, &u64Data);
+ break;
case(WIRESHARK_VT_R4):
offset = dissect_dcom_FLOAT(tvb, offset, pinfo, sub_tree, di, drep,
hf_dcom_vt_r4, &f32Data);
@@ -1566,18 +1586,20 @@ dcom_tvb_get_nwstringz0(tvbuff_t *tvb, gint offset, guint32 inLength, gchar *psz
guint32 u32Idx;
guint32 u32IdxA;
guint32 u32IdxW;
+ guint32 inLengthWithoutNullDelimiter = 0;
guint8 u8Tmp1;
guint8 u8Tmp2;
*isPrintable = TRUE;
+ inLengthWithoutNullDelimiter = inLength == 0 ? 0 : inLength -1;
/* we must have at least the space for the zero termination */
DISSECTOR_ASSERT(outLength >= 1);
/* determine length and printablility of the string */
- for(u32Idx = 0; u32Idx < inLength-1; u32Idx+=2) {
+ for(u32Idx = 0; u32Idx < inLengthWithoutNullDelimiter; u32Idx+=2) {
/* the marshalling direction of a WCHAR is fixed! */
u8Tmp1 = tvb_get_guint8(tvb, offset+u32Idx);
u8Tmp2 = tvb_get_guint8(tvb, offset+u32Idx+1);
@@ -1589,8 +1611,9 @@ dcom_tvb_get_nwstringz0(tvbuff_t *tvb, gint offset, guint32 inLength, gchar *psz
}
/* is this character printable? */
+ /* 10 = New Line, 13 = Carriage Return */
/* XXX - there are probably more printable chars than isprint() */
- if(!g_ascii_isprint(u8Tmp1) || u8Tmp2 != 0) {
+ if(!(g_ascii_isprint(u8Tmp1) || u8Tmp1 == 10 || u8Tmp1 == 13)|| u8Tmp2 != 0) {
*isPrintable = FALSE;
}
}
@@ -2198,7 +2221,6 @@ static void dcom_reinit( void) {
return;
}
-
void
proto_register_dcom (void)
{
@@ -2357,12 +2379,16 @@ proto_register_dcom (void)
{ "VT_I4", "dcom.vt.i4", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
{ &hf_dcom_vt_i8,
{ "VT_I8", "dcom.vt.i8", FT_INT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
+ { &hf_dcom_vt_cy,
+ { "VT_CY", "dcom.vt.cy", FT_INT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
{ &hf_dcom_vt_ui1,
{ "VT_UI1", "dcom.vt.ui1", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
{ &hf_dcom_vt_ui2,
{ "VT_UI2", "dcom.vt.ui2", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }},
{ &hf_dcom_vt_ui4,
{ "VT_UI4", "dcom.vt.ui4", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
+ { &hf_dcom_vt_ui8,
+ { "VT_UI8", "dcom.vt.ui8", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }},
{ &hf_dcom_vt_r4,
{ "VT_R4", "dcom.vt.r4", FT_FLOAT, BASE_NONE, NULL, 0x0, NULL, HFILL }},
{ &hf_dcom_vt_r8,
diff --git a/epan/dissectors/packet-dcom.h b/epan/dissectors/packet-dcom.h
index f4826acdba..abab889f1d 100644
--- a/epan/dissectors/packet-dcom.h
+++ b/epan/dissectors/packet-dcom.h
@@ -110,12 +110,12 @@ dissect_dcom_that(tvbuff_t *tvb, int offset,
#define dissect_dcom_DOUBLE dissect_ndr_double
#define dissect_dcom_DATE dissect_ndr_double
-extern int
+WS_DLL_PUBLIC int
dissect_dcom_UUID(tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep,
int hfindex, e_guid_t *uuid);
-extern int
+WS_DLL_PUBLIC int
dissect_dcom_append_UUID(tvbuff_t *tvb, int offset,
packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep,
int hfindex, int field_index, e_guid_t *uuid);
diff --git a/epan/proto.h b/epan/proto.h
index 81e577b9ba..10337db64f 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -2059,7 +2059,7 @@ proto_register_subtree_array(gint *const *indices, const int num_indices);
/** Get name of registered header_field number n.
@param n item # n (0-indexed)
@return the name of this registered item */
-extern const char* proto_registrar_get_name(const int n);
+WS_DLL_PUBLIC const char* proto_registrar_get_name(const int n);
/** Get abbreviation of registered header_field number n.
@param n item # n (0-indexed)