summaryrefslogtreecommitdiff
path: root/librpc
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2009-10-01 16:08:02 +1000
committerAndrew Tridgell <tridge@samba.org>2009-10-02 12:05:59 +1000
commit9eb78be4a670615b4e6a722f121f0f0e585b8d6b (patch)
treea38160b79695752f20e8440b66e0dd30a8c6371d /librpc
parent1726038708bcebd706dc4565963611dc86a33699 (diff)
downloadsamba-9eb78be4a670615b4e6a722f121f0f0e585b8d6b.tar.gz
samba-9eb78be4a670615b4e6a722f121f0f0e585b8d6b.tar.bz2
samba-9eb78be4a670615b4e6a722f121f0f0e585b8d6b.zip
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
Diffstat (limited to 'librpc')
-rw-r--r--librpc/ndr/libndr.h2
-rw-r--r--librpc/ndr/ndr_basic.c18
2 files changed, 20 insertions, 0 deletions
diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h
index f6f5170646..3236932ba7 100644
--- a/librpc/ndr/libndr.h
+++ b/librpc/ndr/libndr.h
@@ -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);
diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c
index f3b7e755c5..807db59995 100644
--- a/librpc/ndr/ndr_basic.c
+++ b/librpc/ndr/ndr_basic.c
@@ -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
*/