mirror of
https://github.com/samba-team/samba.git
synced 2025-03-29 02:50:28 +03:00
ndr64: added support for trailing gap alignment
NDR64 has a 'trailing gap' alignment, which aligns the end of a structure on the overall structure alignment. This explains the discrepancy we had with the RPC-SAMR test and NDR64
This commit is contained in:
parent
1726038708
commit
9eb78be4a6
@ -500,6 +500,8 @@ 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_trailer_align(struct ndr_push *ndr, size_t size);
|
||||
enum ndr_err_code ndr_pull_trailer_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);
|
||||
|
@ -573,6 +573,24 @@ _PUBLIC_ enum ndr_err_code ndr_pull_union_align(struct ndr_pull *ndr, size_t siz
|
||||
return NDR_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
_PUBLIC_ enum ndr_err_code ndr_push_trailer_align(struct ndr_push *ndr, size_t size)
|
||||
{
|
||||
/* MS-RPCE section 2.2.5.3.4.1 */
|
||||
if (ndr->flags & LIBNDR_FLAG_NDR64) {
|
||||
return ndr_push_align(ndr, size);
|
||||
}
|
||||
return NDR_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
_PUBLIC_ enum ndr_err_code ndr_pull_trailer_align(struct ndr_pull *ndr, size_t size)
|
||||
{
|
||||
/* MS-RPCE section 2.2.5.3.4.1 */
|
||||
if (ndr->flags & LIBNDR_FLAG_NDR64) {
|
||||
return ndr_pull_align(ndr, size);
|
||||
}
|
||||
return NDR_ERR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
push some bytes
|
||||
*/
|
||||
|
@ -1235,6 +1235,8 @@ sub ParseStructPushPrimitives($$$$$)
|
||||
}
|
||||
|
||||
$self->ParseElementPush($_, $ndr, $env, 1, 0) foreach (@{$struct->{ELEMENTS}});
|
||||
|
||||
$self->pidl("NDR_CHECK(ndr_push_trailer_align($ndr, $struct->{ALIGN}));");
|
||||
}
|
||||
|
||||
sub ParseStructPushDeferred($$$$)
|
||||
@ -1533,6 +1535,8 @@ sub ParseStructPullPrimitives($$$$$)
|
||||
$self->ParseElementPull($_, $ndr, $env, 1, 0) foreach (@{$struct->{ELEMENTS}});
|
||||
|
||||
$self->add_deferred();
|
||||
|
||||
$self->pidl("NDR_CHECK(ndr_pull_trailer_align($ndr, $struct->{ALIGN}));");
|
||||
}
|
||||
|
||||
sub ParseStructPullDeferred($$$$$)
|
||||
|
Loading…
x
Reference in New Issue
Block a user