#include <sys/kauth.h>

sys/kauth.h

NOTICE: This file was modified by SPARTA, Inc. in 2005 to introduce support for mandatory and extensible security protections. This notice is included in support of clause 2.2 (b) of the Apple Public License, Version 2.0.
113 macros · 6 structs · 5 typedefs

macroKAUTH_UID_NONE

#define KAUTH_UID_NONE (~(uid_t)0 - 100)
not a valid UID

macroKAUTH_GID_NONE

#define KAUTH_GID_NONE (~(gid_t)0 - 100)
not a valid GID

structntsid_t

size 72, align 1
u_int8_tsid_kind
u_int8_tsid_authcount
u_int8_t[6]sid_authority
u_int32_t[16]sid_authorities

typedefntsid_t

typedef struct ntsid_t ntsid_t;

macroKAUTH_NTSID_MAX_AUTHORITIES

#define KAUTH_NTSID_MAX_AUTHORITIES 16

macro_NTSID_T

#define _NTSID_T 

macroKAUTH_NTSID_HDRSIZE

valid byte count inside a SID structure
#define KAUTH_NTSID_HDRSIZE (8)

macroKAUTH_NTSID_SIZE

#define KAUTH_NTSID_SIZE(_s) (KAUTH_NTSID_HDRSIZE + ((_s)->sid_authcount * sizeof(u_int32_t)))

structkauth_identity_extlookup

External lookup message payload; this structure is shared between the kernel group membership resolver, and the user space group membership resolver daemon, and is use to communicate resolution requests from the kernel to user space, and the result of that request from user space to the kernel.
size 304, align 8
u_int32_tel_seqnorequest sequence number
u_int32_tel_resultlookup result
u_int32_tel_flags
__darwin_pid_tel_info_pidrequest on behalf of PID
u_int64_tel_extendextension field
u_int32_tel_info_reserved_1reserved (APPLE)
uid_tel_uiduser ID
guid_tel_uguiduser GUID
u_int32_tel_uguid_validTTL on translation result (seconds)
ntsid_tel_usiduser NT SID
u_int32_tel_usid_validTTL on translation result (seconds)
gid_tel_gidgroup ID
guid_tel_gguidgroup GUID
u_int32_tel_gguid_validTTL on translation result (seconds)
ntsid_tel_gsidgroup SID
u_int32_tel_gsid_validTTL on translation result (seconds)
u_int32_tel_member_validTTL on group lookup result
u_int32_tel_sup_grp_cntcount of supplemental groups up to NGROUPS
gid_t[16]el_sup_groupssupplemental group list

macroKAUTH_EXTLOOKUP_SUCCESS

#define KAUTH_EXTLOOKUP_SUCCESS 0
results here are good

macroKAUTH_EXTLOOKUP_BADRQ

#define KAUTH_EXTLOOKUP_BADRQ 1
request badly formatted

macroKAUTH_EXTLOOKUP_FAILURE

#define KAUTH_EXTLOOKUP_FAILURE 2
transient failure during lookup

macroKAUTH_EXTLOOKUP_FATAL

#define KAUTH_EXTLOOKUP_FATAL 3
permanent failure during lookup

macroKAUTH_EXTLOOKUP_INPROG

#define KAUTH_EXTLOOKUP_INPROG 100
request in progress

macroKAUTH_EXTLOOKUP_VALID_UID

#define KAUTH_EXTLOOKUP_VALID_UID (1<<0)

macroKAUTH_EXTLOOKUP_VALID_UGUID

#define KAUTH_EXTLOOKUP_VALID_UGUID (1<<1)

macroKAUTH_EXTLOOKUP_VALID_USID

#define KAUTH_EXTLOOKUP_VALID_USID (1<<2)

macroKAUTH_EXTLOOKUP_VALID_GID

#define KAUTH_EXTLOOKUP_VALID_GID (1<<3)

macroKAUTH_EXTLOOKUP_VALID_GGUID

#define KAUTH_EXTLOOKUP_VALID_GGUID (1<<4)

macroKAUTH_EXTLOOKUP_VALID_GSID

#define KAUTH_EXTLOOKUP_VALID_GSID (1<<5)

