summaryrefslogtreecommitdiff
path: root/librpc/ndr
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2008-11-07 10:49:59 +0100
committerStefan Metzmacher <metze@samba.org>2008-11-08 08:02:27 +0100
commit1e80221b2340de5ef5e2a17f10511bbc2c041163 (patch)
tree1859fc44cd92ac9f88130335c4bffba487b5eefc /librpc/ndr
parent03b9547b478265c542f6a19b8677426bedeeb611 (diff)
downloadsamba-1e80221b2340de5ef5e2a17f10511bbc2c041163.tar.gz
samba-1e80221b2340de5ef5e2a17f10511bbc2c041163.tar.bz2
samba-1e80221b2340de5ef5e2a17f10511bbc2c041163.zip
security.idl: sometimes ACEs have some padding at the end
metze
Diffstat (limited to 'librpc/ndr')
-rw-r--r--librpc/ndr/ndr_sec_helper.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/librpc/ndr/ndr_sec_helper.c b/librpc/ndr/ndr_sec_helper.c
index 009e3524a7..4b135505d8 100644
--- a/librpc/ndr/ndr_sec_helper.c
+++ b/librpc/ndr/ndr_sec_helper.c
@@ -55,6 +55,36 @@ size_t ndr_size_security_ace(const struct security_ace *ace, int flags)
return ret;
}
+enum ndr_err_code ndr_pull_security_ace(struct ndr_pull *ndr, int ndr_flags, struct security_ace *r)
+{
+ if (ndr_flags & NDR_SCALARS) {
+ uint32_t start_ofs = ndr->offset;
+ uint32_t size = 0;
+ uint32_t pad = 0;
+ NDR_CHECK(ndr_pull_align(ndr, 4));
+ NDR_CHECK(ndr_pull_security_ace_type(ndr, NDR_SCALARS, &r->type));
+ NDR_CHECK(ndr_pull_security_ace_flags(ndr, NDR_SCALARS, &r->flags));
+ NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
+ NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->access_mask));
+ NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->object, r->type));
+ NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object));
+ NDR_CHECK(ndr_pull_dom_sid(ndr, NDR_SCALARS, &r->trustee));
+ size = ndr->offset - start_ofs;
+ if (r->size < size) {
+ return ndr_pull_error(ndr, NDR_ERR_BUFSIZE,
+ "ndr_pull_security_ace: r->size %u < size %u",
+ (unsigned)r->size, size);
+ }
+ pad = r->size - size;
+ NDR_PULL_NEED_BYTES(ndr, pad);
+ ndr->offset += pad;
+ }
+ if (ndr_flags & NDR_BUFFERS) {
+ NDR_CHECK(ndr_pull_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object));
+ }
+ return NDR_ERR_SUCCESS;
+}
+
/*
return the wire size of a security_acl
*/