]> git.saurik.com Git - apple/security.git/blob - OSX/authd/authtoken.h
Security-57336.1.9.tar.gz
[apple/security.git] / OSX / authd / authtoken.h
1 /* Copyright (c) 2012-2013 Apple Inc. All Rights Reserved. */
2
3 #ifndef _SECURITY_AUTH_AUTHTOKEN_H_
4 #define _SECURITY_AUTH_AUTHTOKEN_H_
5
6 #include "credential.h"
7 #include <CoreFoundation/CoreFoundation.h>
8
9 #if defined(__cplusplus)
10 extern "C" {
11 #endif
12
13 enum {
14 auth_token_state_zombie = 1 << 0,
15 auth_token_state_registered = 1 << 1
16 };
17 typedef uint32_t auth_token_state_t;
18
19 extern const CFDictionaryKeyCallBacks kAuthTokenKeyCallBacks;
20
21 AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL_ALL AUTH_RETURNS_RETAINED
22 auth_token_t auth_token_create(process_t,bool operateAsLeastPrivileged);
23
24 AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL_ALL AUTH_RETURNS_RETAINED
25 auth_token_t auth_token_create_with_audit_info(const audit_info_s*,bool operateAsLeastPrivileged);
26
27 AUTH_NONNULL_ALL
28 bool auth_token_get_sandboxed(auth_token_t);
29
30 AUTH_NONNULL_ALL
31 const char * auth_token_get_code_url(auth_token_t);
32
33 AUTH_NONNULL_ALL
34 const void * auth_token_get_key(auth_token_t);
35
36 AUTH_NONNULL_ALL
37 auth_items_t auth_token_get_context(auth_token_t);
38
39 AUTH_NONNULL_ALL
40 bool auth_token_least_privileged(auth_token_t);
41
42 AUTH_NONNULL_ALL
43 uid_t auth_token_get_uid(auth_token_t);
44
45 AUTH_NONNULL_ALL
46 pid_t auth_token_get_pid(auth_token_t);
47
48 AUTH_NONNULL_ALL
49 session_t auth_token_get_session(auth_token_t);
50
51 AUTH_NONNULL_ALL
52 const AuthorizationBlob * auth_token_get_blob(auth_token_t);
53
54 AUTH_NONNULL_ALL
55 const audit_info_s * auth_token_get_audit_info(auth_token_t);
56
57 AUTH_NONNULL_ALL
58 mach_port_t auth_token_get_creator_bootstrap(auth_token_t auth);
59
60 AUTH_NONNULL_ALL
61 CFIndex auth_token_add_process(auth_token_t,process_t);
62
63 AUTH_NONNULL_ALL
64 CFIndex auth_token_remove_process(auth_token_t,process_t);
65
66 AUTH_NONNULL_ALL
67 CFIndex auth_token_get_process_count(auth_token_t);
68
69 AUTH_NONNULL_ALL
70 void auth_token_set_credential(auth_token_t,credential_t);
71
72 AUTH_NONNULL_ALL
73 bool auth_token_credentials_iterate(auth_token_t, credential_iterator_t iter);
74
75 AUTH_NONNULL_ALL
76 void auth_token_set_right(auth_token_t,credential_t);
77
78 AUTH_NONNULL_ALL
79 bool auth_token_rights_iterate(auth_token_t, credential_iterator_t iter);
80
81 AUTH_NONNULL_ALL
82 CFTypeRef auth_token_copy_entitlement_value(auth_token_t, const char * entitlement);
83
84 AUTH_NONNULL_ALL
85 bool auth_token_has_entitlement(auth_token_t, const char * entitlement);
86
87 AUTH_NONNULL_ALL
88 bool auth_token_has_entitlement_for_right(auth_token_t, const char * right);
89
90 AUTH_NONNULL_ALL
91 credential_t auth_token_get_credential(auth_token_t);
92
93 AUTH_NONNULL_ALL
94 bool auth_token_apple_signed(auth_token_t);
95
96 AUTH_NONNULL_ALL
97 bool auth_token_is_creator(auth_token_t,process_t);
98
99 AUTH_NONNULL_ALL
100 void auth_token_set_state(auth_token_t,auth_token_state_t);
101
102 AUTH_NONNULL_ALL
103 void auth_token_clear_state(auth_token_t,auth_token_state_t);
104
105 AUTH_WARN_RESULT AUTH_NONNULL_ALL
106 auth_token_state_t auth_token_get_state(auth_token_t);
107
108 AUTH_NONNULL_ALL
109 bool auth_token_check_state(auth_token_t, auth_token_state_t);
110
111 #if defined(__cplusplus)
112 }
113 #endif
114
115 #endif /* !_SECURITY_AUTH_AUTHTOKEN_H_ */