diff options
author | Matthieu Patou <mat@matws.net> | 2013-10-11 13:18:37 -0700 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2014-10-23 23:12:05 +0200 |
commit | 3f6ca430b067705d556031d52736d5a5d5ae8f55 (patch) | |
tree | 3f28f98711aed7cc111b523b6571bf8c111a6f65 /pidl | |
parent | f0a6043fb201940f438f63c809df7186aa307f01 (diff) | |
download | samba-3f6ca430b067705d556031d52736d5a5d5ae8f55.tar.gz |
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 <metze@samba.org>
Signed-off-by: Matthieu Patou <mat@matws.net>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'pidl')
-rw-r--r-- | pidl/lib/Parse/Pidl/Wireshark/NDR.pm | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm index 321104fdc3d..6bc03ccd9b9 100644 --- a/pidl/lib/Parse/Pidl/Wireshark/NDR.pm +++ b/pidl/lib/Parse/Pidl/Wireshark/NDR.pm @@ -647,6 +647,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 +664,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 +695,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 +703,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; |