macroKAUTH_EXTLOOKUP_WANT_UID

#define KAUTH_EXTLOOKUP_WANT_UID (1<<6)

macroKAUTH_EXTLOOKUP_WANT_UGUID

#define KAUTH_EXTLOOKUP_WANT_UGUID (1<<7)

macroKAUTH_EXTLOOKUP_WANT_USID

#define KAUTH_EXTLOOKUP_WANT_USID (1<<8)

macroKAUTH_EXTLOOKUP_WANT_GID

#define KAUTH_EXTLOOKUP_WANT_GID (1<<9)

macroKAUTH_EXTLOOKUP_WANT_GGUID

#define KAUTH_EXTLOOKUP_WANT_GGUID (1<<10)

macroKAUTH_EXTLOOKUP_WANT_GSID

#define KAUTH_EXTLOOKUP_WANT_GSID (1<<11)

macroKAUTH_EXTLOOKUP_WANT_MEMBERSHIP

#define KAUTH_EXTLOOKUP_WANT_MEMBERSHIP (1<<12)

macroKAUTH_EXTLOOKUP_VALID_MEMBERSHIP

#define KAUTH_EXTLOOKUP_VALID_MEMBERSHIP (1<<13)

macroKAUTH_EXTLOOKUP_ISMEMBER

#define KAUTH_EXTLOOKUP_ISMEMBER (1<<14)

macroKAUTH_EXTLOOKUP_VALID_PWNAM

#define KAUTH_EXTLOOKUP_VALID_PWNAM (1<<15)

macroKAUTH_EXTLOOKUP_WANT_PWNAM

#define KAUTH_EXTLOOKUP_WANT_PWNAM (1<<16)

macroKAUTH_EXTLOOKUP_VALID_GRNAM

#define KAUTH_EXTLOOKUP_VALID_GRNAM (1<<17)

macroKAUTH_EXTLOOKUP_WANT_GRNAM

#define KAUTH_EXTLOOKUP_WANT_GRNAM (1<<18)

macroKAUTH_EXTLOOKUP_VALID_SUPGRPS

#define KAUTH_EXTLOOKUP_VALID_SUPGRPS (1<<19)

macroKAUTH_EXTLOOKUP_WANT_SUPGRPS

#define KAUTH_EXTLOOKUP_WANT_SUPGRPS (1<<20)

structkauth_cache_sizes

size 8, align 4
u_int32_tkcs_group_size
u_int32_tkcs_id_size

macroKAUTH_EXTLOOKUP_REGISTER

#define KAUTH_EXTLOOKUP_REGISTER (0)

macroKAUTH_EXTLOOKUP_RESULT

#define KAUTH_EXTLOOKUP_RESULT (1<<0)

macroKAUTH_EXTLOOKUP_WORKER

#define KAUTH_EXTLOOKUP_WORKER (1<<1)

macroKAUTH_EXTLOOKUP_DEREGISTER

#define KAUTH_EXTLOOKUP_DEREGISTER (1<<2)

macroKAUTH_GET_CACHE_SIZES

#define KAUTH_GET_CACHE_SIZES (1<<3)

macroKAUTH_SET_CACHE_SIZES

#define KAUTH_SET_CACHE_SIZES (1<<4)

macroKAUTH_CLEAR_CACHES

#define KAUTH_CLEAR_CACHES (1<<5)

macroIDENTITYSVC_ENTITLEMENT

#define IDENTITYSVC_ENTITLEMENT "com.apple.private.identitysvc"

typedefkauth_ace_rights_t

typedef u_int32_t kauth_ace_rights_t

structkauth_ace

Access Control List Entry (ACE)
size 24, align 4
guid_tace_applicable
u_int32_tace_flags
kauth_ace_rights_tace_rightsscope specific

macroKAUTH_ACE_KINDMASK

#define KAUTH_ACE_KINDMASK 0xf

macroKAUTH_ACE_PERMIT

#define KAUTH_ACE_PERMIT 1

macroKAUTH_ACE_DENY

#define KAUTH_ACE_DENY 2

macroKAUTH_ACE_AUDIT

#define KAUTH_ACE_AUDIT 3
not implemented

