1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #ifndef _CONFIG_ACL_H
30 #define _CONFIG_ACL_H
31
32 #include "conf.h"
33 #include <inttypes.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 typedef struct _acl_conf ACLConfig;
40
41 typedef struct _acl_file {
42 ConfigParser parser;
43 UcxList *namedACLs;
44 UcxList *uriACLs;
45 UcxList *pathACLs;
46
47 ACLConfig *cur;
48 } ACLFile;
49
50 struct _acl_conf {
51 sstr_t id;
52 sstr_t type;
53 UcxList *authparam;
54 UcxList *entries;
55 };
56
57 typedef struct _ace_conf {
58 sstr_t who;
59 uint32_t access_mask;
60 uint16_t flags;
61 uint16_t type;
62 } ACEConfig;
63
64
65
66
67
68
69
70
71
72 #define ACLCFG_READ_DATA 0x0001
73 #define ACLCFG_WRITE_DATA 0x0002
74 #define ACLCFG_APPEND 0x0002
75 #define ACLCFG_ADD_FILE 0x0004
76 #define ACLCFG_ADD_SUBDIRECTORY 0x0004
77 #define ACLCFG_READ_XATTR 0x0008
78 #define ACLCFG_WRITE_XATTR 0x0010
79 #define ACLCFG_EXECUTE 0x0020
80 #define ACLCFG_DELETE_CHILD 0x0040
81 #define ACLCFG_DELETE 0x0040
82 #define ACLCFG_READ_ATTRIBUTES 0x0080
83 #define ACLCFG_WRITE_ATTRIBUTES 0x0100
84 #define ACLCFG_LIST 0x0200
85 #define ACLCFG_READ_ACL 0x0400
86 #define ACLCFG_WRITE_ACL 0x0800
87 #define ACLCFG_WRITE_OWNER 0x1000
88 #define ACLCFG_SYNCHRONIZE 0x2000
89
90 #define ACLCFG_READ \
91 (
ACLCFG_READ_DATA|
ACLCFG_READ_XATTR|
ACLCFG_READ_ATTRIBUTES)
92 #define ACLCFG_WRITE \
93 (
ACLCFG_WRITE_DATA|
ACLCFG_WRITE_XATTR|
ACLCFG_WRITE_ATTRIBUTES)
94
95
96
97
98 #define ACLCFG_FILE_INHERIT 0x0001
99 #define ACLCFG_DIR_INHERIT 0x0002
100 #define ACLCFG_NO_PROPAGATE 0x0004
101 #define ACLCFG_INHERIT_ONLY 0x0008
102 #define ACLCFG_SUCCESSFUL_ACCESS_FLAG 0x0010
103 #define ACLCFG_FAILED_ACCESS_ACE_FLAG 0x0020
104 #define ACLCFG_IDENTIFIER_GROUP 0x0040
105 #define ACLCFG_OWNER 0x1000
106 #define ACLCFG_GROUP 0x2000
107 #define ACLCFG_EVERYONE 0x4000
108
109
110
111
112 #define ACLCFG_TYPE_ALLOWED 0x01
113 #define ACLCFG_TYPE_DENIED 0x02
114 #define ACLCFG_TYPE_AUDIT 0x03
115 #define ACLCFG_TYPE_ALARM 0x04
116
117
118 ACLFile* load_acl_file(
char *file);
119
120 void free_acl_file(ACLFile *aclfile);
121
122
123 int acl_parse(
void *p, ConfigLine *begin, ConfigLine *end,
sstr_t line);
124 int parse_ace(ACLFile *f,
sstr_t line);
125
126
127
128
129 uint32_t accstr2int(
sstr_t access);
130
131 #ifdef __cplusplus
132 }
133 #endif
134
135 #endif
136
137