aboutsummaryrefslogtreecommitdiffstats
path: root/tools/pidl
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-11-03 12:03:32 -0800
committerGuy Harris <guy@alum.mit.edu>2014-11-03 20:04:02 +0000
commit283b5cd708b701db0af3125c930325cf52c192e2 (patch)
tree5f1f04a3e756ad5247bbc2ef2fe95c8b117af4cb /tools/pidl
parent9299bf48aeda33ff6854c9d4ed34fd7570640cd2 (diff)
if the structure has the flag no_align then set also no_align in the dceprc_info structure
commit 3f6ca430b067705d556031d52736d5a5d5ae8f55 Author: Matthieu Patou <mat@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 <metze@samba.org> Change-Id: Ie2377f4d6c1c4f2fde7084ba666bd417568122dd Reviewed-on: https://code.wireshark.org/review/5098 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'tools/pidl')
-rw-r--r--tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm26
1 files changed, 25 insertions, 1 deletions
diff --git a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
index 61db0284dc..c2d20245f6 100644
--- a/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
+++ b/tools/pidl/lib/Parse/Pidl/Wireshark/NDR.pm
@@ -671,6 +671,13 @@ sub Struct($$$$)
$res.="\t".$self->Element($_, $name, $ifname, $switch_info, %switch_hash)."\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_, dcerpc_info* di _U_, guint8 *drep _U_, int hf_index _U_, guint32 param _U_);");
$self->pidl_fn_start($dissectorname);
@@ -683,6 +690,9 @@ sub Struct($$$$)
if($res) {
$self->pidl_code("proto_tree *tree = NULL;");
}
+ if (defined($doalign) and $doalign == 0) {
+ $self->pidl_code("gboolean oldalign = di->no_align;");
+ }
$self->pidl_code("int old_offset;");
$self->pidl_code("");
@@ -691,6 +701,16 @@ sub Struct($$$$)
}
$self->pidl_code("");
+ 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("old_offset = offset;");
$self->pidl_code("");
$self->pidl_code("if (parent_tree) {");
@@ -705,7 +725,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;
@@ -713,6 +733,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;