src/server/config/acl.h

changeset 415
d938228c382e
parent 394
4d2a1df73e18
equal deleted inserted replaced
414:99a34860c105 415:d938228c382e
34 34
35 #ifdef __cplusplus 35 #ifdef __cplusplus
36 extern "C" { 36 extern "C" {
37 #endif 37 #endif
38 38
39 #define CFG_ACE_ADD(list_begin, elm) \
40 cx_linked_list_add((void**)list_begin, NULL, -1, offsetof(ACEConfig, next), elm)
41
42 #define CFG_ACE_LIST_SIZE(list) \
43 cx_linked_list_size(list, offsetof(ACEConfig, next))
44
39 typedef struct _acl_conf ACLConfig; 45 typedef struct _acl_conf ACLConfig;
46 typedef struct _ace_conf ACEConfig;
40 47
41 typedef struct _acl_file { 48 typedef struct _acl_file {
42 ConfigParser parser; 49 ConfigParser parser;
43 UcxList *namedACLs; // ACLConfig list 50 CxList *namedACLs; // ACLConfig list
44 UcxList *uriACLs; // ACLConfig list 51 CxList *uriACLs; // ACLConfig list
45 UcxList *pathACLs; // ACLConfig list 52 CxList *pathACLs; // ACLConfig list
46 // temp data 53 // temp data
47 ACLConfig *cur; 54 ACLConfig *cur;
48 } ACLFile; 55 } ACLFile;
49 56
50 struct _acl_conf { 57 struct _acl_conf {
51 sstr_t id; // name, uri or path 58 cxmutstr id; // name, uri or path
52 sstr_t type; // webserver ACL or file system ACL 59 cxmutstr type; // webserver ACL or file system ACL
53 UcxList *authparam; // authentication parameters 60 ConfigParam *authparam; // authentication parameters
54 UcxList *entries; // ACEConfig list 61 ACEConfig *entries; // ACEConfig list
55 }; 62 };
56 63
57 typedef struct _ace_conf { 64 struct _ace_conf {
58 sstr_t who; 65 cxmutstr who;
59 uint32_t access_mask; 66 uint32_t access_mask;
60 uint16_t flags; 67 uint16_t flags;
61 uint16_t type; 68 uint16_t type;
62 } ACEConfig; 69 ACEConfig *next;
70 };
63 71
64 72
65 /* 73 /*
66 * the flags are a duplicate of the webserver's acl flags 74 * the flags are a duplicate of the webserver's acl flags
67 */ 75 */
113 #define ACLCFG_TYPE_DENIED 0x02 121 #define ACLCFG_TYPE_DENIED 0x02
114 #define ACLCFG_TYPE_AUDIT 0x03 122 #define ACLCFG_TYPE_AUDIT 0x03
115 #define ACLCFG_TYPE_ALARM 0x04 123 #define ACLCFG_TYPE_ALARM 0x04
116 124
117 125
118 ACLFile* load_acl_file(char *file); 126 ACLFile* load_acl_file(const char *file);
119 127
120 void free_acl_file(ACLFile *aclfile); 128 void free_acl_file(ACLFile *aclfile);
121 129
122 130
123 int acl_parse(void *p, ConfigLine *begin, ConfigLine *end, sstr_t line); 131 int acl_parse(void *p, ConfigLine *begin, ConfigLine *end, cxmutstr line);
124 int parse_ace(ACLFile *f, sstr_t line); 132 int parse_ace(ACLFile *f, cxmutstr line);
125 133
126 /* 134 /*
127 * converts a access right string to an integer value 135 * converts a access right string to an integer value
128 */ 136 */
129 uint32_t accstr2int(sstr_t access); 137 uint32_t accstr2int(cxstring access);
130 138
131 #ifdef __cplusplus 139 #ifdef __cplusplus
132 } 140 }
133 #endif 141 #endif
134 142

mercurial