| 1328 | |
| 1329 | |
| 1330 | static IPAddressACL* parse_dynamic_acl(FFStream *stream, HTTPContext *c) |
| 1331 | { |
| 1332 | FILE* f; |
| 1333 | char line[1024]; |
| 1334 | char cmd[1024]; |
| 1335 | IPAddressACL *acl = NULL; |
| 1336 | int line_num = 0; |
| 1337 | const char *p; |
| 1338 | |
| 1339 | f = fopen(stream->dynamic_acl, "r"); |
| 1340 | if (!f) { |
| 1341 | perror(stream->dynamic_acl); |
| 1342 | return NULL; |
| 1343 | } |
| 1344 | |
| 1345 | acl = av_mallocz(sizeof(IPAddressACL)); |
| 1346 | |
| 1347 | /* Build ACL */ |
| 1348 | for(;;) { |
| 1349 | if (fgets(line, sizeof(line), f) == NULL) |
| 1350 | break; |
| 1351 | line_num++; |
| 1352 | p = line; |
| 1353 | while (isspace(*p)) |
| 1354 | p++; |
| 1355 | if (*p == '\0' || *p == '#') |
| 1356 | continue; |
| 1357 | get_arg(cmd, sizeof(cmd), &p); |
| 1358 | |
| 1359 | if (!strcasecmp(cmd, "ACL")) |
| 1360 | parse_acl_row(NULL, NULL, acl, p, stream->dynamic_acl, line_num); |
| 1361 | } |
| 1362 | fclose(f); |
| 1363 | return acl; |
| 1364 | } |
| 1365 | |
| 1366 | |
| 1367 | static void free_acl_list(IPAddressACL *in_acl) |
no test coverage detected