xref: /xnu-8792.41.9/bsd/sys/kauth.h (revision 5c2921b07a2480ab43ec66f5b9e41cb872bc554f)
1*5c2921b0SApple OSS Distributions /*
2*5c2921b0SApple OSS Distributions  * Copyright (c) 2004-2010 Apple Inc. All rights reserved.
3*5c2921b0SApple OSS Distributions  *
4*5c2921b0SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*5c2921b0SApple OSS Distributions  *
6*5c2921b0SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*5c2921b0SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*5c2921b0SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*5c2921b0SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*5c2921b0SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*5c2921b0SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*5c2921b0SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*5c2921b0SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*5c2921b0SApple OSS Distributions  *
15*5c2921b0SApple OSS Distributions  * Please obtain a copy of the License at
16*5c2921b0SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*5c2921b0SApple OSS Distributions  *
18*5c2921b0SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*5c2921b0SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*5c2921b0SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*5c2921b0SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*5c2921b0SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*5c2921b0SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*5c2921b0SApple OSS Distributions  * limitations under the License.
25*5c2921b0SApple OSS Distributions  *
26*5c2921b0SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*5c2921b0SApple OSS Distributions  */
28*5c2921b0SApple OSS Distributions /*
29*5c2921b0SApple OSS Distributions  * NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce
30*5c2921b0SApple OSS Distributions  * support for mandatory and extensible security protections.  This notice
31*5c2921b0SApple OSS Distributions  * is included in support of clause 2.2 (b) of the Apple Public License,
32*5c2921b0SApple OSS Distributions  * Version 2.0.
33*5c2921b0SApple OSS Distributions  */
34*5c2921b0SApple OSS Distributions 
35*5c2921b0SApple OSS Distributions #ifndef _SYS_KAUTH_H
36*5c2921b0SApple OSS Distributions #define _SYS_KAUTH_H
37*5c2921b0SApple OSS Distributions 
38*5c2921b0SApple OSS Distributions #include <sys/appleapiopts.h>
39*5c2921b0SApple OSS Distributions #include <sys/cdefs.h>
40*5c2921b0SApple OSS Distributions #include <mach/boolean.h>
41*5c2921b0SApple OSS Distributions #include <machine/types.h>      /* u_int8_t, etc. */
42*5c2921b0SApple OSS Distributions #include <sys/_types.h>         /* __offsetof() */
43*5c2921b0SApple OSS Distributions #include <sys/_types/_uid_t.h>  /* uid_t */
44*5c2921b0SApple OSS Distributions #include <sys/_types/_gid_t.h>     /* gid_t */
45*5c2921b0SApple OSS Distributions #include <sys/syslimits.h>      /* NGROUPS_MAX */
46*5c2921b0SApple OSS Distributions 
47*5c2921b0SApple OSS Distributions #ifdef __APPLE_API_EVOLVING
48*5c2921b0SApple OSS Distributions 
49*5c2921b0SApple OSS Distributions /*
50*5c2921b0SApple OSS Distributions  * Identities.
51*5c2921b0SApple OSS Distributions  */
52*5c2921b0SApple OSS Distributions 
53*5c2921b0SApple OSS Distributions #define KAUTH_UID_NONE  (~(uid_t)0 - 100)       /* not a valid UID */
54*5c2921b0SApple OSS Distributions #define KAUTH_GID_NONE  (~(gid_t)0 - 100)       /* not a valid GID */
55*5c2921b0SApple OSS Distributions 
56*5c2921b0SApple OSS Distributions #include <sys/_types/_guid_t.h>
57*5c2921b0SApple OSS Distributions 
58*5c2921b0SApple OSS Distributions /* NT Security Identifier, structure as defined by Microsoft */
59*5c2921b0SApple OSS Distributions #pragma pack(1)    /* push packing of 1 byte */
60*5c2921b0SApple OSS Distributions typedef struct {
61*5c2921b0SApple OSS Distributions 	u_int8_t                sid_kind;
62*5c2921b0SApple OSS Distributions 	u_int8_t                sid_authcount;
63*5c2921b0SApple OSS Distributions 	u_int8_t                sid_authority[6];
64*5c2921b0SApple OSS Distributions #define KAUTH_NTSID_MAX_AUTHORITIES 16
65*5c2921b0SApple OSS Distributions 	u_int32_t       sid_authorities[KAUTH_NTSID_MAX_AUTHORITIES];
66*5c2921b0SApple OSS Distributions } ntsid_t;
67*5c2921b0SApple OSS Distributions #pragma pack()    /* pop packing to previous packing level */
68*5c2921b0SApple OSS Distributions #define _NTSID_T
69*5c2921b0SApple OSS Distributions 
70*5c2921b0SApple OSS Distributions /* valid byte count inside a SID structure */
71*5c2921b0SApple OSS Distributions #define KAUTH_NTSID_HDRSIZE     (8)
72*5c2921b0SApple OSS Distributions #define KAUTH_NTSID_SIZE(_s)    (KAUTH_NTSID_HDRSIZE + ((_s)->sid_authcount * sizeof(u_int32_t)))
73*5c2921b0SApple OSS Distributions 
74*5c2921b0SApple OSS Distributions /*
75*5c2921b0SApple OSS Distributions  * External lookup message payload; this structure is shared between the
76*5c2921b0SApple OSS Distributions  * kernel group membership resolver, and the user space group membership
77*5c2921b0SApple OSS Distributions  * resolver daemon, and is use to communicate resolution requests from the
78*5c2921b0SApple OSS Distributions  * kernel to user space, and the result of that request from user space to
79*5c2921b0SApple OSS Distributions  * the kernel.
80*5c2921b0SApple OSS Distributions  */
81*5c2921b0SApple OSS Distributions struct kauth_identity_extlookup {
82*5c2921b0SApple OSS Distributions 	u_int32_t       el_seqno;       /* request sequence number */
83*5c2921b0SApple OSS Distributions 	u_int32_t       el_result;      /* lookup result */
84*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_SUCCESS         0       /* results here are good */
85*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_BADRQ           1       /* request badly formatted */
86*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_FAILURE         2       /* transient failure during lookup */
87*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_FATAL           3       /* permanent failure during lookup */
88*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_INPROG          100     /* request in progress */
89*5c2921b0SApple OSS Distributions 	u_int32_t       el_flags;
90*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_VALID_UID       (1<<0)
91*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_VALID_UGUID     (1<<1)
92*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_VALID_USID      (1<<2)
93*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_VALID_GID       (1<<3)
94*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_VALID_GGUID     (1<<4)
95*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_VALID_GSID      (1<<5)
96*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_WANT_UID        (1<<6)
97*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_WANT_UGUID      (1<<7)
98*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_WANT_USID       (1<<8)
99*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_WANT_GID        (1<<9)
100*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_WANT_GGUID      (1<<10)
101*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_WANT_GSID       (1<<11)
102*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_WANT_MEMBERSHIP (1<<12)
103*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_VALID_MEMBERSHIP (1<<13)
104*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_ISMEMBER        (1<<14)
105*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_VALID_PWNAM     (1<<15)
106*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_WANT_PWNAM      (1<<16)
107*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_VALID_GRNAM     (1<<17)
108*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_WANT_GRNAM      (1<<18)
109*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_VALID_SUPGRPS   (1<<19)
110*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_WANT_SUPGRPS    (1<<20)
111*5c2921b0SApple OSS Distributions 
112*5c2921b0SApple OSS Distributions 	__darwin_pid_t  el_info_pid;            /* request on behalf of PID */
113*5c2921b0SApple OSS Distributions 	u_int64_t       el_extend;              /* extension field */
114*5c2921b0SApple OSS Distributions 	u_int32_t       el_info_reserved_1;     /* reserved (APPLE) */
115*5c2921b0SApple OSS Distributions 
116*5c2921b0SApple OSS Distributions 	uid_t           el_uid;         /* user ID */
117*5c2921b0SApple OSS Distributions 	guid_t          el_uguid;       /* user GUID */
118*5c2921b0SApple OSS Distributions 	u_int32_t       el_uguid_valid; /* TTL on translation result (seconds) */
119*5c2921b0SApple OSS Distributions 	ntsid_t         el_usid;        /* user NT SID */
120*5c2921b0SApple OSS Distributions 	u_int32_t       el_usid_valid;  /* TTL on translation result (seconds) */
121*5c2921b0SApple OSS Distributions 	gid_t           el_gid;         /* group ID */
122*5c2921b0SApple OSS Distributions 	guid_t          el_gguid;       /* group GUID */
123*5c2921b0SApple OSS Distributions 	u_int32_t       el_gguid_valid; /* TTL on translation result (seconds) */
124*5c2921b0SApple OSS Distributions 	ntsid_t         el_gsid;        /* group SID */
125*5c2921b0SApple OSS Distributions 	u_int32_t       el_gsid_valid;  /* TTL on translation result (seconds) */
126*5c2921b0SApple OSS Distributions 	u_int32_t       el_member_valid; /* TTL on group lookup result */
127*5c2921b0SApple OSS Distributions 	u_int32_t       el_sup_grp_cnt;  /* count of supplemental groups up to NGROUPS */
128*5c2921b0SApple OSS Distributions 	gid_t           el_sup_groups[NGROUPS_MAX];     /* supplemental group list */
129*5c2921b0SApple OSS Distributions };
130*5c2921b0SApple OSS Distributions 
131*5c2921b0SApple OSS Distributions struct kauth_cache_sizes {
132*5c2921b0SApple OSS Distributions 	u_int32_t kcs_group_size;
133*5c2921b0SApple OSS Distributions 	u_int32_t kcs_id_size;
134*5c2921b0SApple OSS Distributions };
135*5c2921b0SApple OSS Distributions 
136*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_REGISTER        (0)
137*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_RESULT          (1<<0)
138*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_WORKER          (1<<1)
139*5c2921b0SApple OSS Distributions #define KAUTH_EXTLOOKUP_DEREGISTER      (1<<2)
140*5c2921b0SApple OSS Distributions #define KAUTH_GET_CACHE_SIZES           (1<<3)
141*5c2921b0SApple OSS Distributions #define KAUTH_SET_CACHE_SIZES           (1<<4)
142*5c2921b0SApple OSS Distributions #define KAUTH_CLEAR_CACHES              (1<<5)
143*5c2921b0SApple OSS Distributions 
144*5c2921b0SApple OSS Distributions #define IDENTITYSVC_ENTITLEMENT         "com.apple.private.identitysvc"
145*5c2921b0SApple OSS Distributions 
146*5c2921b0SApple OSS Distributions 
147*5c2921b0SApple OSS Distributions #ifdef KERNEL
148*5c2921b0SApple OSS Distributions /*
149*5c2921b0SApple OSS Distributions  * Credentials.
150*5c2921b0SApple OSS Distributions  */
151*5c2921b0SApple OSS Distributions /* XXX just for now */
152*5c2921b0SApple OSS Distributions #include <sys/ucred.h>
153*5c2921b0SApple OSS Distributions 
154*5c2921b0SApple OSS Distributions /* Kernel SPI for now */
155*5c2921b0SApple OSS Distributions __BEGIN_DECLS
156*5c2921b0SApple OSS Distributions /*
157*5c2921b0SApple OSS Distributions  * Routines specific to credentials with POSIX credential labels attached
158*5c2921b0SApple OSS Distributions  *
159*5c2921b0SApple OSS Distributions  * XXX	Should be in policy_posix.h, with struct posix_cred
160*5c2921b0SApple OSS Distributions  */
161*5c2921b0SApple OSS Distributions extern kauth_cred_t posix_cred_create(posix_cred_t pcred);
162*5c2921b0SApple OSS Distributions extern posix_cred_t posix_cred_get(kauth_cred_t cred);
163*5c2921b0SApple OSS Distributions extern void posix_cred_label(kauth_cred_t cred, posix_cred_t pcred);
164*5c2921b0SApple OSS Distributions extern int posix_cred_access(kauth_cred_t cred, id_t object_uid, id_t object_gid, mode_t object_mode, mode_t mode_req);
165*5c2921b0SApple OSS Distributions 
166*5c2921b0SApple OSS Distributions extern uid_t    kauth_getuid(void);
167*5c2921b0SApple OSS Distributions extern uid_t    kauth_getruid(void);
168*5c2921b0SApple OSS Distributions extern gid_t    kauth_getgid(void);
169*5c2921b0SApple OSS Distributions extern kauth_cred_t kauth_cred_get(void);
170*5c2921b0SApple OSS Distributions extern kauth_cred_t kauth_cred_get_with_ref(void);
171*5c2921b0SApple OSS Distributions extern kauth_cred_t kauth_cred_proc_ref(proc_t procp);
172*5c2921b0SApple OSS Distributions extern kauth_cred_t kauth_cred_create(kauth_cred_t cred);
173*5c2921b0SApple OSS Distributions extern void     kauth_cred_ref(kauth_cred_t _cred);
174*5c2921b0SApple OSS Distributions #ifndef __LP64__
175*5c2921b0SApple OSS Distributions /* Use kauth_cred_unref(), not kauth_cred_rele() */
176*5c2921b0SApple OSS Distributions extern void     kauth_cred_rele(kauth_cred_t _cred) __deprecated;
177*5c2921b0SApple OSS Distributions #endif
178*5c2921b0SApple OSS Distributions extern void     kauth_cred_unref(kauth_cred_t *_cred);
179*5c2921b0SApple OSS Distributions 
180*5c2921b0SApple OSS Distributions #if CONFIG_MACF
181*5c2921b0SApple OSS Distributions struct label;
182*5c2921b0SApple OSS Distributions extern kauth_cred_t     kauth_cred_label_update(kauth_cred_t cred, struct label *label);
183*5c2921b0SApple OSS Distributions extern int kauth_proc_label_update(struct proc *p, struct label *label);
184*5c2921b0SApple OSS Distributions #else
185*5c2921b0SApple OSS Distributions /* this is a temp hack to cover us when MAC is not built in a kernel configuration.
186*5c2921b0SApple OSS Distributions  * Since we cannot build our export list based on the kernel configuration we need
187*5c2921b0SApple OSS Distributions  * to define a stub.
188*5c2921b0SApple OSS Distributions  */
189*5c2921b0SApple OSS Distributions extern kauth_cred_t     kauth_cred_label_update(kauth_cred_t cred, void *label);
190*5c2921b0SApple OSS Distributions extern int kauth_proc_label_update(struct proc *p, void *label);
191*5c2921b0SApple OSS Distributions #endif
192*5c2921b0SApple OSS Distributions 
193*5c2921b0SApple OSS Distributions __deprecated_msg("Unsafe interface: requires lock holds that aren't exposed")
194*5c2921b0SApple OSS Distributions extern kauth_cred_t kauth_cred_find(kauth_cred_t cred);
195*5c2921b0SApple OSS Distributions extern uid_t    kauth_cred_getuid(kauth_cred_t _cred);
196*5c2921b0SApple OSS Distributions extern uid_t    kauth_cred_getruid(kauth_cred_t _cred);
197*5c2921b0SApple OSS Distributions extern uid_t    kauth_cred_getsvuid(kauth_cred_t _cred);
198*5c2921b0SApple OSS Distributions extern gid_t    kauth_cred_getgid(kauth_cred_t _cred);
199*5c2921b0SApple OSS Distributions extern gid_t    kauth_cred_getrgid(kauth_cred_t _cred);
200*5c2921b0SApple OSS Distributions extern gid_t    kauth_cred_getsvgid(kauth_cred_t _cred);
201*5c2921b0SApple OSS Distributions extern int      kauth_cred_pwnam2guid(char *pwnam, guid_t *guidp);
202*5c2921b0SApple OSS Distributions extern int      kauth_cred_grnam2guid(char *grnam, guid_t *guidp);
203*5c2921b0SApple OSS Distributions extern int      kauth_cred_guid2pwnam(guid_t *guidp, char *pwnam);
204*5c2921b0SApple OSS Distributions extern int      kauth_cred_guid2grnam(guid_t *guidp, char *grnam);
205*5c2921b0SApple OSS Distributions extern int      kauth_cred_guid2uid(guid_t *_guid, uid_t *_uidp);
206*5c2921b0SApple OSS Distributions extern int      kauth_cred_guid2gid(guid_t *_guid, gid_t *_gidp);
207*5c2921b0SApple OSS Distributions extern int      kauth_cred_ntsid2uid(ntsid_t *_sid, uid_t *_uidp);
208*5c2921b0SApple OSS Distributions extern int      kauth_cred_ntsid2gid(ntsid_t *_sid, gid_t *_gidp);
209*5c2921b0SApple OSS Distributions extern int      kauth_cred_ntsid2guid(ntsid_t *_sid, guid_t *_guidp);
210*5c2921b0SApple OSS Distributions extern int      kauth_cred_uid2guid(uid_t _uid, guid_t *_guidp);
211*5c2921b0SApple OSS Distributions extern int      kauth_cred_getguid(kauth_cred_t _cred, guid_t *_guidp);
212*5c2921b0SApple OSS Distributions extern int      kauth_cred_gid2guid(gid_t _gid, guid_t *_guidp);
213*5c2921b0SApple OSS Distributions extern int      kauth_cred_uid2ntsid(uid_t _uid, ntsid_t *_sidp);
214*5c2921b0SApple OSS Distributions extern int      kauth_cred_getntsid(kauth_cred_t _cred, ntsid_t *_sidp);
215*5c2921b0SApple OSS Distributions extern int      kauth_cred_gid2ntsid(gid_t _gid, ntsid_t *_sidp);
216*5c2921b0SApple OSS Distributions extern int      kauth_cred_guid2ntsid(guid_t *_guid, ntsid_t *_sidp);
217*5c2921b0SApple OSS Distributions extern int      kauth_cred_ismember_gid(kauth_cred_t _cred, gid_t _gid, int *_resultp);
218*5c2921b0SApple OSS Distributions extern int      kauth_cred_ismember_guid(kauth_cred_t _cred, guid_t *_guidp, int *_resultp);
219*5c2921b0SApple OSS Distributions extern int      kauth_cred_nfs4domain2dsnode(char *nfs4domain, char *dsnode);
220*5c2921b0SApple OSS Distributions extern int      kauth_cred_dsnode2nfs4domain(char *dsnode, char *nfs4domain);
221*5c2921b0SApple OSS Distributions 
222*5c2921b0SApple OSS Distributions extern int      groupmember(gid_t gid, kauth_cred_t cred);
223*5c2921b0SApple OSS Distributions 
224*5c2921b0SApple OSS Distributions /* currently only exported in unsupported for use by seatbelt */
225*5c2921b0SApple OSS Distributions extern int      kauth_cred_issuser(kauth_cred_t _cred);
226*5c2921b0SApple OSS Distributions 
227*5c2921b0SApple OSS Distributions 
228*5c2921b0SApple OSS Distributions /* GUID, NTSID helpers */
229*5c2921b0SApple OSS Distributions extern guid_t   kauth_null_guid;
230*5c2921b0SApple OSS Distributions extern int      kauth_guid_equal(guid_t *_guid1, guid_t *_guid2);
231*5c2921b0SApple OSS Distributions 
232*5c2921b0SApple OSS Distributions #ifdef KERNEL_PRIVATE
233*5c2921b0SApple OSS Distributions extern int      kauth_cred_getgroups(kauth_cred_t _cred, gid_t *_groups, size_t *_groupcount);
234*5c2921b0SApple OSS Distributions 
235*5c2921b0SApple OSS Distributions #endif /* KERNEL_PRIVATE */
236*5c2921b0SApple OSS Distributions 
237*5c2921b0SApple OSS Distributions #ifdef XNU_KERNEL_PRIVATE
238*5c2921b0SApple OSS Distributions extern int      kauth_ntsid_equal(ntsid_t *_sid1, ntsid_t *_sid2);
239*5c2921b0SApple OSS Distributions 
240*5c2921b0SApple OSS Distributions extern int      kauth_wellknown_guid(guid_t *_guid);
241*5c2921b0SApple OSS Distributions #define KAUTH_WKG_NOT           0       /* not a well-known GUID */
242*5c2921b0SApple OSS Distributions #define KAUTH_WKG_OWNER         1
243*5c2921b0SApple OSS Distributions #define KAUTH_WKG_GROUP         2
244*5c2921b0SApple OSS Distributions #define KAUTH_WKG_NOBODY        3
245*5c2921b0SApple OSS Distributions #define KAUTH_WKG_EVERYBODY     4
246*5c2921b0SApple OSS Distributions 
247*5c2921b0SApple OSS Distributions extern gid_t    kauth_getrgid(void);
248*5c2921b0SApple OSS Distributions extern int      cantrace(proc_t cur_procp, kauth_cred_t creds, proc_t traced_procp, int *errp);
249*5c2921b0SApple OSS Distributions extern kauth_cred_t kauth_cred_copy_real(kauth_cred_t cred);
250*5c2921b0SApple OSS Distributions extern kauth_cred_t kauth_cred_setresuid(kauth_cred_t cred, uid_t ruid, uid_t euid, uid_t svuid, uid_t gmuid);
251*5c2921b0SApple OSS Distributions extern kauth_cred_t kauth_cred_setresgid(kauth_cred_t cred, gid_t rgid, gid_t egid, gid_t svgid);
252*5c2921b0SApple OSS Distributions extern kauth_cred_t kauth_cred_setuidgid(kauth_cred_t cred, uid_t uid, gid_t gid);
253*5c2921b0SApple OSS Distributions extern kauth_cred_t kauth_cred_setsvuidgid(kauth_cred_t cred, uid_t uid, gid_t gid);
254*5c2921b0SApple OSS Distributions extern kauth_cred_t kauth_cred_setgroups(kauth_cred_t cred, gid_t *groups, size_t groupcount, uid_t gmuid);
255*5c2921b0SApple OSS Distributions struct uthread;
256*5c2921b0SApple OSS Distributions extern void     kauth_cred_thread_update(struct thread *, proc_t);
257*5c2921b0SApple OSS Distributions #ifdef CONFIG_MACF
258*5c2921b0SApple OSS Distributions extern void kauth_proc_label_update_execve(struct proc *p, struct vfs_context *ctx, struct vnode *vp, off_t offset, struct vnode *scriptvp, struct label *scriptlabel, struct label *execlabel, unsigned int *csflags, void *psattr, int *disjoint, int *update_return);
259*5c2921b0SApple OSS Distributions #endif
260*5c2921b0SApple OSS Distributions extern int      kauth_cred_gid_subset(kauth_cred_t _cred1, kauth_cred_t _cred2, int *_resultp);
261*5c2921b0SApple OSS Distributions struct auditinfo_addr;
262*5c2921b0SApple OSS Distributions extern kauth_cred_t kauth_cred_setauditinfo(kauth_cred_t, au_session_t *);
263*5c2921b0SApple OSS Distributions extern int      kauth_cred_supplementary_register(const char *name, int *ident);
264*5c2921b0SApple OSS Distributions extern int      kauth_cred_supplementary_add(kauth_cred_t cred, int ident, const void *data, size_t datasize);
265*5c2921b0SApple OSS Distributions extern int      kauth_cred_supplementary_remove(kauth_cred_t cred, int ident);
266*5c2921b0SApple OSS Distributions 
267*5c2921b0SApple OSS Distributions extern kauth_cred_t kauth_cred_require(kauth_cred_t cred) __pure2;
268*5c2921b0SApple OSS Distributions 
269*5c2921b0SApple OSS Distributions extern void     kauth_cred_set(kauth_cred_t *credp, kauth_cred_t new_cred);
270*5c2921b0SApple OSS Distributions extern void     kauth_cred_set_and_unref(kauth_cred_t *credp, kauth_cred_t *new_credp);
271*5c2921b0SApple OSS Distributions 
272*5c2921b0SApple OSS Distributions #if HAS_APPLE_PAC
273*5c2921b0SApple OSS Distributions /*
274*5c2921b0SApple OSS Distributions  * `kauth_cred_set` and `kauth_cred_unref` take pointers to a
275*5c2921b0SApple OSS Distributions  * `kauth_cred_t`, which the compiler considers strictly different from a
276*5c2921b0SApple OSS Distributions  * pointer to a signed `kauth_cred_t` (as it should do).  These macros
277*5c2921b0SApple OSS Distributions  * therefore authenticate the arguments into naked locals, pass them to the
278*5c2921b0SApple OSS Distributions  * function and then write back the results, signing them in the process.
279*5c2921b0SApple OSS Distributions  */
280*5c2921b0SApple OSS Distributions #define kauth_cred_set(credp, new_cred) \
281*5c2921b0SApple OSS Distributions     do { \
282*5c2921b0SApple OSS Distributions 	    kauth_cred_t _cred = *(credp); \
283*5c2921b0SApple OSS Distributions 	    (kauth_cred_set)(&_cred, (new_cred)); \
284*5c2921b0SApple OSS Distributions 	    *(credp) = _cred; \
285*5c2921b0SApple OSS Distributions     } while (0)
286*5c2921b0SApple OSS Distributions 
287*5c2921b0SApple OSS Distributions #define kauth_cred_set_and_unref(credp, new_credp) \
288*5c2921b0SApple OSS Distributions     do { \
289*5c2921b0SApple OSS Distributions 	    kauth_cred_t _cred = *(credp); \
290*5c2921b0SApple OSS Distributions 	    (kauth_cred_set_and_unref)(&_cred, (new_credp)); \
291*5c2921b0SApple OSS Distributions 	    *(credp) = _cred; \
292*5c2921b0SApple OSS Distributions     } while (0)
293*5c2921b0SApple OSS Distributions 
294*5c2921b0SApple OSS Distributions #define kauth_cred_unref(credp) \
295*5c2921b0SApple OSS Distributions     do { \
296*5c2921b0SApple OSS Distributions 	    kauth_cred_t _credp = *(credp); \
297*5c2921b0SApple OSS Distributions 	    (kauth_cred_unref)(&_credp); \
298*5c2921b0SApple OSS Distributions 	    *(credp) = _credp; \
299*5c2921b0SApple OSS Distributions     } while (0)
300*5c2921b0SApple OSS Distributions #endif /* HAS_APPLE_PAC */
301*5c2921b0SApple OSS Distributions 
302*5c2921b0SApple OSS Distributions #endif /* XNU_KERNEL_PRIVATE */
303*5c2921b0SApple OSS Distributions __END_DECLS
304*5c2921b0SApple OSS Distributions 
305*5c2921b0SApple OSS Distributions #endif /* KERNEL */
306*5c2921b0SApple OSS Distributions 
307*5c2921b0SApple OSS Distributions /*
308*5c2921b0SApple OSS Distributions  * Generic Access Control Lists.
309*5c2921b0SApple OSS Distributions  */
310*5c2921b0SApple OSS Distributions #if defined(KERNEL) || defined (_SYS_ACL_H)
311*5c2921b0SApple OSS Distributions 
312*5c2921b0SApple OSS Distributions typedef u_int32_t kauth_ace_rights_t;
313*5c2921b0SApple OSS Distributions 
314*5c2921b0SApple OSS Distributions /* Access Control List Entry (ACE) */
315*5c2921b0SApple OSS Distributions struct kauth_ace {
316*5c2921b0SApple OSS Distributions 	guid_t          ace_applicable;
317*5c2921b0SApple OSS Distributions 	u_int32_t       ace_flags;
318*5c2921b0SApple OSS Distributions #define KAUTH_ACE_KINDMASK              0xf
319*5c2921b0SApple OSS Distributions #define KAUTH_ACE_PERMIT                1
320*5c2921b0SApple OSS Distributions #define KAUTH_ACE_DENY                  2
321*5c2921b0SApple OSS Distributions #define KAUTH_ACE_AUDIT                 3       /* not implemented */
322*5c2921b0SApple OSS Distributions #define KAUTH_ACE_ALARM                 4       /* not implemented */
323*5c2921b0SApple OSS Distributions #define KAUTH_ACE_INHERITED             (1<<4)
324*5c2921b0SApple OSS Distributions #define KAUTH_ACE_FILE_INHERIT          (1<<5)
325*5c2921b0SApple OSS Distributions #define KAUTH_ACE_DIRECTORY_INHERIT     (1<<6)
326*5c2921b0SApple OSS Distributions #define KAUTH_ACE_LIMIT_INHERIT         (1<<7)
327*5c2921b0SApple OSS Distributions #define KAUTH_ACE_ONLY_INHERIT          (1<<8)
328*5c2921b0SApple OSS Distributions #define KAUTH_ACE_SUCCESS               (1<<9)  /* not implemented (AUDIT/ALARM) */
329*5c2921b0SApple OSS Distributions #define KAUTH_ACE_FAILURE               (1<<10) /* not implemented (AUDIT/ALARM) */
330*5c2921b0SApple OSS Distributions /* All flag bits controlling ACE inheritance */
331*5c2921b0SApple OSS Distributions #define KAUTH_ACE_INHERIT_CONTROL_FLAGS         \
332*5c2921b0SApple OSS Distributions 	        (KAUTH_ACE_FILE_INHERIT |       \
333*5c2921b0SApple OSS Distributions 	         KAUTH_ACE_DIRECTORY_INHERIT |  \
334*5c2921b0SApple OSS Distributions 	         KAUTH_ACE_LIMIT_INHERIT |      \
335*5c2921b0SApple OSS Distributions 	         KAUTH_ACE_ONLY_INHERIT)
336*5c2921b0SApple OSS Distributions 	kauth_ace_rights_t ace_rights;          /* scope specific */
337*5c2921b0SApple OSS Distributions 	/* These rights are never tested, but may be present in an ACL */
338*5c2921b0SApple OSS Distributions #define KAUTH_ACE_GENERIC_ALL           (1<<21)
339*5c2921b0SApple OSS Distributions #define KAUTH_ACE_GENERIC_EXECUTE       (1<<22)
340*5c2921b0SApple OSS Distributions #define KAUTH_ACE_GENERIC_WRITE         (1<<23)
341*5c2921b0SApple OSS Distributions #define KAUTH_ACE_GENERIC_READ          (1<<24)
342*5c2921b0SApple OSS Distributions };
343*5c2921b0SApple OSS Distributions 
344*5c2921b0SApple OSS Distributions #ifndef _KAUTH_ACE
345*5c2921b0SApple OSS Distributions #define _KAUTH_ACE
346*5c2921b0SApple OSS Distributions typedef struct kauth_ace *kauth_ace_t;
347*5c2921b0SApple OSS Distributions #endif
348*5c2921b0SApple OSS Distributions 
349*5c2921b0SApple OSS Distributions 
350*5c2921b0SApple OSS Distributions /* Access Control List */
351*5c2921b0SApple OSS Distributions struct kauth_acl {
352*5c2921b0SApple OSS Distributions 	u_int32_t       acl_entrycount;
353*5c2921b0SApple OSS Distributions 	u_int32_t       acl_flags;
354*5c2921b0SApple OSS Distributions 
355*5c2921b0SApple OSS Distributions 	struct kauth_ace acl_ace[1];
356*5c2921b0SApple OSS Distributions };
357*5c2921b0SApple OSS Distributions 
358*5c2921b0SApple OSS Distributions /*
359*5c2921b0SApple OSS Distributions  * XXX this value needs to be raised - 3893388
360*5c2921b0SApple OSS Distributions  */
361*5c2921b0SApple OSS Distributions #define KAUTH_ACL_MAX_ENTRIES           128
362*5c2921b0SApple OSS Distributions 
363*5c2921b0SApple OSS Distributions /*
364*5c2921b0SApple OSS Distributions  * The low 16 bits of the flags field are reserved for filesystem
365*5c2921b0SApple OSS Distributions  * internal use and must be preserved by all APIs.  This includes
366*5c2921b0SApple OSS Distributions  * round-tripping flags through user-space interfaces.
367*5c2921b0SApple OSS Distributions  */
368*5c2921b0SApple OSS Distributions #define KAUTH_ACL_FLAGS_PRIVATE (0xffff)
369*5c2921b0SApple OSS Distributions 
370*5c2921b0SApple OSS Distributions /*
371*5c2921b0SApple OSS Distributions  * The high 16 bits of the flags are used to store attributes and
372*5c2921b0SApple OSS Distributions  * to request specific handling of the ACL.
373*5c2921b0SApple OSS Distributions  */
374*5c2921b0SApple OSS Distributions 
375*5c2921b0SApple OSS Distributions /* inheritance will be deferred until the first rename operation */
376*5c2921b0SApple OSS Distributions #define KAUTH_ACL_DEFER_INHERIT (1<<16)
377*5c2921b0SApple OSS Distributions /* this ACL must not be overwritten as part of an inheritance operation */
378*5c2921b0SApple OSS Distributions #define KAUTH_ACL_NO_INHERIT    (1<<17)
379*5c2921b0SApple OSS Distributions 
380*5c2921b0SApple OSS Distributions /* acl_entrycount that tells us the ACL is not valid */
381*5c2921b0SApple OSS Distributions #define KAUTH_FILESEC_NOACL ((u_int32_t)(-1))
382*5c2921b0SApple OSS Distributions 
383*5c2921b0SApple OSS Distributions /*
384*5c2921b0SApple OSS Distributions  * If the acl_entrycount field is KAUTH_FILESEC_NOACL, then the size is the
385*5c2921b0SApple OSS Distributions  * same as a kauth_acl structure; the intent is to put an actual entrycount of
386*5c2921b0SApple OSS Distributions  * KAUTH_FILESEC_NOACL on disk to distinguish a kauth_filesec_t with an empty
387*5c2921b0SApple OSS Distributions  * entry (Windows treats this as "deny all") from one that merely indicates a
388*5c2921b0SApple OSS Distributions  * file group and/or owner guid values.
389*5c2921b0SApple OSS Distributions  */
390*5c2921b0SApple OSS Distributions #define KAUTH_ACL_SIZE(c)       (__offsetof(struct kauth_acl, acl_ace) + ((u_int32_t)(c) != KAUTH_FILESEC_NOACL ? ((c) * sizeof(struct kauth_ace)) : 0))
391*5c2921b0SApple OSS Distributions #define KAUTH_ACL_COPYSIZE(p)   KAUTH_ACL_SIZE((p)->acl_entrycount)
392*5c2921b0SApple OSS Distributions 
393*5c2921b0SApple OSS Distributions 
394*5c2921b0SApple OSS Distributions #ifndef _KAUTH_ACL
395*5c2921b0SApple OSS Distributions #define _KAUTH_ACL
396*5c2921b0SApple OSS Distributions typedef struct kauth_acl *kauth_acl_t;
397*5c2921b0SApple OSS Distributions #endif
398*5c2921b0SApple OSS Distributions 
399*5c2921b0SApple OSS Distributions #ifdef KERNEL
400*5c2921b0SApple OSS Distributions __BEGIN_DECLS
401*5c2921b0SApple OSS Distributions kauth_acl_t     kauth_acl_alloc(int size);
402*5c2921b0SApple OSS Distributions void            kauth_acl_free(kauth_acl_t fsp);
403*5c2921b0SApple OSS Distributions __END_DECLS
404*5c2921b0SApple OSS Distributions #endif
405*5c2921b0SApple OSS Distributions 
406*5c2921b0SApple OSS Distributions 
407*5c2921b0SApple OSS Distributions /*
408*5c2921b0SApple OSS Distributions  * Extended File Security.
409*5c2921b0SApple OSS Distributions  */
410*5c2921b0SApple OSS Distributions 
411*5c2921b0SApple OSS Distributions /* File Security information */
412*5c2921b0SApple OSS Distributions struct kauth_filesec {
413*5c2921b0SApple OSS Distributions 	u_int32_t       fsec_magic;
414*5c2921b0SApple OSS Distributions #define KAUTH_FILESEC_MAGIC     0x012cc16d
415*5c2921b0SApple OSS Distributions 	guid_t          fsec_owner;
416*5c2921b0SApple OSS Distributions 	guid_t          fsec_group;
417*5c2921b0SApple OSS Distributions 
418*5c2921b0SApple OSS Distributions 	struct kauth_acl fsec_acl;
419*5c2921b0SApple OSS Distributions };
420*5c2921b0SApple OSS Distributions 
421*5c2921b0SApple OSS Distributions /* backwards compatibility */
422*5c2921b0SApple OSS Distributions #define fsec_entrycount fsec_acl.acl_entrycount
423*5c2921b0SApple OSS Distributions #define fsec_flags      fsec_acl.acl_flags
424*5c2921b0SApple OSS Distributions #define fsec_ace        fsec_acl.acl_ace
425*5c2921b0SApple OSS Distributions #define KAUTH_FILESEC_FLAGS_PRIVATE     KAUTH_ACL_FLAGS_PRIVATE
426*5c2921b0SApple OSS Distributions #define KAUTH_FILESEC_DEFER_INHERIT     KAUTH_ACL_DEFER_INHERIT
427*5c2921b0SApple OSS Distributions #define KAUTH_FILESEC_NO_INHERIT        KAUTH_ACL_NO_INHERIT
428*5c2921b0SApple OSS Distributions #define KAUTH_FILESEC_NONE      ((kauth_filesec_t)0)
429*5c2921b0SApple OSS Distributions #define KAUTH_FILESEC_WANTED    ((kauth_filesec_t)1)
430*5c2921b0SApple OSS Distributions 
431*5c2921b0SApple OSS Distributions #ifndef _KAUTH_FILESEC
432*5c2921b0SApple OSS Distributions #define _KAUTH_FILESEC
433*5c2921b0SApple OSS Distributions typedef struct kauth_filesec *kauth_filesec_t;
434*5c2921b0SApple OSS Distributions #endif
435*5c2921b0SApple OSS Distributions 
436*5c2921b0SApple OSS Distributions #define KAUTH_FILESEC_SIZE(c)           (__offsetof(struct kauth_filesec, fsec_acl) + __offsetof(struct kauth_acl, acl_ace) + (c) * sizeof(struct kauth_ace))
437*5c2921b0SApple OSS Distributions #define KAUTH_FILESEC_COPYSIZE(p)       KAUTH_FILESEC_SIZE(((p)->fsec_entrycount == KAUTH_FILESEC_NOACL) ? 0 : (p)->fsec_entrycount)
438*5c2921b0SApple OSS Distributions #define KAUTH_FILESEC_COUNT(s)          (((s)  - KAUTH_FILESEC_SIZE(0)) / sizeof(struct kauth_ace))
439*5c2921b0SApple OSS Distributions #define KAUTH_FILESEC_VALID(s)          ((s) >= KAUTH_FILESEC_SIZE(0) && (((s) - KAUTH_FILESEC_SIZE(0)) % sizeof(struct kauth_ace)) == 0)
440*5c2921b0SApple OSS Distributions 
441*5c2921b0SApple OSS Distributions #define KAUTH_FILESEC_XATTR     "com.apple.system.Security"
442*5c2921b0SApple OSS Distributions 
443*5c2921b0SApple OSS Distributions /* Allowable first arguments to kauth_filesec_acl_setendian() */
444*5c2921b0SApple OSS Distributions #define KAUTH_ENDIAN_HOST       0x00000001      /* set host endianness */
445*5c2921b0SApple OSS Distributions #define KAUTH_ENDIAN_DISK       0x00000002      /* set disk endianness */
446*5c2921b0SApple OSS Distributions 
447*5c2921b0SApple OSS Distributions #endif /* KERNEL || <sys/acl.h> */
448*5c2921b0SApple OSS Distributions 
449*5c2921b0SApple OSS Distributions 
450*5c2921b0SApple OSS Distributions #ifdef KERNEL
451*5c2921b0SApple OSS Distributions 
452*5c2921b0SApple OSS Distributions 
453*5c2921b0SApple OSS Distributions /*
454*5c2921b0SApple OSS Distributions  * Scope management.
455*5c2921b0SApple OSS Distributions  */
456*5c2921b0SApple OSS Distributions struct kauth_scope;
457*5c2921b0SApple OSS Distributions typedef struct kauth_scope *kauth_scope_t;
458*5c2921b0SApple OSS Distributions struct kauth_listener;
459*5c2921b0SApple OSS Distributions typedef struct kauth_listener *kauth_listener_t;
460*5c2921b0SApple OSS Distributions #ifndef _KAUTH_ACTION_T
461*5c2921b0SApple OSS Distributions typedef int kauth_action_t;
462*5c2921b0SApple OSS Distributions # define _KAUTH_ACTION_T
463*5c2921b0SApple OSS Distributions #endif
464*5c2921b0SApple OSS Distributions 
465*5c2921b0SApple OSS Distributions typedef int (* kauth_scope_callback_t)(kauth_cred_t _credential,
466*5c2921b0SApple OSS Distributions     void *_idata,
467*5c2921b0SApple OSS Distributions     kauth_action_t _action,
468*5c2921b0SApple OSS Distributions     uintptr_t _arg0,
469*5c2921b0SApple OSS Distributions     uintptr_t _arg1,
470*5c2921b0SApple OSS Distributions     uintptr_t _arg2,
471*5c2921b0SApple OSS Distributions     uintptr_t _arg3);
472*5c2921b0SApple OSS Distributions 
473*5c2921b0SApple OSS Distributions #define KAUTH_RESULT_ALLOW      (1)
474*5c2921b0SApple OSS Distributions #define KAUTH_RESULT_DENY       (2)
475*5c2921b0SApple OSS Distributions #define KAUTH_RESULT_DEFER      (3)
476*5c2921b0SApple OSS Distributions 
477*5c2921b0SApple OSS Distributions struct kauth_acl_eval {
478*5c2921b0SApple OSS Distributions 	kauth_ace_t             ae_acl;
479*5c2921b0SApple OSS Distributions 	int                     ae_count;
480*5c2921b0SApple OSS Distributions 	kauth_ace_rights_t      ae_requested;
481*5c2921b0SApple OSS Distributions 	kauth_ace_rights_t      ae_residual;
482*5c2921b0SApple OSS Distributions 	int                     ae_result;
483*5c2921b0SApple OSS Distributions 	boolean_t               ae_found_deny;
484*5c2921b0SApple OSS Distributions 	int                     ae_options;
485*5c2921b0SApple OSS Distributions #define KAUTH_AEVAL_IS_OWNER    (1<<0)          /* authorizing operation for owner */
486*5c2921b0SApple OSS Distributions #define KAUTH_AEVAL_IN_GROUP    (1<<1)          /* authorizing operation for groupmember */
487*5c2921b0SApple OSS Distributions #define KAUTH_AEVAL_IN_GROUP_UNKNOWN    (1<<2)          /* authorizing operation for unknown group membership */
488*5c2921b0SApple OSS Distributions 	/* expansions for 'generic' rights bits */
489*5c2921b0SApple OSS Distributions 	kauth_ace_rights_t      ae_exp_gall;
490*5c2921b0SApple OSS Distributions 	kauth_ace_rights_t      ae_exp_gread;
491*5c2921b0SApple OSS Distributions 	kauth_ace_rights_t      ae_exp_gwrite;
492*5c2921b0SApple OSS Distributions 	kauth_ace_rights_t      ae_exp_gexec;
493*5c2921b0SApple OSS Distributions };
494*5c2921b0SApple OSS Distributions 
495*5c2921b0SApple OSS Distributions typedef struct kauth_acl_eval *kauth_acl_eval_t;
496*5c2921b0SApple OSS Distributions 
497*5c2921b0SApple OSS Distributions __BEGIN_DECLS
498*5c2921b0SApple OSS Distributions kauth_filesec_t kauth_filesec_alloc(int size);
499*5c2921b0SApple OSS Distributions void            kauth_filesec_free(kauth_filesec_t fsp);
500*5c2921b0SApple OSS Distributions extern kauth_scope_t kauth_register_scope(const char *_identifier, kauth_scope_callback_t _callback, void *_idata);
501*5c2921b0SApple OSS Distributions extern void     kauth_deregister_scope(kauth_scope_t _scope);
502*5c2921b0SApple OSS Distributions __kpi_deprecated("Use EndpointSecurity instead")
503*5c2921b0SApple OSS Distributions extern kauth_listener_t kauth_listen_scope(const char *_identifier, kauth_scope_callback_t _callback, void *_idata);
504*5c2921b0SApple OSS Distributions __kpi_deprecated("Use EndpointSecurity instead")
505*5c2921b0SApple OSS Distributions extern void     kauth_unlisten_scope(kauth_listener_t _scope);
506*5c2921b0SApple OSS Distributions extern int      kauth_authorize_action(kauth_scope_t _scope, kauth_cred_t _credential, kauth_action_t _action,
507*5c2921b0SApple OSS Distributions     uintptr_t _arg0, uintptr_t _arg1, uintptr_t _arg2, uintptr_t _arg3);
508*5c2921b0SApple OSS Distributions 
509*5c2921b0SApple OSS Distributions /* default scope handlers */
510*5c2921b0SApple OSS Distributions extern int      kauth_authorize_allow(kauth_cred_t _credential, void *_idata, kauth_action_t _action,
511*5c2921b0SApple OSS Distributions     uintptr_t _arg0, uintptr_t _arg1, uintptr_t _arg2, uintptr_t _arg3);
512*5c2921b0SApple OSS Distributions 
513*5c2921b0SApple OSS Distributions #ifdef KERNEL_PRIVATE
514*5c2921b0SApple OSS Distributions extern int      kauth_acl_evaluate(kauth_cred_t _credential, kauth_acl_eval_t _eval);
515*5c2921b0SApple OSS Distributions 
516*5c2921b0SApple OSS Distributions #endif /* KERNEL_PRIVATE */
517*5c2921b0SApple OSS Distributions 
518*5c2921b0SApple OSS Distributions 
519*5c2921b0SApple OSS Distributions #ifdef XNU_KERNEL_PRIVATE
520*5c2921b0SApple OSS Distributions void            kauth_filesec_acl_setendian(int, kauth_filesec_t, kauth_acl_t);
521*5c2921b0SApple OSS Distributions int             kauth_copyinfilesec(user_addr_t xsecurity, kauth_filesec_t *xsecdestpp);
522*5c2921b0SApple OSS Distributions extern int      kauth_acl_inherit(vnode_t _dvp, kauth_acl_t _initial, kauth_acl_t *_product, int _isdir, vfs_context_t _ctx);
523*5c2921b0SApple OSS Distributions 
524*5c2921b0SApple OSS Distributions #endif /* XNU_KERNEL_PRIVATE */
525*5c2921b0SApple OSS Distributions 
526*5c2921b0SApple OSS Distributions 
527*5c2921b0SApple OSS Distributions __END_DECLS
528*5c2921b0SApple OSS Distributions 
529*5c2921b0SApple OSS Distributions /*
530*5c2921b0SApple OSS Distributions  * Generic scope.
531*5c2921b0SApple OSS Distributions  */
532*5c2921b0SApple OSS Distributions #define KAUTH_SCOPE_GENERIC     "com.apple.kauth.generic"
533*5c2921b0SApple OSS Distributions 
534*5c2921b0SApple OSS Distributions /* Actions */
535*5c2921b0SApple OSS Distributions #define KAUTH_GENERIC_ISSUSER                   1
536*5c2921b0SApple OSS Distributions 
537*5c2921b0SApple OSS Distributions #ifdef XNU_KERNEL_PRIVATE
538*5c2921b0SApple OSS Distributions __BEGIN_DECLS
539*5c2921b0SApple OSS Distributions extern int      kauth_authorize_generic(kauth_cred_t credential, kauth_action_t action);
540*5c2921b0SApple OSS Distributions __END_DECLS
541*5c2921b0SApple OSS Distributions #endif /* XNU_KERNEL_PRIVATE */
542*5c2921b0SApple OSS Distributions 
543*5c2921b0SApple OSS Distributions /*
544*5c2921b0SApple OSS Distributions  * Process/task scope.
545*5c2921b0SApple OSS Distributions  */
546*5c2921b0SApple OSS Distributions #define KAUTH_SCOPE_PROCESS     "com.apple.kauth.process"
547*5c2921b0SApple OSS Distributions 
548*5c2921b0SApple OSS Distributions /* Actions */
549*5c2921b0SApple OSS Distributions #define KAUTH_PROCESS_CANSIGNAL                 1
550*5c2921b0SApple OSS Distributions #define KAUTH_PROCESS_CANTRACE                  2
551*5c2921b0SApple OSS Distributions 
552*5c2921b0SApple OSS Distributions __BEGIN_DECLS
553*5c2921b0SApple OSS Distributions extern int      kauth_authorize_process(kauth_cred_t _credential, kauth_action_t _action,
554*5c2921b0SApple OSS Distributions     struct proc *_process, uintptr_t _arg1, uintptr_t _arg2, uintptr_t _arg3);
555*5c2921b0SApple OSS Distributions __END_DECLS
556*5c2921b0SApple OSS Distributions 
557*5c2921b0SApple OSS Distributions /*
558*5c2921b0SApple OSS Distributions  * Vnode operation scope.
559*5c2921b0SApple OSS Distributions  *
560*5c2921b0SApple OSS Distributions  * Prototype for vnode_authorize is in vnode.h
561*5c2921b0SApple OSS Distributions  */
562*5c2921b0SApple OSS Distributions #define KAUTH_SCOPE_VNODE       "com.apple.kauth.vnode"
563*5c2921b0SApple OSS Distributions 
564*5c2921b0SApple OSS Distributions /*
565*5c2921b0SApple OSS Distributions  * File system operation scope.
566*5c2921b0SApple OSS Distributions  *
567*5c2921b0SApple OSS Distributions  */
568*5c2921b0SApple OSS Distributions #define KAUTH_SCOPE_FILEOP      "com.apple.kauth.fileop"
569*5c2921b0SApple OSS Distributions 
570*5c2921b0SApple OSS Distributions /* Actions */
571*5c2921b0SApple OSS Distributions #define KAUTH_FILEOP_OPEN                       1
572*5c2921b0SApple OSS Distributions #define KAUTH_FILEOP_CLOSE                      2
573*5c2921b0SApple OSS Distributions #define KAUTH_FILEOP_RENAME                     3
574*5c2921b0SApple OSS Distributions #define KAUTH_FILEOP_EXCHANGE                   4
575*5c2921b0SApple OSS Distributions #define KAUTH_FILEOP_LINK                       5
576*5c2921b0SApple OSS Distributions #define KAUTH_FILEOP_EXEC                       6
577*5c2921b0SApple OSS Distributions #define KAUTH_FILEOP_DELETE                     7
578*5c2921b0SApple OSS Distributions #define KAUTH_FILEOP_WILL_RENAME                8
579*5c2921b0SApple OSS Distributions 
580*5c2921b0SApple OSS Distributions /*
581*5c2921b0SApple OSS Distributions  * arguments passed to KAUTH_FILEOP_OPEN listeners
582*5c2921b0SApple OSS Distributions  *		arg0 is pointer to vnode (vnode *) for given user path.
583*5c2921b0SApple OSS Distributions  *		arg1 is pointer to path (char *) passed in to open.
584*5c2921b0SApple OSS Distributions  * arguments passed to KAUTH_FILEOP_CLOSE listeners
585*5c2921b0SApple OSS Distributions  *		arg0 is pointer to vnode (vnode *) for file to be closed.
586*5c2921b0SApple OSS Distributions  *		arg1 is pointer to path (char *) of file to be closed.
587*5c2921b0SApple OSS Distributions  *		arg2 is close flags.
588*5c2921b0SApple OSS Distributions  * arguments passed to KAUTH_FILEOP_WILL_RENAME listeners
589*5c2921b0SApple OSS Distributions  *		arg0 is pointer to vnode (vnode *) of the file being renamed
590*5c2921b0SApple OSS Distributions  *		arg1 is pointer to the "from" path (char *)
591*5c2921b0SApple OSS Distributions  *		arg2 is pointer to the "to" path (char *)
592*5c2921b0SApple OSS Distributions  * arguments passed to KAUTH_FILEOP_RENAME listeners
593*5c2921b0SApple OSS Distributions  *		arg0 is pointer to "from" path (char *).
594*5c2921b0SApple OSS Distributions  *		arg1 is pointer to "to" path (char *).
595*5c2921b0SApple OSS Distributions  * arguments passed to KAUTH_FILEOP_EXCHANGE listeners
596*5c2921b0SApple OSS Distributions  *		arg0 is pointer to file 1 path (char *).
597*5c2921b0SApple OSS Distributions  *		arg1 is pointer to file 2 path (char *).
598*5c2921b0SApple OSS Distributions  * arguments passed to KAUTH_FILEOP_LINK listeners
599*5c2921b0SApple OSS Distributions  *		arg0 is pointer to path to file we are linking to (char *).
600*5c2921b0SApple OSS Distributions  *		arg1 is pointer to path to the new link file (char *).
601*5c2921b0SApple OSS Distributions  * arguments passed to KAUTH_FILEOP_EXEC listeners
602*5c2921b0SApple OSS Distributions  *		arg0 is pointer to vnode (vnode *) for executable.
603*5c2921b0SApple OSS Distributions  *		arg1 is pointer to path (char *) to executable.
604*5c2921b0SApple OSS Distributions  * arguments passed to KAUTH_FILEOP_DELETE listeners
605*5c2921b0SApple OSS Distributions  *		arg0 is pointer to vnode (vnode *) of file/dir that was deleted.
606*5c2921b0SApple OSS Distributions  *		arg1 is pointer to path (char *) of file/dir that was deleted.
607*5c2921b0SApple OSS Distributions  */
608*5c2921b0SApple OSS Distributions 
609*5c2921b0SApple OSS Distributions /* Flag values returned to close listeners. */
610*5c2921b0SApple OSS Distributions #define KAUTH_FILEOP_CLOSE_MODIFIED                     (1<<1)
611*5c2921b0SApple OSS Distributions 
612*5c2921b0SApple OSS Distributions __BEGIN_DECLS
613*5c2921b0SApple OSS Distributions #ifdef XNU_KERNEL_PRIVATE
614*5c2921b0SApple OSS Distributions extern int      kauth_authorize_fileop_has_listeners(void);
615*5c2921b0SApple OSS Distributions #endif /* XNU_KERNEL_PRIVATE */
616*5c2921b0SApple OSS Distributions extern int      kauth_authorize_fileop(kauth_cred_t _credential, kauth_action_t _action,
617*5c2921b0SApple OSS Distributions     uintptr_t _arg0, uintptr_t _arg1);
618*5c2921b0SApple OSS Distributions __END_DECLS
619*5c2921b0SApple OSS Distributions 
620*5c2921b0SApple OSS Distributions #endif /* KERNEL */
621*5c2921b0SApple OSS Distributions 
622*5c2921b0SApple OSS Distributions /* Actions, also rights bits in an ACE */
623*5c2921b0SApple OSS Distributions 
624*5c2921b0SApple OSS Distributions #if defined(KERNEL) || defined (_SYS_ACL_H)
625*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_READ_DATA                   (1U<<1)
626*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_LIST_DIRECTORY              KAUTH_VNODE_READ_DATA
627*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_WRITE_DATA                  (1U<<2)
628*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_ADD_FILE                    KAUTH_VNODE_WRITE_DATA
629*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_EXECUTE                     (1U<<3)
630*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_SEARCH                      KAUTH_VNODE_EXECUTE
631*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_DELETE                      (1U<<4)
632*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_APPEND_DATA                 (1U<<5)
633*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_ADD_SUBDIRECTORY            KAUTH_VNODE_APPEND_DATA
634*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_DELETE_CHILD                (1U<<6)
635*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_READ_ATTRIBUTES             (1U<<7)
636*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_WRITE_ATTRIBUTES            (1U<<8)
637*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_READ_EXTATTRIBUTES          (1U<<9)
638*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_WRITE_EXTATTRIBUTES         (1U<<10)
639*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_READ_SECURITY               (1U<<11)
640*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_WRITE_SECURITY              (1U<<12)
641*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_TAKE_OWNERSHIP              (1U<<13)
642*5c2921b0SApple OSS Distributions 
643*5c2921b0SApple OSS Distributions /* backwards compatibility only */
644*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_CHANGE_OWNER                KAUTH_VNODE_TAKE_OWNERSHIP
645*5c2921b0SApple OSS Distributions 
646*5c2921b0SApple OSS Distributions /* For Windows interoperability only */
647*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_SYNCHRONIZE                 (1U<<20)
648*5c2921b0SApple OSS Distributions 
649*5c2921b0SApple OSS Distributions /* (1<<21) - (1<<24) are reserved for generic rights bits */
650*5c2921b0SApple OSS Distributions 
651*5c2921b0SApple OSS Distributions /* Actions not expressed as rights bits */
652*5c2921b0SApple OSS Distributions /*
653*5c2921b0SApple OSS Distributions  * Authorizes the vnode as the target of a hard link.
654*5c2921b0SApple OSS Distributions  */
655*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_LINKTARGET                  (1U<<25)
656*5c2921b0SApple OSS Distributions 
657*5c2921b0SApple OSS Distributions /*
658*5c2921b0SApple OSS Distributions  * Indicates that other steps have been taken to authorise the action,
659*5c2921b0SApple OSS Distributions  * but authorisation should be denied for immutable objects.
660*5c2921b0SApple OSS Distributions  */
661*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_CHECKIMMUTABLE              (1U<<26)
662*5c2921b0SApple OSS Distributions 
663*5c2921b0SApple OSS Distributions /* Action modifiers */
664*5c2921b0SApple OSS Distributions /*
665*5c2921b0SApple OSS Distributions  * The KAUTH_VNODE_ACCESS bit is passed to the callback if the authorisation
666*5c2921b0SApple OSS Distributions  * request in progress is advisory, rather than authoritative.  Listeners
667*5c2921b0SApple OSS Distributions  * performing consequential work (i.e. not strictly checking authorisation)
668*5c2921b0SApple OSS Distributions  * may test this flag to avoid performing unnecessary work.
669*5c2921b0SApple OSS Distributions  *
670*5c2921b0SApple OSS Distributions  * This bit will never be present in an ACE.
671*5c2921b0SApple OSS Distributions  */
672*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_ACCESS                      (1U<<31)
673*5c2921b0SApple OSS Distributions 
674*5c2921b0SApple OSS Distributions /*
675*5c2921b0SApple OSS Distributions  * The KAUTH_VNODE_NOIMMUTABLE bit is passed to the callback along with the
676*5c2921b0SApple OSS Distributions  * KAUTH_VNODE_WRITE_SECURITY bit (and no others) to indicate that the
677*5c2921b0SApple OSS Distributions  * caller wishes to change one or more of the immutable flags, and the
678*5c2921b0SApple OSS Distributions  * state of these flags should not be considered when authorizing the request.
679*5c2921b0SApple OSS Distributions  * The system immutable flags are only ignored when the system securelevel
680*5c2921b0SApple OSS Distributions  * is low enough to allow their removal.
681*5c2921b0SApple OSS Distributions  */
682*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_NOIMMUTABLE                 (1U<<30)
683*5c2921b0SApple OSS Distributions 
684*5c2921b0SApple OSS Distributions 
685*5c2921b0SApple OSS Distributions /*
686*5c2921b0SApple OSS Distributions  * fake right that is composed by the following...
687*5c2921b0SApple OSS Distributions  * vnode must have search for owner, group and world allowed
688*5c2921b0SApple OSS Distributions  * plus there must be no deny modes present for SEARCH... this fake
689*5c2921b0SApple OSS Distributions  * right is used by the fast lookup path to avoid checking
690*5c2921b0SApple OSS Distributions  * for an exact match on the last credential to lookup
691*5c2921b0SApple OSS Distributions  * the component being acted on
692*5c2921b0SApple OSS Distributions  */
693*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_SEARCHBYANYONE              (1U<<29)
694*5c2921b0SApple OSS Distributions 
695*5c2921b0SApple OSS Distributions 
696*5c2921b0SApple OSS Distributions /*
697*5c2921b0SApple OSS Distributions  * when passed as an 'action' to "vnode_uncache_authorized_actions"
698*5c2921b0SApple OSS Distributions  * it indicates that all of the cached authorizations for that
699*5c2921b0SApple OSS Distributions  * vnode should be invalidated
700*5c2921b0SApple OSS Distributions  */
701*5c2921b0SApple OSS Distributions #define KAUTH_INVALIDATE_CACHED_RIGHTS          ((kauth_action_t)~0)
702*5c2921b0SApple OSS Distributions 
703*5c2921b0SApple OSS Distributions 
704*5c2921b0SApple OSS Distributions 
705*5c2921b0SApple OSS Distributions /* The expansions of the GENERIC bits at evaluation time */
706*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_GENERIC_READ_BITS   (KAUTH_VNODE_READ_DATA |                \
707*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_READ_ATTRIBUTES |           \
708*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_READ_EXTATTRIBUTES |        \
709*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_READ_SECURITY)
710*5c2921b0SApple OSS Distributions 
711*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_GENERIC_WRITE_BITS  (KAUTH_VNODE_WRITE_DATA |               \
712*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_APPEND_DATA |               \
713*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_DELETE |                    \
714*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_DELETE_CHILD |              \
715*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_WRITE_ATTRIBUTES |          \
716*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_WRITE_EXTATTRIBUTES |       \
717*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_WRITE_SECURITY)
718*5c2921b0SApple OSS Distributions 
719*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_GENERIC_EXECUTE_BITS (KAUTH_VNODE_EXECUTE)
720*5c2921b0SApple OSS Distributions 
721*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_GENERIC_ALL_BITS    (KAUTH_VNODE_GENERIC_READ_BITS |        \
722*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_GENERIC_WRITE_BITS |        \
723*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_GENERIC_EXECUTE_BITS)
724*5c2921b0SApple OSS Distributions 
725*5c2921b0SApple OSS Distributions /*
726*5c2921b0SApple OSS Distributions  * Some sets of bits, defined here for convenience.
727*5c2921b0SApple OSS Distributions  */
728*5c2921b0SApple OSS Distributions #define KAUTH_VNODE_WRITE_RIGHTS        (KAUTH_VNODE_ADD_FILE |                         \
729*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_ADD_SUBDIRECTORY |                  \
730*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_DELETE_CHILD |                      \
731*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_WRITE_DATA |                        \
732*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_APPEND_DATA |                       \
733*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_DELETE |                            \
734*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_WRITE_ATTRIBUTES |                  \
735*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_WRITE_EXTATTRIBUTES |               \
736*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_WRITE_SECURITY |                    \
737*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_TAKE_OWNERSHIP |                    \
738*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_LINKTARGET |                        \
739*5c2921b0SApple OSS Distributions 	                                KAUTH_VNODE_CHECKIMMUTABLE)
740*5c2921b0SApple OSS Distributions 
741*5c2921b0SApple OSS Distributions 
742*5c2921b0SApple OSS Distributions #endif /* KERNEL || <sys/acl.h> */
743*5c2921b0SApple OSS Distributions 
744*5c2921b0SApple OSS Distributions #ifdef KERNEL
745*5c2921b0SApple OSS Distributions #include <sys/lock.h>   /* lck_grp_t */
746*5c2921b0SApple OSS Distributions 
747*5c2921b0SApple OSS Distributions /*
748*5c2921b0SApple OSS Distributions  * Debugging
749*5c2921b0SApple OSS Distributions  *
750*5c2921b0SApple OSS Distributions  * XXX this wouldn't be necessary if we had a *real* debug-logging system.
751*5c2921b0SApple OSS Distributions  */
752*5c2921b0SApple OSS Distributions #if 0
753*5c2921b0SApple OSS Distributions # ifndef _FN_KPRINTF
754*5c2921b0SApple OSS Distributions #  define       _FN_KPRINTF
755*5c2921b0SApple OSS Distributions void kprintf(const char *fmt, ...) __printflike(1, 2);
756*5c2921b0SApple OSS Distributions # endif /* !_FN_KPRINTF */
757*5c2921b0SApple OSS Distributions # define KAUTH_DEBUG_ENABLE
758*5c2921b0SApple OSS Distributions # define K_UUID_FMT "%08x:%08x:%08x:%08x"
759*5c2921b0SApple OSS Distributions # define K_UUID_ARG(_u) &_u.g_guid_asint[0],&_u.g_guid_asint[1],&_u.g_guid_asint[2],&_u.g_guid_asint[3]
760*5c2921b0SApple OSS Distributions # define KAUTH_DEBUG(fmt, args...)      do { kprintf("%s:%d: " fmt "\n", __PRETTY_FUNCTION__, __LINE__ , ##args); } while (0)
761*5c2921b0SApple OSS Distributions # define KAUTH_DEBUG_CTX(_c)            KAUTH_DEBUG("p = %p c = %p", _c->vc_proc, _c->vc_ucred)
762*5c2921b0SApple OSS Distributions # define VFS_DEBUG(_ctx, _vp, fmt, args...)                                             \
763*5c2921b0SApple OSS Distributions 	do {                                                                            \
764*5c2921b0SApple OSS Distributions 	        kprintf("%p '%s' %s:%d " fmt "\n",                                      \
765*5c2921b0SApple OSS Distributions 	            _ctx,                                                               \
766*5c2921b0SApple OSS Distributions 	            (_vp != NULL && _vp->v_name != NULL) ? _vp->v_name : "????",        \
767*5c2921b0SApple OSS Distributions 	            __PRETTY_FUNCTION__, __LINE__ ,                                     \
768*5c2921b0SApple OSS Distributions 	            ##args);                                                            \
769*5c2921b0SApple OSS Distributions 	} while(0)
770*5c2921b0SApple OSS Distributions #else   /* !0 */
771*5c2921b0SApple OSS Distributions # define KAUTH_DEBUG(fmt, args...)              do { } while (0)
772*5c2921b0SApple OSS Distributions # define VFS_DEBUG(ctx, vp, fmt, args...)       do { } while(0)
773*5c2921b0SApple OSS Distributions #endif  /* !0 */
774*5c2921b0SApple OSS Distributions 
775*5c2921b0SApple OSS Distributions /*
776*5c2921b0SApple OSS Distributions  * Initialisation.
777*5c2921b0SApple OSS Distributions  */
778*5c2921b0SApple OSS Distributions #ifdef XNU_KERNEL_PRIVATE
779*5c2921b0SApple OSS Distributions __BEGIN_DECLS
780*5c2921b0SApple OSS Distributions 
781*5c2921b0SApple OSS Distributions extern lck_grp_t kauth_lck_grp;
782*5c2921b0SApple OSS Distributions 
783*5c2921b0SApple OSS Distributions extern void     kauth_init(void);
784*5c2921b0SApple OSS Distributions /*
785*5c2921b0SApple OSS Distributions  * If you need accounting for KM_KAUTH consider using
786*5c2921b0SApple OSS Distributions  * KALLOC_HEAP_DEFINE to define a view.
787*5c2921b0SApple OSS Distributions  */
788*5c2921b0SApple OSS Distributions #define KM_KAUTH     KHEAP_DEFAULT
789*5c2921b0SApple OSS Distributions #if CONFIG_EXT_RESOLVER
790*5c2921b0SApple OSS Distributions extern void     kauth_resolver_identity_reset(void);
791*5c2921b0SApple OSS Distributions #endif
792*5c2921b0SApple OSS Distributions __END_DECLS
793*5c2921b0SApple OSS Distributions #endif /* XNU_KERNEL_PRIVATE */
794*5c2921b0SApple OSS Distributions 
795*5c2921b0SApple OSS Distributions #endif  /* KERNEL */
796*5c2921b0SApple OSS Distributions 
797*5c2921b0SApple OSS Distributions #endif /* __APPLE_API_EVOLVING */
798*5c2921b0SApple OSS Distributions #endif /* _SYS_KAUTH_H */
799