The branch, master has been updated via 4b09df8 pidl-wireshark: SWITCH_TYPE is not always defined, SwitchType() will try to find a fallback via 93f262e pidl-wireshark: generate ALIGN_TO_x_BYTES instructions if the element has the align_x flag via 3f6ca43 pidl-wireshark: if the structure has the flag no_align then set also no_align in the dceprc_info structure via f0a6043 pidl-wireshark: handle 8 bits enum and change the signature of enum function to pass the exact type via 49e0dc7 pidl-wireshark: add definition for IPV4/IPV6 types via 725500f pidl-wireshark: adapt to the new comments in the headers of wireshark dissectors from 0fbd854 s3:vfs:aio_pthread: use smbXsrv_connection for schedule_deferred_open_message_smb
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 4b09df897803e78265fd19f6ff19be6e3d8a3944 Author: Matthieu Patou <m...@matws.net> Date: Tue Oct 1 12:10:18 2013 -0700 pidl-wireshark: SWITCH_TYPE is not always defined, SwitchType() will try to find a fallback Pair-Programmed-With: Stefan Metzmacher <me...@samba.org> Signed-off-by: Matthieu Patou <m...@matws.net> Signed-off-by: Stefan Metzmacher <me...@samba.org> Autobuild-User(master): Stefan Metzmacher <me...@samba.org> Autobuild-Date(master): Fri Oct 24 01:39:16 CEST 2014 on sn-devel-104 commit 93f262ee6d162bf007b79d2daf9de6c49c6163d1 Author: Matthieu Patou <m...@matws.net> Date: Fri Oct 18 00:04:28 2013 -0700 pidl-wireshark: generate ALIGN_TO_x_BYTES instructions if the element has the align_x flag Signed-off-by: Matthieu Patou <m...@matws.net> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 3f6ca430b067705d556031d52736d5a5d5ae8f55 Author: Matthieu Patou <m...@matws.net> Date: Fri Oct 11 13:18:37 2013 -0700 pidl-wireshark: if the structure has the flag no_align then set also no_align in the dceprc_info structure Some dissection function will try to do alignment if the no_align flag is not set. Pair-Programmed-With: Stefan Metzmacher <me...@samba.org> Signed-off-by: Matthieu Patou <m...@matws.net> Signed-off-by: Stefan Metzmacher <me...@samba.org> commit f0a6043fb201940f438f63c809df7186aa307f01 Author: Matthieu Patou <m...@matws.net> Date: Sun Oct 5 18:25:27 2014 -0700 pidl-wireshark: handle 8 bits enum and change the signature of enum function to pass the exact type Instead of passing a uint32 in all cases we pass the exact type Pair-Programmed-With: Stefan Metzmacher <me...@samba.org> Change-Id: Ib79f1fa56d5aeb30c6e57eea8f0a48db60f6484d Signed-off-by: Matthieu Patou <m...@matws.net> Signed-off-by: Stefan Metzmacher <me...@samba.org> commit 49e0dc7ad0f3c29df20badacc4294f1adc375aaf Author: Matthieu Patou <m...@matws.net> Date: Fri Oct 25 23:11:37 2013 -0700 pidl-wireshark: add definition for IPV4/IPV6 types Signed-off-by: Matthieu Patou <m...@matws.net> Reviewed-by: Stefan Metzmacher <me...@samba.org> commit 725500fc2815a1b00b08c5dd025055266ac97b5a Author: Matthieu Patou <m...@matws.net> Date: Sun Oct 5 00:06:49 2014 -0700 pidl-wireshark: adapt to the new comments in the headers of wireshark dissectors Change-Id: I4fc398c4d50230d1f0a083827493c1b193c045b9 Signed-off-by: Matthieu Patou <m...@matws.net> Reviewed-by: Stefan Metzmacher <me...@samba.org> ----------------------------------------------------------------------- Summary of changes: pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 112 +++++++++++++++++++++++----------- 1 files changed, 77 insertions(+), 35 deletions(-) Changeset truncated at 500 lines: diff --git a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm index 10eaa6c..89cbf84 100644 --- a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm +++ b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm @@ -150,7 +150,7 @@ sub Enum($$$$) } $self->pidl_hdr("extern const value_string $valsstring\[];"); - $self->pidl_hdr("int $dissectorname(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 *param _U_);"); + $self->pidl_hdr("int $dissectorname(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, int hf_index _U_, g$e->{BASE_TYPE} *param _U_);"); $self->pidl_def("const value_string ".$valsstring."[] = {"); foreach (@{$e->{ELEMENTS}}) { @@ -163,19 +163,19 @@ sub Enum($$$$) $self->pidl_fn_start($dissectorname); $self->pidl_code("int"); - $self->pidl_code("$dissectorname(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 *param _U_)"); + $self->pidl_code("$dissectorname(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *tree _U_, guint8 *drep _U_, int hf_index _U_, g$e->{BASE_TYPE} *param _U_)"); $self->pidl_code("{"); $self->indent; $self->pidl_code("g$e->{BASE_TYPE} parameter=0;"); - $self->pidl_code("if(param){"); + $self->pidl_code("if (param) {"); $self->indent; - $self->pidl_code("parameter=(g$e->{BASE_TYPE})*param;"); + $self->pidl_code("parameter = *param;"); $self->deindent; $self->pidl_code("}"); $self->pidl_code("offset = dissect_ndr_$e->{BASE_TYPE}(tvb, offset, pinfo, tree, drep, hf_index, ¶meter);"); - $self->pidl_code("if(param){"); + $self->pidl_code("if (param) {"); $self->indent; - $self->pidl_code("*param=(guint32)parameter;"); + $self->pidl_code("*param = parameter;"); $self->deindent; $self->pidl_code("}"); $self->pidl_code("return offset;"); @@ -414,6 +414,29 @@ sub ElementLevel($$$$$$$$) } } +sub SwitchType($$;$) +{ + my ($e, $type, $nodiscriminant) = @_; + + my $switch_dt = getType($type); + my $switch_type = undef; + if ($switch_dt->{DATA}->{TYPE} eq "ENUM") { + $switch_type = Parse::Pidl::Typelist::enum_type_fn($switch_dt->{DATA}); + } elsif ($switch_dt->{DATA}->{TYPE} eq "BITMAP") { + $switch_type = Parse::Pidl::Typelist::bitmap_type_fn($switch_dt->{DATA}); + } elsif ($switch_dt->{DATA}->{TYPE} eq "SCALAR") { + if (defined $e->{SWITCH_TYPE}) { + $switch_type = "$e->{SWITCH_TYPE}"; + } else { + $switch_type = "$switch_dt->{DATA}->{NAME}"; + } + } elsif (not defined $e->{SWITCH_TYPE}) { + $switch_type = $nodiscriminant; + } + + return $switch_type +} + sub Element($$$$$) { my ($self,$e,$pn,$ifname,$isoruseswitch) = @_; @@ -426,13 +449,12 @@ sub Element($$$$$) my $type = $isoruseswitch->[0]; my $name = $isoruseswitch->[1]; - my $switch_dt = getType($type); - my $switch_type; - if ($switch_dt->{DATA}->{TYPE} eq "ENUM") { - $switch_type = "g".Parse::Pidl::Typelist::enum_type_fn($switch_dt->{DATA}); - } elsif ($switch_dt->{DATA}->{TYPE} eq "SCALAR") { - $switch_type = "g$e->{SWITCH_TYPE}"; + my $switch_raw_type = SwitchType($e, $type, "uint32"); + if (not defined($switch_raw_type)) { + die("Unknown type[$type]\n"); } + my $switch_type = "g${switch_raw_type}"; + $moreparam = ", $switch_type *".$name; $param = $name; $call_code = "offset = $dissectorname(tvb, offset, pinfo, tree, drep, &$name);"; @@ -462,6 +484,12 @@ sub Element($$$$$) BASE_TYPE => "BASE_NONE" }; } + if (property_matches($e, "flag", ".*LIBNDR_FLAG_ALIGN.*")) { + my $align_flag = $e->{PROPERTIES}->{flag}; + if ($align_flag =~ m/LIBNDR_FLAG_ALIGN(\d+)/) { + $call_code = "ALIGN_TO_$1_BYTES; ".$call_code; + } + } my $hf = $self->register_hf_field("hf_$ifname\_$pn\_$e->{NAME}", field2name($e->{NAME}), "$ifname.$pn.$e->{NAME}", $type->{FT_TYPE}, $type->{BASE_TYPE}, $type->{VALSSTRING}, $type->{MASK}, ""); $self->{hf_used}->{$hf} = 1; @@ -626,13 +654,11 @@ sub Struct($$$$) my $v = $_->{NAME}; if (scalar(grep {/^$v$/} keys(%$varswitchs)) == 1) { # This element is one of the switch attribute - my $switch_dt = getType($_->{TYPE}); - my $switch_type; - if ($switch_dt->{DATA}->{TYPE} eq "ENUM") { - $switch_type = "g".Parse::Pidl::Typelist::enum_type_fn($switch_dt->{DATA}); - } elsif ($switch_dt->{DATA}->{TYPE} eq "SCALAR") { - $switch_type = "g$e->{SWITCH_TYPE}"; + my $switch_raw_type = SwitchType($e, $_->{TYPE}, "uint32"); + if (not defined($switch_raw_type)) { + die("Unknown type[$_->{TYPE}]\n"); } + my $switch_type = "g${switch_raw_type}"; push @$vars, "$switch_type $v;"; $switch_info = [ $_->{TYPE}, $v ]; @@ -647,6 +673,13 @@ sub Struct($$$$) $res.="\t".$self->Element($_, $name, $ifname, $switch_info)."\n\n"; } + my $doalign = undef; + if ($e->{ALIGN} > 1 and not property_matches($e, "flag", ".*LIBNDR_FLAG_NOALIGN.*")) { + $doalign = 1; + } elsif (property_matches($e, "flag", ".*LIBNDR_FLAG_NOALIGN.*")) { + $doalign = 0; + } + $self->pidl_hdr("int $dissectorname(tvbuff_t *tvb _U_, int offset _U_, packet_info *pinfo _U_, proto_tree *parent_tree _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_);"); $self->pidl_fn_start($dissectorname); @@ -657,16 +690,24 @@ sub Struct($$$$) $self->pidl_code($_) foreach (@$vars); $self->pidl_code("proto_item *item = NULL;"); $self->pidl_code("proto_tree *tree = NULL;"); - if ($e->{ALIGN} > 1) { + if (defined($doalign)) { $self->pidl_code("dcerpc_info *di = (dcerpc_info *)pinfo->private_data;"); + if ($doalign == 0) { + $self->pidl_code("gboolean oldalign = di->no_align;"); + } } $self->pidl_code("int old_offset;"); $self->pidl_code(""); - if ($e->{ALIGN} > 1 and not property_matches($e, "flag", ".*LIBNDR_FLAG_NOALIGN.*")) { - $self->pidl_code("ALIGN_TO_$e->{ALIGN}_BYTES;"); + if (defined($doalign)) { + if ($doalign == 1) { + $self->pidl_code("ALIGN_TO_$e->{ALIGN}_BYTES;"); + } + if ($doalign == 0) { + $self->pidl_code("di->no_align = TRUE;"); + } + $self->pidl_code(""); } - $self->pidl_code(""); $self->pidl_code("old_offset = offset;"); $self->pidl_code(""); @@ -680,7 +721,7 @@ sub Struct($$$$) $self->pidl_code("\n$res"); $self->pidl_code("proto_item_set_len(item, offset-old_offset);\n"); - if ($e->{ALIGN} > 1) { + if (defined($doalign) and $doalign == 1) { $self->pidl_code(""); $self->pidl_code("if (di->call_data->flags & DCERPC_IS_NDR64) {"); $self->indent; @@ -688,6 +729,10 @@ sub Struct($$$$) $self->deindent; $self->pidl_code("}"); } + if (defined($doalign) and $doalign == 0) { + $self->pidl_code(""); + $self->pidl_code("di->no_align = oldalign;"); + } $self->pidl_code(""); $self->pidl_code("return offset;"); $self->deindent; @@ -716,15 +761,12 @@ sub Union($$$$) $res.="\t\tbreak;\n"; } - my $switch_type; - my $switch_dissect; - my $switch_dt = getType($e->{SWITCH_TYPE}); - if ($switch_dt->{DATA}->{TYPE} eq "ENUM") { - $switch_type = "g".Parse::Pidl::Typelist::enum_type_fn($switch_dt->{DATA}); - $switch_dissect = "dissect_ndr_" .Parse::Pidl::Typelist::enum_type_fn($switch_dt->{DATA}); - } elsif ($switch_dt->{DATA}->{TYPE} eq "SCALAR") { - $switch_type = "g$e->{SWITCH_TYPE}"; - $switch_dissect = "dissect_ndr_$e->{SWITCH_TYPE}"; + my $switch_type = undef; + my $switch_dissect = undef; + my $switch_raw_type = SwitchType($e, $e->{SWITCH_TYPE}); + if (defined($switch_raw_type)) { + $switch_type = "g${switch_raw_type}"; + $switch_dissect = "dissect_ndr_${switch_raw_type}"; } $self->pidl_fn_start($dissectorname); @@ -1026,6 +1068,8 @@ sub Initialize($$) "offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, \@HF\@, \@PARAM\@);","FT_UINT32", "BASE_DEC", 0, "VALS(WERR_errors)", 4); $self->register_type("NTSTATUS", "offset = PIDL_dissect_uint32(tvb, offset, pinfo, tree, drep, \@HF\@, \@PARAM\@);","FT_UINT32", "BASE_DEC", 0, "VALS(NT_errors)", 4); + $self->register_type("ipv6address", "proto_tree_add_item(tree, \@HF\@, tvb, offset, 16, ENC_NA); offset += 16;", "FT_IPv6", "BASE_NONE", 0, "NULL", 16); + $self->register_type("ipv4address", "proto_tree_add_item(tree, \@HF\@, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4;", "FT_IPv4", "BASE_NONE", 0, "NULL", 4); } @@ -1043,13 +1087,11 @@ sub Parse($$$$$) "/* DO NOT EDIT This filter was automatically generated from $idl_file and $cnf_file. - + Pidl is a perl based IDL compiler for DCE/RPC idl files. It is maintained by the Samba team, not the Wireshark team. Instructions on how to download and install Pidl can be found at http://wiki.wireshark.org/Pidl - - \$Id\$ */ "; -- Samba Shared Repository