/* return the wire size of a security_acl */ size_t ndr_size_security_acl(const struct security_acl *theacl, int flags) { size_t ret; int i; if (!theacl) return 0; ret = 8; for (i=0;i<theacl->num_aces;i++) { ret += ndr_size_security_ace(&theacl->aces[i], flags); } return ret; }
_PUBLIC_ void ndr_print_security_ace(struct ndr_print *ndr, const char *name, const struct security_ace *r) { ndr_print_struct(ndr, name, "security_ace"); ndr->depth++; ndr_print_security_ace_type(ndr, "type", r->type); ndr_print_security_ace_flags(ndr, "flags", r->flags); ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_security_ace(r, ndr->iconv_convenience, ndr->flags):r->size); ndr_print_uint32(ndr, "access_mask", r->access_mask); ndr_print_set_switch_value(ndr, &r->object, r->type); ndr_print_security_ace_object_ctr(ndr, "object", &r->object); ndr_print_dom_sid(ndr, "trustee", &r->trustee); ndr->depth--; }
NTSTATUS ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_security_ace_type(ndr, NDR_SCALARS, r->type)); NDR_CHECK(ndr_push_security_ace_flags(ndr, NDR_SCALARS, r->flags)); NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_ace(r,ndr->flags))); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->access_mask)); NDR_CHECK(ndr_push_set_switch_value(ndr, &r->object, r->type)); NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object)); NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->trustee)); } if (ndr_flags & NDR_BUFFERS) { NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object)); } return NT_STATUS_OK; }
_PUBLIC_ enum ndr_err_code ndr_push_security_ace(struct ndr_push *ndr, int ndr_flags, const struct security_ace *r) { if (ndr_flags & NDR_SCALARS) { NDR_CHECK(ndr_push_align(ndr, 4)); NDR_CHECK(ndr_push_security_ace_type(ndr, NDR_SCALARS, r->type)); NDR_CHECK(ndr_push_security_ace_flags(ndr, NDR_SCALARS, r->flags)); NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_security_ace(r, ndr->iconv_convenience, ndr->flags))); NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->access_mask)); NDR_CHECK(ndr_push_set_switch_value(ndr, &r->object, r->type)); NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_SCALARS, &r->object)); NDR_CHECK(ndr_push_dom_sid(ndr, NDR_SCALARS, &r->trustee)); NDR_CHECK(ndr_push_trailer_align(ndr, 4)); } if (ndr_flags & NDR_BUFFERS) { NDR_CHECK(ndr_push_security_ace_object_ctr(ndr, NDR_BUFFERS, &r->object)); } return NDR_ERR_SUCCESS; }