452:ce359a2b51fe | 453:4586d534f9b5 |
---|---|
29 #include <stdio.h> | 29 #include <stdio.h> |
30 #include <stdlib.h> | 30 #include <stdlib.h> |
31 #include <string.h> | 31 #include <string.h> |
32 | 32 |
33 #include "acl.h" | 33 #include "acl.h" |
34 #include "logging.h" | |
34 | 35 |
35 ACLFile* load_acl_file(const char *file) { | 36 ACLFile* load_acl_file(const char *file) { |
36 FILE *in = fopen(file, "r"); | 37 FILE *in = fopen(file, "r"); |
37 if(in == NULL) { | 38 if(in == NULL) { |
38 return NULL; | 39 return NULL; |
113 CxAllocator *mp = f->parser.mp; | 114 CxAllocator *mp = f->parser.mp; |
114 | 115 |
115 cxstring *tk = NULL; | 116 cxstring *tk = NULL; |
116 ssize_t tkn = cx_strsplit_a(mp, cx_strcast(line), cx_str(":"), ACE_MAX_TOKENS, &tk); | 117 ssize_t tkn = cx_strsplit_a(mp, cx_strcast(line), cx_str(":"), ACE_MAX_TOKENS, &tk); |
117 if(!tk || tkn < 3) { | 118 if(!tk || tkn < 3) { |
118 log_ereport(LOG_FAILURE, "parse_ace: to few tokens: %.*s", (int)line.length, line.ptr); | 119 ws_cfg_log(LOG_FAILURE, "parse_ace: to few tokens: %.*s", (int)line.length, line.ptr); |
119 return 1; | 120 return 1; |
120 } | 121 } |
121 | 122 |
122 ACEConfig *ace = OBJ_NEW(mp, ACEConfig); | 123 ACEConfig *ace = OBJ_NEW(mp, ACEConfig); |
123 memset(ace, 0, sizeof(ACEConfig)); | 124 memset(ace, 0, sizeof(ACEConfig)); |
156 * get the access mask | 157 * get the access mask |
157 */ | 158 */ |
158 | 159 |
159 if(n >= tkn) { | 160 if(n >= tkn) { |
160 // to few tokens | 161 // to few tokens |
161 log_ereport(LOG_FAILURE, "parse_ace: ace incomplete"); | 162 ws_cfg_log(LOG_FAILURE, "parse_ace: ace incomplete"); |
162 return 1; | 163 return 1; |
163 } | 164 } |
164 s = tk[n]; | 165 s = tk[n]; |
165 | 166 |
166 cxstring *accessmask = NULL; | 167 cxstring *accessmask = NULL; |
212 } | 213 } |
213 n++; | 214 n++; |
214 } | 215 } |
215 | 216 |
216 if(!complete) { | 217 if(!complete) { |
217 log_ereport(LOG_FAILURE, "parse_ace: ace incomplete"); | 218 ws_cfg_log(LOG_FAILURE, "parse_ace: ace incomplete"); |
218 return 1; | 219 return 1; |
219 } | 220 } |
220 | 221 |
221 CFG_ACE_ADD(&cur->entries, ace); | 222 CFG_ACE_ADD(&cur->entries, ace); |
222 | 223 |