]> git.saurik.com Git - apple/security.git/blob - OSX/authd/rule.h
Security-58286.41.2.tar.gz
[apple/security.git] / OSX / authd / rule.h
1 /* Copyright (c) 2012-2013 Apple Inc. All Rights Reserved. */
2
3 #ifndef _SECURITY_AUTH_RULE_H_
4 #define _SECURITY_AUTH_RULE_H_
5
6 #include "authdb.h"
7 #include <CoreFoundation/CoreFoundation.h>
8 #include <Security/SecRequirement.h>
9
10 #if defined(__cplusplus)
11 extern "C" {
12 #endif
13
14 typedef bool (^mechanism_iterator_t)(mechanism_t mechanism);
15 typedef bool (^delegate_iterator_t)(rule_t delegate);
16
17 typedef enum {
18 RT_RIGHT = 1,
19 RT_RULE
20 } RuleType;
21
22 typedef enum {
23 RC_USER = 1,
24 RC_RULE,
25 RC_MECHANISM,
26 RC_ALLOW,
27 RC_DENY
28 } RuleClass;
29
30 enum {
31 RuleFlagShared = 1 << 0,
32 RuleFlagAllowRoot = 1 << 1,
33 RuleFlagSessionOwner = 1 << 2,
34 RuleFlagAuthenticateUser = 1 << 3,
35 RuleFlagExtractPassword = 1 << 4,
36 RuleFlagEntitled = 1 << 5,
37 RuleFlagEntitledAndGroup = 1 << 6,
38 RuleFlagRequireAppleSigned = 1 << 7,
39 RuleFlagVPNEntitledAndGroup = 1 << 8,
40 RuleFlagPasswordOnly = 1 << 9
41 };
42 typedef uint32_t RuleFlags;
43
44 AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL_ALL AUTH_RETURNS_RETAINED
45 rule_t rule_create_default(void);
46
47 AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL_ALL AUTH_RETURNS_RETAINED
48 rule_t rule_create_preauthorization(void);
49
50 AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL1 AUTH_RETURNS_RETAINED
51 rule_t rule_create_with_string(const char *,authdb_connection_t);
52
53 AUTH_WARN_RESULT AUTH_MALLOC AUTH_NONNULL_ALL AUTH_RETURNS_RETAINED
54 rule_t rule_create_with_plist(RuleType,CFStringRef,CFDictionaryRef,authdb_connection_t);
55
56 AUTH_NONNULL_ALL
57 size_t rule_get_mechanisms_count(rule_t);
58
59 AUTH_NONNULL_ALL
60 CFArrayRef rule_get_mechanisms(rule_t);
61
62 AUTH_NONNULL_ALL
63 bool rule_mechanisms_iterator(rule_t,mechanism_iterator_t iter);
64
65 AUTH_NONNULL_ALL
66 size_t rule_get_delegates_count(rule_t);
67
68 AUTH_NONNULL_ALL
69 bool rule_delegates_iterator(rule_t,delegate_iterator_t iter);
70
71 AUTH_NONNULL_ALL
72 bool rule_sql_fetch(rule_t,authdb_connection_t);
73
74 AUTH_NONNULL1 AUTH_NONNULL2
75 bool rule_sql_commit(rule_t,authdb_connection_t,CFAbsoluteTime,process_t);
76
77 AUTH_NONNULL_ALL
78 bool rule_sql_remove(rule_t,authdb_connection_t);
79
80 AUTH_NONNULL_ALL
81 CFMutableDictionaryRef rule_copy_to_cfobject(rule_t,authdb_connection_t);
82
83 AUTH_NONNULL_ALL
84 int64_t rule_get_id(rule_t);
85
86 AUTH_NONNULL_ALL
87 const char * rule_get_name(rule_t);
88
89 AUTH_NONNULL_ALL
90 RuleType rule_get_type(rule_t);
91
92 AUTH_NONNULL_ALL
93 RuleClass rule_get_class(rule_t);
94
95 AUTH_NONNULL_ALL
96 const char * rule_get_group(rule_t);
97
98 AUTH_NONNULL_ALL
99 int64_t rule_get_kofn(rule_t);
100
101 AUTH_NONNULL_ALL
102 int64_t rule_get_timeout(rule_t);
103
104 AUTH_NONNULL_ALL
105 bool rule_check_flags(rule_t,RuleFlags);
106
107 AUTH_NONNULL_ALL
108 bool rule_get_shared(rule_t);
109
110 AUTH_NONNULL_ALL
111 bool rule_get_allow_root(rule_t);
112
113 AUTH_NONNULL_ALL
114 bool rule_get_session_owner(rule_t);
115
116 AUTH_NONNULL_ALL
117 bool rule_get_authenticate_user(rule_t);
118
119 AUTH_NONNULL_ALL
120 bool rule_get_extract_password(rule_t);
121
122 AUTH_NONNULL_ALL
123 bool rule_get_password_only(rule_t);
124
125 AUTH_NONNULL_ALL
126 int64_t rule_get_tries(rule_t);
127
128 AUTH_NONNULL_ALL
129 const char * rule_get_comment(rule_t);
130
131 AUTH_NONNULL_ALL
132 int64_t rule_get_version(rule_t);
133
134 AUTH_NONNULL_ALL
135 double rule_get_created(rule_t);
136
137 AUTH_NONNULL_ALL
138 double rule_get_modified(rule_t);
139
140 AUTH_NONNULL_ALL
141 const char * rule_get_identifier(rule_t);
142
143 AUTH_NONNULL_ALL
144 CFDataRef rule_get_requirement_data(rule_t);
145
146 AUTH_NONNULL_ALL
147 SecRequirementRef rule_get_requirement(rule_t);
148
149 #if defined(__cplusplus)
150 }
151 #endif
152
153 #endif /* !_SECURITY_AUTH_RULE_H_ */