mirror of
https://github.com/samba-team/samba.git
synced 2025-03-29 02:50:28 +03:00
pidl: added union padding for NDR64
This fixes the problem with samr UserInfo16 when NDR64 is enabled
This commit is contained in:
parent
325baf37ff
commit
64e08fef16
@ -498,6 +498,8 @@ enum ndr_err_code ndr_pull_bytes(struct ndr_pull *ndr, uint8_t *data, uint32_t n
|
||||
enum ndr_err_code ndr_pull_array_uint8(struct ndr_pull *ndr, int ndr_flags, uint8_t *data, uint32_t n);
|
||||
enum ndr_err_code ndr_push_align(struct ndr_push *ndr, size_t size);
|
||||
enum ndr_err_code ndr_pull_align(struct ndr_pull *ndr, size_t size);
|
||||
enum ndr_err_code ndr_push_union_align(struct ndr_push *ndr, size_t size);
|
||||
enum ndr_err_code ndr_pull_union_align(struct ndr_pull *ndr, size_t size);
|
||||
enum ndr_err_code ndr_push_bytes(struct ndr_push *ndr, const uint8_t *data, uint32_t n);
|
||||
enum ndr_err_code ndr_push_zero(struct ndr_push *ndr, uint32_t n);
|
||||
enum ndr_err_code ndr_push_array_uint8(struct ndr_push *ndr, int ndr_flags, const uint8_t *data, uint32_t n);
|
||||
|
@ -555,6 +555,24 @@ _PUBLIC_ enum ndr_err_code ndr_pull_align(struct ndr_pull *ndr, size_t size)
|
||||
return NDR_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
_PUBLIC_ enum ndr_err_code ndr_push_union_align(struct ndr_push *ndr, size_t size)
|
||||
{
|
||||
/* MS-RPCE section 2.2.5.3.4.4 */
|
||||
if (ndr->flags & LIBNDR_FLAG_NDR64) {
|
||||
return ndr_push_align(ndr, size);
|
||||
}
|
||||
return NDR_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
_PUBLIC_ enum ndr_err_code ndr_pull_union_align(struct ndr_pull *ndr, size_t size)
|
||||
{
|
||||
/* MS-RPCE section 2.2.5.3.4.4 */
|
||||
if (ndr->flags & LIBNDR_FLAG_NDR64) {
|
||||
return ndr_pull_align(ndr, size);
|
||||
}
|
||||
return NDR_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
push some bytes
|
||||
*/
|
||||
|
@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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}}) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user