macroKAUTH_ACE_ALARM

#define KAUTH_ACE_ALARM 4
not implemented

macroKAUTH_ACE_INHERITED

#define KAUTH_ACE_INHERITED (1<<4)

macroKAUTH_ACE_FILE_INHERIT

#define KAUTH_ACE_FILE_INHERIT (1<<5)

macroKAUTH_ACE_DIRECTORY_INHERIT

#define KAUTH_ACE_DIRECTORY_INHERIT (1<<6)

macroKAUTH_ACE_LIMIT_INHERIT

#define KAUTH_ACE_LIMIT_INHERIT (1<<7)

macroKAUTH_ACE_ONLY_INHERIT

#define KAUTH_ACE_ONLY_INHERIT (1<<8)

macroKAUTH_ACE_SUCCESS

#define KAUTH_ACE_SUCCESS (1<<9)
not implemented (AUDIT/ALARM)

macroKAUTH_ACE_FAILURE

#define KAUTH_ACE_FAILURE (1<<10)
not implemented (AUDIT/ALARM)

macroKAUTH_ACE_INHERIT_CONTROL_FLAGS

All flag bits controlling ACE inheritance
#define KAUTH_ACE_INHERIT_CONTROL_FLAGS (KAUTH_ACE_FILE_INHERIT |
	         KAUTH_ACE_DIRECTORY_INHERIT |
	         KAUTH_ACE_LIMIT_INHERIT |
	         KAUTH_ACE_ONLY_INHERIT)

macroKAUTH_ACE_GENERIC_ALL

These rights are never tested, but may be present in an ACL
#define KAUTH_ACE_GENERIC_ALL (1<<21)

macroKAUTH_ACE_GENERIC_EXECUTE

#define KAUTH_ACE_GENERIC_EXECUTE (1<<22)

macroKAUTH_ACE_GENERIC_WRITE

#define KAUTH_ACE_GENERIC_WRITE (1<<23)

macroKAUTH_ACE_GENERIC_READ

#define KAUTH_ACE_GENERIC_READ (1<<24)

macro_KAUTH_ACE

#define _KAUTH_ACE 

typedefkauth_ace_t

typedef struct kauth_ace *kauth_ace_t

structkauth_acl

Access Control List
size 32, align 4
u_int32_tacl_entrycount
u_int32_tacl_flags
struct kauth_ace[1]acl_ace

macroKAUTH_ACL_MAX_ENTRIES

XXX this value needs to be raised - 3893388
#define KAUTH_ACL_MAX_ENTRIES 128

macroKAUTH_ACL_FLAGS_PRIVATE

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 KAUTH_ACL_FLAGS_PRIVATE (0xffff)

macroKAUTH_ACL_DEFER_INHERIT

inheritance will be deferred until the first rename operation
#define KAUTH_ACL_DEFER_INHERIT (1<<16)

macroKAUTH_ACL_NO_INHERIT

this ACL must not be overwritten as part of an inheritance operation
#define KAUTH_ACL_NO_INHERIT (1<<17)

macroKAUTH_FILESEC_NOACL

acl_entrycount that tells us the ACL is not valid
#define KAUTH_FILESEC_NOACL ((u_int32_t)(-1))

macroKAUTH_ACL_SIZE

If the acl_entrycount field is KAUTH_FILESEC_NOACL, then the size is the same as a kauth_acl structure; the intent is to put an actual entrycount of KAUTH_FILESEC_NOACL on disk to distinguish a kauth_filesec_t with an empty entry (Windows treats this as "deny all") from one that merely indicates a file group and/or owner guid values.
#define KAUTH_ACL_SIZE(c) (__offsetof(struct kauth_acl, acl_ace) + ((u_int32_t)(c) != KAUTH_FILESEC_NOACL ? ((c) * sizeof(struct kauth_ace)) : 0))

macroKAUTH_ACL_COPYSIZE

#define KAUTH_ACL_COPYSIZE(p) KAUTH_ACL_SIZE((p)->acl_entrycount)

macro_KAUTH_ACL

#define _KAUTH_ACL 

typedefkauth_acl_t

typedef struct kauth_acl *kauth_acl_t

