1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-23 09:57:40 +03:00

pidl:Samba4/NDR/Parser: fix NDR64 union alignment

We need to align before the switch_type and before the
union arms. Both alignments are to the boundary of the largest
possible union arm.

This means that adding a new union arm with a larger alignment
would break compat!!!

metze

Autobuild-User: Stefan Metzmacher <metze@samba.org>
Autobuild-Date: Sun Oct 24 17:49:23 UTC 2010 on sn-devel-104
This commit is contained in:
Stefan Metzmacher 2010-08-16 17:35:50 +02:00
parent fd628e7ae4
commit 482c022840

View File

@ -1688,6 +1688,10 @@ sub ParseUnionPushPrimitives($$$$)
$self->pidl("uint32_t level = ndr_push_get_switch_value($ndr, $varname);");
if (defined($e->{ALIGN})) {
$self->pidl("NDR_CHECK(ndr_push_union_align($ndr, $e->{ALIGN}));");
}
if (defined($e->{SWITCH_TYPE})) {
$self->pidl("NDR_CHECK(ndr_push_$e->{SWITCH_TYPE}($ndr, NDR_SCALARS, level));");
}
@ -1833,6 +1837,10 @@ sub ParseUnionPullPrimitives($$$$$)
my ($self,$e,$ndr,$varname,$switch_type) = @_;
my $have_default = 0;
if (defined($e->{ALIGN})) {
$self->pidl("NDR_CHECK(ndr_pull_union_align($ndr, $e->{ALIGN}));");
}
if (defined($switch_type)) {
$self->pidl("NDR_CHECK(ndr_pull_$switch_type($ndr, NDR_SCALARS, &_level));");
$self->pidl("if (_level != level) {");