summaryrefslogtreecommitdiff
path: root/librpc
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
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')
-rw-r--r--librpc/idl/security.idl2
-rw-r--r--librpc/ndr/ndr_sec_helper.c30
2 files changed, 31 insertions, 1 deletions
diff --git a/librpc/idl/security.idl b/librpc/idl/security.idl
index a9c9392c53..c869eef01c 100644
--- a/librpc/idl/security.idl
+++ b/librpc/idl/security.idl
@@ -296,7 +296,7 @@ interface security
[default];
} security_ace_object_ctr;
- typedef [public,gensize,nosize] struct {
+ typedef [public,nopull,gensize,nosize] struct {
security_ace_type type; /* SEC_ACE_TYPE_* */
security_ace_flags flags; /* SEC_ACE_FLAG_* */
[value(ndr_size_security_ace(r,ndr->flags))] uint16 size;
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
*/