2 Unix SMB/CIFS implementation.
4 fast routines for getting the wire size of security objects
6 Copyright (C) Andrew Tridgell 2003
7 Copyright (C) Stefan Metzmacher 2006-2008
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 #include "librpc/gen_ndr/ndr_security.h"
28 return the wire size of a security_ace
30 size_t ndr_size_security_ace(const struct security_ace *ace, int flags)
36 ret = 8 + ndr_size_dom_sid(&ace->trustee, flags);
39 case SEC_ACE_TYPE_ACCESS_ALLOWED_OBJECT:
40 case SEC_ACE_TYPE_ACCESS_DENIED_OBJECT:
41 case SEC_ACE_TYPE_SYSTEM_AUDIT_OBJECT:
42 case SEC_ACE_TYPE_SYSTEM_ALARM_OBJECT:
43 ret += 4; /* uint32 bitmap ace->object.object.flags */
44 if (ace->object.object.flags & SEC_ACE_OBJECT_TYPE_PRESENT) {
45 ret += 16; /* GUID ace->object.object.type.type */
47 if (ace->object.object.flags & SEC_ACE_INHERITED_OBJECT_TYPE_PRESENT) {
48 ret += 16; /* GUID ace->object.object.inherited_typeinherited_type */
59 return the wire size of a security_acl
61 size_t ndr_size_security_acl(const struct security_acl *acl, int flags)
67 for (i=0;i<acl->num_aces;i++) {
68 ret += ndr_size_security_ace(&acl->aces[i], flags);
74 return the wire size of a security descriptor
76 size_t ndr_size_security_descriptor(const struct security_descriptor *sd, int flags)
82 ret += ndr_size_dom_sid(sd->owner_sid, flags);
83 ret += ndr_size_dom_sid(sd->group_sid, flags);
84 ret += ndr_size_security_acl(sd->dacl, flags);
85 ret += ndr_size_security_acl(sd->sacl, flags);