From 64e08fef16001d62b43f6925a26ad739391cface Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 29 Sep 2009 17:47:54 +1000 Subject: pidl: added union padding for NDR64 This fixes the problem with samr UserInfo16 when NDR64 is enabled --- pidl/lib/Parse/Pidl/NDR.pm | 11 +++++++++-- pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm | 8 ++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'pidl') diff --git a/pidl/lib/Parse/Pidl/NDR.pm b/pidl/lib/Parse/Pidl/NDR.pm index 7aebed0fe24..4f2578e72e4 100644 --- a/pidl/lib/Parse/Pidl/NDR.pm +++ b/pidl/lib/Parse/Pidl/NDR.pm @@ -509,7 +509,8 @@ sub ParseUnion($$) ELEMENTS => undef, PROPERTIES => $e->{PROPERTIES}, HAS_DEFAULT => $hasdefault, - ORIGINAL => $e + ORIGINAL => $e, + ALIGN => undef } unless defined($e->{ELEMENTS}); CheckPointerTypes($e, $pointer_default); @@ -533,6 +534,11 @@ sub ParseUnion($$) push @elements, $t; } + my $align = undef; + if ($e->{NAME}) { + $align = align_type($e->{NAME}); + } + return { TYPE => "UNION", NAME => $e->{NAME}, @@ -540,7 +546,8 @@ sub ParseUnion($$) ELEMENTS => \@elements, PROPERTIES => $e->{PROPERTIES}, HAS_DEFAULT => $hasdefault, - ORIGINAL => $e + ORIGINAL => $e, + ALIGN => $align }; } diff --git a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm index 62e38bf7e98..9a02d522a9b 100644 --- a/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm +++ b/pidl/lib/Parse/Pidl/Samba4/NDR/Parser.pm @@ -1644,6 +1644,10 @@ sub ParseUnionPushPrimitives($$$$) $self->pidl("NDR_CHECK(ndr_push_$e->{SWITCH_TYPE}($ndr, NDR_SCALARS, level));"); } + if (defined($e->{ALIGN})) { + $self->pidl("NDR_CHECK(ndr_push_union_align($ndr, $e->{ALIGN}));"); + } + $self->pidl("switch (level) {"); $self->indent; foreach my $el (@{$e->{ELEMENTS}}) { @@ -1788,6 +1792,10 @@ sub ParseUnionPullPrimitives($$$$$) $self->pidl("}"); } + if (defined($e->{ALIGN})) { + $self->pidl("NDR_CHECK(ndr_pull_union_align($ndr, $e->{ALIGN}));"); + } + $self->pidl("switch (level) {"); $self->indent; foreach my $el (@{$e->{ELEMENTS}}) { -- cgit v1.2.1