* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
#include <sys/_types/_guid_t.h>
/* NT Security Identifier, structure as defined by Microsoft */
#pragma pack(1) /* push packing of 1 byte */
typedef struct {
#include <sys/_types/_guid_t.h>
/* NT Security Identifier, structure as defined by Microsoft */
#pragma pack(1) /* push packing of 1 byte */
typedef struct {
- u_int32_t el_seqno; /* request sequence number */
- u_int32_t el_result; /* lookup result */
-#define KAUTH_EXTLOOKUP_SUCCESS 0 /* results here are good */
-#define KAUTH_EXTLOOKUP_BADRQ 1 /* request badly formatted */
-#define KAUTH_EXTLOOKUP_FAILURE 2 /* transient failure during lookup */
-#define KAUTH_EXTLOOKUP_FATAL 3 /* permanent failure during lookup */
-#define KAUTH_EXTLOOKUP_INPROG 100 /* request in progress */
- u_int32_t el_flags;
-#define KAUTH_EXTLOOKUP_VALID_UID (1<<0)
-#define KAUTH_EXTLOOKUP_VALID_UGUID (1<<1)
-#define KAUTH_EXTLOOKUP_VALID_USID (1<<2)
-#define KAUTH_EXTLOOKUP_VALID_GID (1<<3)
-#define KAUTH_EXTLOOKUP_VALID_GGUID (1<<4)
-#define KAUTH_EXTLOOKUP_VALID_GSID (1<<5)
-#define KAUTH_EXTLOOKUP_WANT_UID (1<<6)
-#define KAUTH_EXTLOOKUP_WANT_UGUID (1<<7)
-#define KAUTH_EXTLOOKUP_WANT_USID (1<<8)
-#define KAUTH_EXTLOOKUP_WANT_GID (1<<9)
-#define KAUTH_EXTLOOKUP_WANT_GGUID (1<<10)
-#define KAUTH_EXTLOOKUP_WANT_GSID (1<<11)
-#define KAUTH_EXTLOOKUP_WANT_MEMBERSHIP (1<<12)
+ u_int32_t el_seqno; /* request sequence number */
+ u_int32_t el_result; /* lookup result */
+#define KAUTH_EXTLOOKUP_SUCCESS 0 /* results here are good */
+#define KAUTH_EXTLOOKUP_BADRQ 1 /* request badly formatted */
+#define KAUTH_EXTLOOKUP_FAILURE 2 /* transient failure during lookup */
+#define KAUTH_EXTLOOKUP_FATAL 3 /* permanent failure during lookup */
+#define KAUTH_EXTLOOKUP_INPROG 100 /* request in progress */
+ u_int32_t el_flags;
+#define KAUTH_EXTLOOKUP_VALID_UID (1<<0)
+#define KAUTH_EXTLOOKUP_VALID_UGUID (1<<1)
+#define KAUTH_EXTLOOKUP_VALID_USID (1<<2)
+#define KAUTH_EXTLOOKUP_VALID_GID (1<<3)
+#define KAUTH_EXTLOOKUP_VALID_GGUID (1<<4)
+#define KAUTH_EXTLOOKUP_VALID_GSID (1<<5)
+#define KAUTH_EXTLOOKUP_WANT_UID (1<<6)
+#define KAUTH_EXTLOOKUP_WANT_UGUID (1<<7)
+#define KAUTH_EXTLOOKUP_WANT_USID (1<<8)
+#define KAUTH_EXTLOOKUP_WANT_GID (1<<9)
+#define KAUTH_EXTLOOKUP_WANT_GGUID (1<<10)
+#define KAUTH_EXTLOOKUP_WANT_GSID (1<<11)
+#define KAUTH_EXTLOOKUP_WANT_MEMBERSHIP (1<<12)
-#define KAUTH_EXTLOOKUP_ISMEMBER (1<<14)
-#define KAUTH_EXTLOOKUP_VALID_PWNAM (1<<15)
-#define KAUTH_EXTLOOKUP_WANT_PWNAM (1<<16)
-#define KAUTH_EXTLOOKUP_VALID_GRNAM (1<<17)
-#define KAUTH_EXTLOOKUP_WANT_GRNAM (1<<18)
-#define KAUTH_EXTLOOKUP_VALID_SUPGRPS (1<<19)
-#define KAUTH_EXTLOOKUP_WANT_SUPGRPS (1<<20)
-
- __darwin_pid_t el_info_pid; /* request on behalf of PID */
- u_int64_t el_extend; /* extension field */
- u_int32_t el_info_reserved_1; /* reserved (APPLE) */
-
- uid_t el_uid; /* user ID */
- guid_t el_uguid; /* user GUID */
- u_int32_t el_uguid_valid; /* TTL on translation result (seconds) */
- ntsid_t el_usid; /* user NT SID */
- u_int32_t el_usid_valid; /* TTL on translation result (seconds) */
- gid_t el_gid; /* group ID */
- guid_t el_gguid; /* group GUID */
- u_int32_t el_gguid_valid; /* TTL on translation result (seconds) */
- ntsid_t el_gsid; /* group SID */
- u_int32_t el_gsid_valid; /* TTL on translation result (seconds) */
- u_int32_t el_member_valid; /* TTL on group lookup result */
- u_int32_t el_sup_grp_cnt; /* count of supplemental groups up to NGROUPS */
- gid_t el_sup_groups[NGROUPS_MAX]; /* supplemental group list */
+#define KAUTH_EXTLOOKUP_ISMEMBER (1<<14)
+#define KAUTH_EXTLOOKUP_VALID_PWNAM (1<<15)
+#define KAUTH_EXTLOOKUP_WANT_PWNAM (1<<16)
+#define KAUTH_EXTLOOKUP_VALID_GRNAM (1<<17)
+#define KAUTH_EXTLOOKUP_WANT_GRNAM (1<<18)
+#define KAUTH_EXTLOOKUP_VALID_SUPGRPS (1<<19)
+#define KAUTH_EXTLOOKUP_WANT_SUPGRPS (1<<20)
+
+ __darwin_pid_t el_info_pid; /* request on behalf of PID */
+ u_int64_t el_extend; /* extension field */
+ u_int32_t el_info_reserved_1; /* reserved (APPLE) */
+
+ uid_t el_uid; /* user ID */
+ guid_t el_uguid; /* user GUID */
+ u_int32_t el_uguid_valid; /* TTL on translation result (seconds) */
+ ntsid_t el_usid; /* user NT SID */
+ u_int32_t el_usid_valid; /* TTL on translation result (seconds) */
+ gid_t el_gid; /* group ID */
+ guid_t el_gguid; /* group GUID */
+ u_int32_t el_gguid_valid; /* TTL on translation result (seconds) */
+ ntsid_t el_gsid; /* group SID */
+ u_int32_t el_gsid_valid; /* TTL on translation result (seconds) */
+ u_int32_t el_member_valid; /* TTL on group lookup result */
+ u_int32_t el_sup_grp_cnt; /* count of supplemental groups up to NGROUPS */
+ gid_t el_sup_groups[NGROUPS_MAX]; /* supplemental group list */
-#define KAUTH_EXTLOOKUP_REGISTER (0)
-#define KAUTH_EXTLOOKUP_RESULT (1<<0)
-#define KAUTH_EXTLOOKUP_WORKER (1<<1)
-#define KAUTH_EXTLOOKUP_DEREGISTER (1<<2)
-#define KAUTH_GET_CACHE_SIZES (1<<3)
-#define KAUTH_SET_CACHE_SIZES (1<<4)
-#define KAUTH_CLEAR_CACHES (1<<5)
+#define KAUTH_EXTLOOKUP_REGISTER (0)
+#define KAUTH_EXTLOOKUP_RESULT (1<<0)
+#define KAUTH_EXTLOOKUP_WORKER (1<<1)
+#define KAUTH_EXTLOOKUP_DEREGISTER (1<<2)
+#define KAUTH_GET_CACHE_SIZES (1<<3)
+#define KAUTH_SET_CACHE_SIZES (1<<4)
+#define KAUTH_CLEAR_CACHES (1<<5)
+
+#define IDENTITYSVC_ENTITLEMENT "com.apple.private.identitysvc"
- TAILQ_ENTRY(kauth_cred) kc_link;
-
- int kc_ref; /* reference count */
- uid_t kc_uid; /* effective user id */
- uid_t kc_ruid; /* real user id */
- uid_t kc_svuid; /* saved user id */
- gid_t kc_gid; /* effective group id */
- gid_t kc_rgid; /* real group id */
- gid_t kc_svgid; /* saved group id */
-
- int kc_flags;
-#define KAUTH_CRED_GRPOVERRIDE (1<<0) /* private group list is authoritative */
-
- int kc_npvtgroups; /* private group list, advisory or authoritative */
- gid_t kc_pvtgroups[NGROUPS]; /* based on KAUTH_CRED_GRPOVERRIDE flag */
-
- int kc_nsuppgroups; /* supplementary group list */
- gid_t *kc_suppgroups;
-
- int kc_nwhtgroups; /* whiteout group list */
- gid_t *kc_whtgroups;
-
- struct au_session cr_audit; /* user auditing data */
-
- int kc_nsupplement; /* entry count in supplemental data pointer array */
+ TAILQ_ENTRY(kauth_cred) kc_link;
+
+ int kc_ref; /* reference count */
+ uid_t kc_uid; /* effective user id */
+ uid_t kc_ruid; /* real user id */
+ uid_t kc_svuid; /* saved user id */
+ gid_t kc_gid; /* effective group id */
+ gid_t kc_rgid; /* real group id */
+ gid_t kc_svgid; /* saved group id */
+
+ int kc_flags;
+#define KAUTH_CRED_GRPOVERRIDE (1<<0) /* private group list is authoritative */
+
+ int kc_npvtgroups; /* private group list, advisory or authoritative */
+ gid_t kc_pvtgroups[NGROUPS]; /* based on KAUTH_CRED_GRPOVERRIDE flag */
+
+ int kc_nsuppgroups; /* supplementary group list */
+ gid_t *kc_suppgroups;
+
+ int kc_nwhtgroups; /* whiteout group list */
+ gid_t *kc_whtgroups;
+
+ struct au_session cr_audit; /* user auditing data */
+
+ int kc_nsupplement; /* entry count in supplemental data pointer array */
extern void posix_cred_label(kauth_cred_t cred, posix_cred_t pcred);
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);
extern void posix_cred_label(kauth_cred_t cred, posix_cred_t pcred);
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);
extern kauth_cred_t kauth_cred_get(void);
extern kauth_cred_t kauth_cred_get_with_ref(void);
extern kauth_cred_t kauth_cred_proc_ref(proc_t procp);
extern kauth_cred_t kauth_cred_create(kauth_cred_t cred);
extern kauth_cred_t kauth_cred_get(void);
extern kauth_cred_t kauth_cred_get_with_ref(void);
extern kauth_cred_t kauth_cred_proc_ref(proc_t procp);
extern kauth_cred_t kauth_cred_create(kauth_cred_t cred);
-extern uid_t kauth_cred_getuid(kauth_cred_t _cred);
-extern uid_t kauth_cred_getruid(kauth_cred_t _cred);
-extern uid_t kauth_cred_getsvuid(kauth_cred_t _cred);
-extern gid_t kauth_cred_getgid(kauth_cred_t _cred);
-extern gid_t kauth_cred_getrgid(kauth_cred_t _cred);
-extern gid_t kauth_cred_getsvgid(kauth_cred_t _cred);
-extern int kauth_cred_pwnam2guid(char *pwnam, guid_t *guidp);
-extern int kauth_cred_grnam2guid(char *grnam, guid_t *guidp);
-extern int kauth_cred_guid2pwnam(guid_t *guidp, char *pwnam);
-extern int kauth_cred_guid2grnam(guid_t *guidp, char *grnam);
+extern uid_t kauth_cred_getuid(kauth_cred_t _cred);
+extern uid_t kauth_cred_getruid(kauth_cred_t _cred);
+extern uid_t kauth_cred_getsvuid(kauth_cred_t _cred);
+extern gid_t kauth_cred_getgid(kauth_cred_t _cred);
+extern gid_t kauth_cred_getrgid(kauth_cred_t _cred);
+extern gid_t kauth_cred_getsvgid(kauth_cred_t _cred);
+extern int kauth_cred_pwnam2guid(char *pwnam, guid_t *guidp);
+extern int kauth_cred_grnam2guid(char *grnam, guid_t *guidp);
+extern int kauth_cred_guid2pwnam(guid_t *guidp, char *pwnam);
+extern int kauth_cred_guid2grnam(guid_t *guidp, char *grnam);
extern int kauth_cred_guid2uid(guid_t *_guid, uid_t *_uidp);
extern int kauth_cred_guid2gid(guid_t *_guid, gid_t *_gidp);
extern int kauth_cred_ntsid2uid(ntsid_t *_sid, uid_t *_uidp);
extern int kauth_cred_ntsid2gid(ntsid_t *_sid, gid_t *_gidp);
extern int kauth_cred_ntsid2guid(ntsid_t *_sid, guid_t *_guidp);
extern int kauth_cred_uid2guid(uid_t _uid, guid_t *_guidp);
extern int kauth_cred_guid2uid(guid_t *_guid, uid_t *_uidp);
extern int kauth_cred_guid2gid(guid_t *_guid, gid_t *_gidp);
extern int kauth_cred_ntsid2uid(ntsid_t *_sid, uid_t *_uidp);
extern int kauth_cred_ntsid2gid(ntsid_t *_sid, gid_t *_gidp);
extern int kauth_cred_ntsid2guid(ntsid_t *_sid, guid_t *_guidp);
extern int kauth_cred_uid2guid(uid_t _uid, guid_t *_guidp);
-extern int kauth_cred_ismember_gid(kauth_cred_t _cred, gid_t _gid, int *_resultp);
-extern int kauth_cred_ismember_guid(kauth_cred_t _cred, guid_t *_guidp, int *_resultp);
+extern int kauth_cred_ismember_gid(kauth_cred_t _cred, gid_t _gid, int *_resultp);
+extern int kauth_cred_ismember_guid(kauth_cred_t _cred, guid_t *_guidp, int *_resultp);
+extern int kauth_cred_nfs4domain2dsnode(char *nfs4domain, char *dsnode);
+extern int kauth_cred_dsnode2nfs4domain(char *dsnode, char *nfs4domain);
-#ifdef XNU_KERNEL_PRIVATE
-extern int kauth_wellknown_guid(guid_t *_guid);
-#define KAUTH_WKG_NOT 0 /* not a well-known GUID */
-#define KAUTH_WKG_OWNER 1
-#define KAUTH_WKG_GROUP 2
-#define KAUTH_WKG_NOBODY 3
-#define KAUTH_WKG_EVERYBODY 4
-
-extern kauth_cred_t kauth_cred_dup(kauth_cred_t cred);
-extern gid_t kauth_getrgid(void);
-extern kauth_cred_t kauth_cred_alloc(void);
-extern int cantrace(proc_t cur_procp, kauth_cred_t creds, proc_t traced_procp, int *errp);
+extern int kauth_wellknown_guid(guid_t *_guid);
+#define KAUTH_WKG_NOT 0 /* not a well-known GUID */
+#define KAUTH_WKG_OWNER 1
+#define KAUTH_WKG_GROUP 2
+#define KAUTH_WKG_NOBODY 3
+#define KAUTH_WKG_EVERYBODY 4
+
+extern gid_t kauth_getrgid(void);
+extern int cantrace(proc_t cur_procp, kauth_cred_t creds, proc_t traced_procp, int *errp);
-extern kauth_cred_t kauth_cred_setresuid(kauth_cred_t cred, uid_t ruid, uid_t euid, uid_t svuid, uid_t gmuid);
-extern kauth_cred_t kauth_cred_setresgid(kauth_cred_t cred, gid_t rgid, gid_t egid, gid_t svgid);
+extern kauth_cred_t kauth_cred_setresuid(kauth_cred_t cred, uid_t ruid, uid_t euid, uid_t svuid, uid_t gmuid);
+extern kauth_cred_t kauth_cred_setresgid(kauth_cred_t cred, gid_t rgid, gid_t egid, gid_t svgid);
extern kauth_cred_t kauth_cred_setuidgid(kauth_cred_t cred, uid_t uid, gid_t gid);
extern kauth_cred_t kauth_cred_setsvuidgid(kauth_cred_t cred, uid_t uid, gid_t gid);
extern kauth_cred_t kauth_cred_setuidgid(kauth_cred_t cred, uid_t uid, gid_t gid);
extern kauth_cred_t kauth_cred_setsvuidgid(kauth_cred_t cred, uid_t uid, gid_t gid);
#ifdef CONFIG_MACF
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);
#endif
#ifdef CONFIG_MACF
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);
#endif
-extern int kauth_cred_getgroups(kauth_cred_t _cred, gid_t *_groups, int *_groupcount);
-extern int kauth_cred_assume(uid_t _uid);
-extern int kauth_cred_gid_subset(kauth_cred_t _cred1, kauth_cred_t _cred2, int *_resultp);
+extern int kauth_cred_getgroups(kauth_cred_t _cred, gid_t *_groups, int *_groupcount);
+extern int kauth_cred_gid_subset(kauth_cred_t _cred1, kauth_cred_t _cred2, int *_resultp);
-extern int kauth_cred_supplementary_register(const char *name, int *ident);
-extern int kauth_cred_supplementary_add(kauth_cred_t cred, int ident, const void *data, size_t datasize);
-extern int kauth_cred_supplementary_remove(kauth_cred_t cred, int ident);
+extern int kauth_cred_supplementary_register(const char *name, int *ident);
+extern int kauth_cred_supplementary_add(kauth_cred_t cred, int ident, const void *data, size_t datasize);
+extern int kauth_cred_supplementary_remove(kauth_cred_t cred, int ident);
- guid_t ace_applicable;
- u_int32_t ace_flags;
-#define KAUTH_ACE_KINDMASK 0xf
-#define KAUTH_ACE_PERMIT 1
-#define KAUTH_ACE_DENY 2
-#define KAUTH_ACE_AUDIT 3 /* not implemented */
-#define KAUTH_ACE_ALARM 4 /* not implemented */
-#define KAUTH_ACE_INHERITED (1<<4)
-#define KAUTH_ACE_FILE_INHERIT (1<<5)
-#define KAUTH_ACE_DIRECTORY_INHERIT (1<<6)
-#define KAUTH_ACE_LIMIT_INHERIT (1<<7)
-#define KAUTH_ACE_ONLY_INHERIT (1<<8)
-#define KAUTH_ACE_SUCCESS (1<<9) /* not implemented (AUDIT/ALARM) */
-#define KAUTH_ACE_FAILURE (1<<10) /* not implemented (AUDIT/ALARM) */
+ guid_t ace_applicable;
+ u_int32_t ace_flags;
+#define KAUTH_ACE_KINDMASK 0xf
+#define KAUTH_ACE_PERMIT 1
+#define KAUTH_ACE_DENY 2
+#define KAUTH_ACE_AUDIT 3 /* not implemented */
+#define KAUTH_ACE_ALARM 4 /* not implemented */
+#define KAUTH_ACE_INHERITED (1<<4)
+#define KAUTH_ACE_FILE_INHERIT (1<<5)
+#define KAUTH_ACE_DIRECTORY_INHERIT (1<<6)
+#define KAUTH_ACE_LIMIT_INHERIT (1<<7)
+#define KAUTH_ACE_ONLY_INHERIT (1<<8)
+#define KAUTH_ACE_SUCCESS (1<<9) /* not implemented (AUDIT/ALARM) */
+#define KAUTH_ACE_FAILURE (1<<10) /* not implemented (AUDIT/ALARM) */
-#define KAUTH_ACE_INHERIT_CONTROL_FLAGS \
- (KAUTH_ACE_FILE_INHERIT | \
- KAUTH_ACE_DIRECTORY_INHERIT | \
- KAUTH_ACE_LIMIT_INHERIT | \
- KAUTH_ACE_ONLY_INHERIT)
- kauth_ace_rights_t ace_rights; /* scope specific */
+#define KAUTH_ACE_INHERIT_CONTROL_FLAGS \
+ (KAUTH_ACE_FILE_INHERIT | \
+ KAUTH_ACE_DIRECTORY_INHERIT | \
+ KAUTH_ACE_LIMIT_INHERIT | \
+ KAUTH_ACE_ONLY_INHERIT)
+ kauth_ace_rights_t ace_rights; /* scope specific */
-#define KAUTH_ACE_GENERIC_ALL (1<<21)
-#define KAUTH_ACE_GENERIC_EXECUTE (1<<22)
-#define KAUTH_ACE_GENERIC_WRITE (1<<23)
-#define KAUTH_ACE_GENERIC_READ (1<<24)
-
+#define KAUTH_ACE_GENERIC_ALL (1<<21)
+#define KAUTH_ACE_GENERIC_EXECUTE (1<<22)
+#define KAUTH_ACE_GENERIC_WRITE (1<<23)
+#define KAUTH_ACE_GENERIC_READ (1<<24)
/*
* The low 16 bits of the flags field are reserved for filesystem
* internal use and must be preserved by all APIs. This includes
* round-tripping flags through user-space interfaces.
*/
/*
* The low 16 bits of the flags field are reserved for filesystem
* internal use and must be preserved by all APIs. This includes
* round-tripping flags through user-space interfaces.
*/
-#define fsec_flags fsec_acl.acl_flags
-#define fsec_ace fsec_acl.acl_ace
-#define KAUTH_FILESEC_FLAGS_PRIVATE KAUTH_ACL_FLAGS_PRIVATE
-#define KAUTH_FILESEC_DEFER_INHERIT KAUTH_ACL_DEFER_INHERIT
-#define KAUTH_FILESEC_NO_INHERIT KAUTH_ACL_NO_INHERIT
-#define KAUTH_FILESEC_NONE ((kauth_filesec_t)0)
-#define KAUTH_FILESEC_WANTED ((kauth_filesec_t)1)
-
+#define fsec_flags fsec_acl.acl_flags
+#define fsec_ace fsec_acl.acl_ace
+#define KAUTH_FILESEC_FLAGS_PRIVATE KAUTH_ACL_FLAGS_PRIVATE
+#define KAUTH_FILESEC_DEFER_INHERIT KAUTH_ACL_DEFER_INHERIT
+#define KAUTH_FILESEC_NO_INHERIT KAUTH_ACL_NO_INHERIT
+#define KAUTH_FILESEC_NONE ((kauth_filesec_t)0)
+#define KAUTH_FILESEC_WANTED ((kauth_filesec_t)1)
+
-#define KAUTH_FILESEC_SIZE(c) (__offsetof(struct kauth_filesec, fsec_acl) + __offsetof(struct kauth_acl, acl_ace) + (c) * sizeof(struct kauth_ace))
-#define KAUTH_FILESEC_COPYSIZE(p) KAUTH_FILESEC_SIZE(((p)->fsec_entrycount == KAUTH_FILESEC_NOACL) ? 0 : (p)->fsec_entrycount)
-#define KAUTH_FILESEC_COUNT(s) (((s) - KAUTH_FILESEC_SIZE(0)) / sizeof(struct kauth_ace))
-#define KAUTH_FILESEC_VALID(s) ((s) >= KAUTH_FILESEC_SIZE(0) && (((s) - KAUTH_FILESEC_SIZE(0)) % sizeof(struct kauth_ace)) == 0)
+#define KAUTH_FILESEC_SIZE(c) (__offsetof(struct kauth_filesec, fsec_acl) + __offsetof(struct kauth_acl, acl_ace) + (c) * sizeof(struct kauth_ace))
+#define KAUTH_FILESEC_COPYSIZE(p) KAUTH_FILESEC_SIZE(((p)->fsec_entrycount == KAUTH_FILESEC_NOACL) ? 0 : (p)->fsec_entrycount)
+#define KAUTH_FILESEC_COUNT(s) (((s) - KAUTH_FILESEC_SIZE(0)) / sizeof(struct kauth_ace))
+#define KAUTH_FILESEC_VALID(s) ((s) >= KAUTH_FILESEC_SIZE(0) && (((s) - KAUTH_FILESEC_SIZE(0)) % sizeof(struct kauth_ace)) == 0)
- kauth_ace_t ae_acl;
- int ae_count;
- kauth_ace_rights_t ae_requested;
- kauth_ace_rights_t ae_residual;
- int ae_result;
- boolean_t ae_found_deny;
- int ae_options;
-#define KAUTH_AEVAL_IS_OWNER (1<<0) /* authorizing operation for owner */
-#define KAUTH_AEVAL_IN_GROUP (1<<1) /* authorizing operation for groupmember */
-#define KAUTH_AEVAL_IN_GROUP_UNKNOWN (1<<2) /* authorizing operation for unknown group membership */
+ kauth_ace_t ae_acl;
+ int ae_count;
+ kauth_ace_rights_t ae_requested;
+ kauth_ace_rights_t ae_residual;
+ int ae_result;
+ boolean_t ae_found_deny;
+ int ae_options;
+#define KAUTH_AEVAL_IS_OWNER (1<<0) /* authorizing operation for owner */
+#define KAUTH_AEVAL_IN_GROUP (1<<1) /* authorizing operation for groupmember */
+#define KAUTH_AEVAL_IN_GROUP_UNKNOWN (1<<2) /* authorizing operation for unknown group membership */
- kauth_ace_rights_t ae_exp_gall;
- kauth_ace_rights_t ae_exp_gread;
- kauth_ace_rights_t ae_exp_gwrite;
- kauth_ace_rights_t ae_exp_gexec;
+ kauth_ace_rights_t ae_exp_gall;
+ kauth_ace_rights_t ae_exp_gread;
+ kauth_ace_rights_t ae_exp_gwrite;
+ kauth_ace_rights_t ae_exp_gexec;
-extern void kauth_unlisten_scope(kauth_listener_t _scope);
-extern int kauth_authorize_action(kauth_scope_t _scope, kauth_cred_t _credential, kauth_action_t _action,
- uintptr_t _arg0, uintptr_t _arg1, uintptr_t _arg2, uintptr_t _arg3);
+extern void kauth_unlisten_scope(kauth_listener_t _scope);
+extern int kauth_authorize_action(kauth_scope_t _scope, kauth_cred_t _credential, kauth_action_t _action,
+ uintptr_t _arg0, uintptr_t _arg1, uintptr_t _arg2, uintptr_t _arg3);
-void kauth_filesec_acl_setendian(int, kauth_filesec_t, kauth_acl_t);
-int kauth_copyinfilesec(user_addr_t xsecurity, kauth_filesec_t *xsecdestpp);
-extern int kauth_acl_evaluate(kauth_cred_t _credential, kauth_acl_eval_t _eval);
-extern int kauth_acl_inherit(vnode_t _dvp, kauth_acl_t _initial, kauth_acl_t *_product, int _isdir, vfs_context_t _ctx);
+void kauth_filesec_acl_setendian(int, kauth_filesec_t, kauth_acl_t);
+int kauth_copyinfilesec(user_addr_t xsecurity, kauth_filesec_t *xsecdestpp);
+extern int kauth_acl_evaluate(kauth_cred_t _credential, kauth_acl_eval_t _eval);
+extern int kauth_acl_inherit(vnode_t _dvp, kauth_acl_t _initial, kauth_acl_t *_product, int _isdir, vfs_context_t _ctx);
-#define KAUTH_FILEOP_OPEN 1
-#define KAUTH_FILEOP_CLOSE 2
-#define KAUTH_FILEOP_RENAME 3
-#define KAUTH_FILEOP_EXCHANGE 4
-#define KAUTH_FILEOP_LINK 5
-#define KAUTH_FILEOP_EXEC 6
-#define KAUTH_FILEOP_DELETE 7
+#define KAUTH_FILEOP_OPEN 1
+#define KAUTH_FILEOP_CLOSE 2
+#define KAUTH_FILEOP_RENAME 3
+#define KAUTH_FILEOP_EXCHANGE 4
+#define KAUTH_FILEOP_LINK 5
+#define KAUTH_FILEOP_EXEC 6
+#define KAUTH_FILEOP_DELETE 7
+#define KAUTH_FILEOP_WILL_RENAME 8
-#define KAUTH_VNODE_READ_DATA (1<<1)
-#define KAUTH_VNODE_LIST_DIRECTORY KAUTH_VNODE_READ_DATA
-#define KAUTH_VNODE_WRITE_DATA (1<<2)
-#define KAUTH_VNODE_ADD_FILE KAUTH_VNODE_WRITE_DATA
-#define KAUTH_VNODE_EXECUTE (1<<3)
-#define KAUTH_VNODE_SEARCH KAUTH_VNODE_EXECUTE
-#define KAUTH_VNODE_DELETE (1<<4)
-#define KAUTH_VNODE_APPEND_DATA (1<<5)
-#define KAUTH_VNODE_ADD_SUBDIRECTORY KAUTH_VNODE_APPEND_DATA
-#define KAUTH_VNODE_DELETE_CHILD (1<<6)
-#define KAUTH_VNODE_READ_ATTRIBUTES (1<<7)
-#define KAUTH_VNODE_WRITE_ATTRIBUTES (1<<8)
-#define KAUTH_VNODE_READ_EXTATTRIBUTES (1<<9)
-#define KAUTH_VNODE_WRITE_EXTATTRIBUTES (1<<10)
-#define KAUTH_VNODE_READ_SECURITY (1<<11)
-#define KAUTH_VNODE_WRITE_SECURITY (1<<12)
-#define KAUTH_VNODE_TAKE_OWNERSHIP (1<<13)
+#define KAUTH_VNODE_READ_DATA (1<<1)
+#define KAUTH_VNODE_LIST_DIRECTORY KAUTH_VNODE_READ_DATA
+#define KAUTH_VNODE_WRITE_DATA (1<<2)
+#define KAUTH_VNODE_ADD_FILE KAUTH_VNODE_WRITE_DATA
+#define KAUTH_VNODE_EXECUTE (1<<3)
+#define KAUTH_VNODE_SEARCH KAUTH_VNODE_EXECUTE
+#define KAUTH_VNODE_DELETE (1<<4)
+#define KAUTH_VNODE_APPEND_DATA (1<<5)
+#define KAUTH_VNODE_ADD_SUBDIRECTORY KAUTH_VNODE_APPEND_DATA
+#define KAUTH_VNODE_DELETE_CHILD (1<<6)
+#define KAUTH_VNODE_READ_ATTRIBUTES (1<<7)
+#define KAUTH_VNODE_WRITE_ATTRIBUTES (1<<8)
+#define KAUTH_VNODE_READ_EXTATTRIBUTES (1<<9)
+#define KAUTH_VNODE_WRITE_EXTATTRIBUTES (1<<10)
+#define KAUTH_VNODE_READ_SECURITY (1<<11)
+#define KAUTH_VNODE_WRITE_SECURITY (1<<12)
+#define KAUTH_VNODE_TAKE_OWNERSHIP (1<<13)
-#define KAUTH_VNODE_GENERIC_READ_BITS (KAUTH_VNODE_READ_DATA | \
- KAUTH_VNODE_READ_ATTRIBUTES | \
- KAUTH_VNODE_READ_EXTATTRIBUTES | \
- KAUTH_VNODE_READ_SECURITY)
-
-#define KAUTH_VNODE_GENERIC_WRITE_BITS (KAUTH_VNODE_WRITE_DATA | \
- KAUTH_VNODE_APPEND_DATA | \
- KAUTH_VNODE_DELETE | \
- KAUTH_VNODE_DELETE_CHILD | \
- KAUTH_VNODE_WRITE_ATTRIBUTES | \
- KAUTH_VNODE_WRITE_EXTATTRIBUTES | \
- KAUTH_VNODE_WRITE_SECURITY)
-
+#define KAUTH_VNODE_GENERIC_READ_BITS (KAUTH_VNODE_READ_DATA | \
+ KAUTH_VNODE_READ_ATTRIBUTES | \
+ KAUTH_VNODE_READ_EXTATTRIBUTES | \
+ KAUTH_VNODE_READ_SECURITY)
+
+#define KAUTH_VNODE_GENERIC_WRITE_BITS (KAUTH_VNODE_WRITE_DATA | \
+ KAUTH_VNODE_APPEND_DATA | \
+ KAUTH_VNODE_DELETE | \
+ KAUTH_VNODE_DELETE_CHILD | \
+ KAUTH_VNODE_WRITE_ATTRIBUTES | \
+ KAUTH_VNODE_WRITE_EXTATTRIBUTES | \
+ KAUTH_VNODE_WRITE_SECURITY)
+
-#define KAUTH_VNODE_WRITE_RIGHTS (KAUTH_VNODE_ADD_FILE | \
- KAUTH_VNODE_ADD_SUBDIRECTORY | \
- KAUTH_VNODE_DELETE_CHILD | \
- KAUTH_VNODE_WRITE_DATA | \
- KAUTH_VNODE_APPEND_DATA | \
- KAUTH_VNODE_DELETE | \
- KAUTH_VNODE_WRITE_ATTRIBUTES | \
- KAUTH_VNODE_WRITE_EXTATTRIBUTES | \
- KAUTH_VNODE_WRITE_SECURITY | \
- KAUTH_VNODE_TAKE_OWNERSHIP | \
- KAUTH_VNODE_LINKTARGET | \
- KAUTH_VNODE_CHECKIMMUTABLE)
+#define KAUTH_VNODE_WRITE_RIGHTS (KAUTH_VNODE_ADD_FILE | \
+ KAUTH_VNODE_ADD_SUBDIRECTORY | \
+ KAUTH_VNODE_DELETE_CHILD | \
+ KAUTH_VNODE_WRITE_DATA | \
+ KAUTH_VNODE_APPEND_DATA | \
+ KAUTH_VNODE_DELETE | \
+ KAUTH_VNODE_WRITE_ATTRIBUTES | \
+ KAUTH_VNODE_WRITE_EXTATTRIBUTES | \
+ KAUTH_VNODE_WRITE_SECURITY | \
+ KAUTH_VNODE_TAKE_OWNERSHIP | \
+ KAUTH_VNODE_LINKTARGET | \
+ KAUTH_VNODE_CHECKIMMUTABLE)
# define KAUTH_DEBUG_ENABLE
# define K_UUID_FMT "%08x:%08x:%08x:%08x"
# define K_UUID_ARG(_u) *(int *)&_u.g_guid[0],*(int *)&_u.g_guid[4],*(int *)&_u.g_guid[8],*(int *)&_u.g_guid[12]
# define KAUTH_DEBUG_ENABLE
# define K_UUID_FMT "%08x:%08x:%08x:%08x"
# define K_UUID_ARG(_u) *(int *)&_u.g_guid[0],*(int *)&_u.g_guid[4],*(int *)&_u.g_guid[8],*(int *)&_u.g_guid[12]
-# define KAUTH_DEBUG(fmt, args...) do { kprintf("%s:%d: " fmt "\n", __PRETTY_FUNCTION__, __LINE__ , ##args); } while (0)
-# define KAUTH_DEBUG_CTX(_c) KAUTH_DEBUG("p = %p c = %p", _c->vc_proc, _c->vc_ucred)
-# define VFS_DEBUG(_ctx, _vp, fmt, args...) \
- do { \
- kprintf("%p '%s' %s:%d " fmt "\n", \
- _ctx, \
- (_vp != NULL && _vp->v_name != NULL) ? _vp->v_name : "????", \
- __PRETTY_FUNCTION__, __LINE__ , \
- ##args); \
+# define KAUTH_DEBUG(fmt, args...) do { kprintf("%s:%d: " fmt "\n", __PRETTY_FUNCTION__, __LINE__ , ##args); } while (0)
+# define KAUTH_DEBUG_CTX(_c) KAUTH_DEBUG("p = %p c = %p", _c->vc_proc, _c->vc_ucred)
+# define VFS_DEBUG(_ctx, _vp, fmt, args...) \
+ do { \
+ kprintf("%p '%s' %s:%d " fmt "\n", \
+ _ctx, \
+ (_vp != NULL && _vp->v_name != NULL) ? _vp->v_name : "????", \
+ __PRETTY_FUNCTION__, __LINE__ , \
+ ##args); \
-#else /* !0 */
-# define KAUTH_DEBUG(fmt, args...) do { } while (0)
-# define VFS_DEBUG(ctx, vp, fmt, args...) do { } while(0)
-#endif /* !0 */
+#else /* !0 */
+# define KAUTH_DEBUG(fmt, args...) do { } while (0)
+# define VFS_DEBUG(ctx, vp, fmt, args...) do { } while(0)
+#endif /* !0 */