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