structkauth_filesec

File Security information
size 68, align 4
u_int32_tfsec_magic
guid_tfsec_owner
guid_tfsec_group
struct kauth_aclfsec_acl

macroKAUTH_FILESEC_MAGIC

#define KAUTH_FILESEC_MAGIC 0x012cc16d

macrofsec_entrycount

backwards compatibility
#define fsec_entrycount fsec_acl.acl_entrycount

macrofsec_flags

#define fsec_flags fsec_acl.acl_flags

macrofsec_ace

#define fsec_ace fsec_acl.acl_ace

macroKAUTH_FILESEC_FLAGS_PRIVATE

#define KAUTH_FILESEC_FLAGS_PRIVATE KAUTH_ACL_FLAGS_PRIVATE

macroKAUTH_FILESEC_DEFER_INHERIT

#define KAUTH_FILESEC_DEFER_INHERIT KAUTH_ACL_DEFER_INHERIT

macroKAUTH_FILESEC_NO_INHERIT

#define KAUTH_FILESEC_NO_INHERIT KAUTH_ACL_NO_INHERIT

macroKAUTH_FILESEC_NONE

#define KAUTH_FILESEC_NONE ((kauth_filesec_t)0)

macroKAUTH_FILESEC_WANTED

#define KAUTH_FILESEC_WANTED ((kauth_filesec_t)1)

macro_KAUTH_FILESEC

#define _KAUTH_FILESEC 

typedefkauth_filesec_t

typedef struct kauth_filesec *kauth_filesec_t

macroKAUTH_FILESEC_SIZE

#define KAUTH_FILESEC_SIZE(c) (__offsetof(struct kauth_filesec, fsec_acl) + __offsetof(struct kauth_acl, acl_ace) + (c) * sizeof(struct kauth_ace))

macroKAUTH_FILESEC_COPYSIZE

#define KAUTH_FILESEC_COPYSIZE(p) KAUTH_FILESEC_SIZE(((p)->fsec_entrycount == KAUTH_FILESEC_NOACL) ? 0 : (p)->fsec_entrycount)

macroKAUTH_FILESEC_COUNT

#define KAUTH_FILESEC_COUNT(s) (((s)  - KAUTH_FILESEC_SIZE(0)) / sizeof(struct kauth_ace))

macroKAUTH_FILESEC_VALID

#define KAUTH_FILESEC_VALID(s) ((s) >= KAUTH_FILESEC_SIZE(0) && (((s) - KAUTH_FILESEC_SIZE(0)) % sizeof(struct kauth_ace)) == 0)

macroKAUTH_FILESEC_XATTR

#define KAUTH_FILESEC_XATTR "com.apple.system.Security"

macroKAUTH_ENDIAN_HOST

Allowable first arguments to kauth_filesec_acl_setendian()
#define KAUTH_ENDIAN_HOST 0x00000001
set host endianness

macroKAUTH_ENDIAN_DISK

#define KAUTH_ENDIAN_DISK 0x00000002
set disk endianness

macroKAUTH_VNODE_READ_DATA

#define KAUTH_VNODE_READ_DATA (1U<<1)

macroKAUTH_VNODE_LIST_DIRECTORY

#define KAUTH_VNODE_LIST_DIRECTORY KAUTH_VNODE_READ_DATA

macroKAUTH_VNODE_WRITE_DATA

#define KAUTH_VNODE_WRITE_DATA (1U<<2)

macroKAUTH_VNODE_ADD_FILE

#define KAUTH_VNODE_ADD_FILE KAUTH_VNODE_WRITE_DATA

macroKAUTH_VNODE_EXECUTE

#define KAUTH_VNODE_EXECUTE (1U<<3)

macroKAUTH_VNODE_DELETE

#define KAUTH_VNODE_DELETE (1U<<4)

macroKAUTH_VNODE_APPEND_DATA

#define KAUTH_VNODE_APPEND_DATA (1U<<5)

macroKAUTH_VNODE_ADD_SUBDIRECTORY

#define KAUTH_VNODE_ADD_SUBDIRECTORY KAUTH_VNODE_APPEND_DATA

