From 28ec9c29ea079805d5605f43cc8177198f4d6ffc Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Fri, 26 Sep 2014 23:29:43 +0200 Subject: [PATCH] PIDL (DCERPC winreg): enhance dissector * Fix PIDL generator for NOEMIT Element (fix -Wunused-function for DCERPC winreg dissector) * Fix indent (use tabs) * Remove DCERPC winreg dissector from DIRTY list Change-Id: I5d16cbfe8481a5e5f7e5df9b51735c93ae4375a7 Reviewed-on: https://code.wireshark.org/review/4322 Reviewed-by: Michael Mann --- epan/CMakeLists.txt | 3 ++- epan/dissectors/Makefile.common | 6 ++++-- epan/dissectors/packet-dcerpc-winreg.c | 18 +++--------------- epan/dissectors/pidl/winreg.cnf | 9 +++------ tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 1 + 5 files changed, 13 insertions(+), 24 deletions(-) diff --git a/epan/CMakeLists.txt b/epan/CMakeLists.txt index 4ea6588753..e938f87b73 100644 --- a/epan/CMakeLists.txt +++ b/epan/CMakeLists.txt @@ -174,6 +174,7 @@ set(PIDL_DISSECTOR_SRC dissectors/packet-dcerpc-nspi.c dissectors/packet-dcerpc-rfr.c dissectors/packet-dcerpc-srvsvc.c + dissectors/packet-dcerpc-winreg.c dissectors/packet-dcerpc-wkssvc.c dissectors/packet-dcerpc-wzcsvc.c ) @@ -185,7 +186,7 @@ set(DIRTY_PIDL_DISSECTOR_SRC dissectors/packet-dcerpc-mapi.c dissectors/packet-dcerpc-mdssvc.c dissectors/packet-dcerpc-misc.c - dissectors/packet-dcerpc-winreg.c + ) set(ASN1_DISSECTOR_SRC dissectors/packet-acp133.c diff --git a/epan/dissectors/Makefile.common b/epan/dissectors/Makefile.common index f39fa9f818..9caa41f888 100644 --- a/epan/dissectors/Makefile.common +++ b/epan/dissectors/Makefile.common @@ -55,9 +55,11 @@ PIDL_DISSECTOR_SRC = \ packet-dcerpc-nspi.c \ packet-dcerpc-rfr.c \ packet-dcerpc-srvsvc.c \ + packet-dcerpc-winreg.c \ packet-dcerpc-wkssvc.c \ packet-dcerpc-wzcsvc.c + # # PIDL-generated DCE RPC dissectors with warnings. # @@ -69,8 +71,8 @@ DIRTY_PIDL_DISSECTOR_SRC = \ packet-dcerpc-lsa.c \ packet-dcerpc-mapi.c \ packet-dcerpc-mdssvc.c \ - packet-dcerpc-misc.c \ - packet-dcerpc-winreg.c + packet-dcerpc-misc.c + # # Headers for PIDL-generated dissectors. diff --git a/epan/dissectors/packet-dcerpc-winreg.c b/epan/dissectors/packet-dcerpc-winreg.c index 41f2e37e82..abb84f9715 100644 --- a/epan/dissectors/packet-dcerpc-winreg.c +++ b/epan/dissectors/packet-dcerpc-winreg.c @@ -243,7 +243,6 @@ static int winreg_dissect_element_String_name(tvbuff_t *tvb _U_, int offset _U_, static int winreg_dissect_element_String_name_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_); static int winreg_dissect_element_KeySecurityData_data(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_); static int winreg_dissect_element_KeySecurityData_data_(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_); -static int winreg_dissect_element_KeySecurityData_data__(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_); static int winreg_dissect_element_KeySecurityData_size(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_); static int winreg_dissect_element_KeySecurityData_len(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_); static int winreg_dissect_element_SecBuf_length(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_); @@ -598,12 +597,9 @@ winreg_dissect_element_KeySecurityData_data_(tvbuff_t *tvb, int offset, packet_i return offset; } /* this is a varying and conformant array */ - offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, di, drep, - hf_winreg_sd_max_size, NULL); - offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, di, drep, - hf_winreg_sd_offset, NULL); - offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, di, drep, - hf_winreg_sd_actual_size, &len); + offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, di, drep, hf_winreg_sd_max_size, NULL); + offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, di, drep, hf_winreg_sd_offset, NULL); + offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, di, drep, hf_winreg_sd_actual_size, &len); dissect_nt_sec_desc(tvb, offset, pinfo, tree, drep, TRUE, len, &winreg_access_mask_info); offset += len; @@ -782,14 +778,6 @@ winreg_dissect_element_KeySecurityData_data(tvbuff_t *tvb _U_, int offset _U_, p return offset; } -static int -winreg_dissect_element_KeySecurityData_data__(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_) -{ - offset = PIDL_dissect_uint8(tvb, offset, pinfo, tree, di, drep, hf_winreg_KeySecurityData_data, 0); - - return offset; -} - static int winreg_dissect_element_KeySecurityData_size(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_) { diff --git a/epan/dissectors/pidl/winreg.cnf b/epan/dissectors/pidl/winreg.cnf index 2e8a603037..eb658d3b1a 100644 --- a/epan/dissectors/pidl/winreg.cnf +++ b/epan/dissectors/pidl/winreg.cnf @@ -166,12 +166,9 @@ winreg_dissect_element_KeySecurityData_data_(tvbuff_t *tvb, int offset, packet_i } /* this is a varying and conformant array */ - offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, di, drep, - hf_winreg_sd_max_size, NULL); - offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, di, drep, - hf_winreg_sd_offset, NULL); - offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, di, drep, - hf_winreg_sd_actual_size, &len); + offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, di, drep, hf_winreg_sd_max_size, NULL); + offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, di, drep, hf_winreg_sd_offset, NULL); + offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, di, drep, hf_winreg_sd_actual_size, &len); dissect_nt_sec_desc(tvb, offset, pinfo, tree, drep, TRUE, len, &winreg_access_mask_info); diff --git a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm index 010d4392a1..ca34af34e0 100644 --- a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm +++ b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm @@ -483,6 +483,7 @@ sub Element($$$$$$) } } next if ($_->{TYPE} eq "SWITCH"); + next if (defined($self->{conformance}->{noemit}->{"$dissectorname$add"})); $self->pidl_def("static int $dissectorname$add(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, dcerpc_info* di _U_, guint8 *drep _U_$moreparam);"); $self->pidl_fn_start("$dissectorname$add"); $self->pidl_code("static int");