macroKAUTH_VNODE_DELETE_CHILD

#define KAUTH_VNODE_DELETE_CHILD (1U<<6)

macroKAUTH_VNODE_READ_ATTRIBUTES

#define KAUTH_VNODE_READ_ATTRIBUTES (1U<<7)

macroKAUTH_VNODE_WRITE_ATTRIBUTES

#define KAUTH_VNODE_WRITE_ATTRIBUTES (1U<<8)

macroKAUTH_VNODE_READ_EXTATTRIBUTES

#define KAUTH_VNODE_READ_EXTATTRIBUTES (1U<<9)

macroKAUTH_VNODE_WRITE_EXTATTRIBUTES

#define KAUTH_VNODE_WRITE_EXTATTRIBUTES (1U<<10)

macroKAUTH_VNODE_READ_SECURITY

#define KAUTH_VNODE_READ_SECURITY (1U<<11)

macroKAUTH_VNODE_WRITE_SECURITY

#define KAUTH_VNODE_WRITE_SECURITY (1U<<12)

macroKAUTH_VNODE_TAKE_OWNERSHIP

#define KAUTH_VNODE_TAKE_OWNERSHIP (1U<<13)

macroKAUTH_VNODE_CHANGE_OWNER

backwards compatibility only
#define KAUTH_VNODE_CHANGE_OWNER KAUTH_VNODE_TAKE_OWNERSHIP

macroKAUTH_VNODE_SYNCHRONIZE

For Windows interoperability only
#define KAUTH_VNODE_SYNCHRONIZE (1U<<20)

macroKAUTH_VNODE_LINKTARGET

Actions not expressed as rights bits Authorizes the vnode as the target of a hard link.
#define KAUTH_VNODE_LINKTARGET (1U<<25)

macroKAUTH_VNODE_CHECKIMMUTABLE

Indicates that other steps have been taken to authorise the action, but authorisation should be denied for immutable objects.
#define KAUTH_VNODE_CHECKIMMUTABLE (1U<<26)

macroKAUTH_VNODE_ACCESS

Action modifiers The KAUTH_VNODE_ACCESS bit is passed to the callback if the authorisation request in progress is advisory, rather than authoritative. Listeners performing consequential work (i.e. not strictly checking authorisation) may test this flag to avoid performing unnecessary work. This bit will never be present in an ACE.
#define KAUTH_VNODE_ACCESS (1U<<31)

macroKAUTH_VNODE_NOIMMUTABLE

The KAUTH_VNODE_NOIMMUTABLE bit is passed to the callback along with the KAUTH_VNODE_WRITE_SECURITY bit (and no others) to indicate that the caller wishes to change one or more of the immutable flags, and the state of these flags should not be considered when authorizing the request. The system immutable flags are only ignored when the system securelevel is low enough to allow their removal.
#define KAUTH_VNODE_NOIMMUTABLE (1U<<30)

macroKAUTH_VNODE_SEARCHBYANYONE

fake right that is composed by the following... vnode must have search for owner, group and world allowed plus there must be no deny modes present for SEARCH... this fake right is used by the fast lookup path to avoid checking for an exact match on the last credential to lookup the component being acted on
#define KAUTH_VNODE_SEARCHBYANYONE (1U<<29)

macroKAUTH_INVALIDATE_CACHED_RIGHTS

when passed as an 'action' to "vnode_uncache_authorized_actions" it indicates that all of the cached authorizations for that vnode should be invalidated
#define KAUTH_INVALIDATE_CACHED_RIGHTS ((kauth_action_t)~0)

macroKAUTH_VNODE_GENERIC_READ_BITS

The expansions of the GENERIC bits at evaluation time
#define KAUTH_VNODE_GENERIC_READ_BITS (KAUTH_VNODE_READ_DATA |
	                                KAUTH_VNODE_READ_ATTRIBUTES |
	                                KAUTH_VNODE_READ_EXTATTRIBUTES |
	                                KAUTH_VNODE_READ_SECURITY)

macroKAUTH_VNODE_GENERIC_EXECUTE_BITS

#define KAUTH_VNODE_GENERIC_EXECUTE_BITS (KAUTH_VNODE_EXECUTE)