| 1377 | } |
| 1378 | |
| 1379 | static int validate_acl_list(IPAddressACL *in_acl, HTTPContext *c) |
| 1380 | { |
| 1381 | enum IPAddressAction last_action = IP_DENY; |
| 1382 | IPAddressACL *acl; |
| 1383 | struct in_addr *src = &c->from_addr.sin_addr; |
| 1384 | unsigned long src_addr = src->s_addr; |
| 1385 | |
| 1386 | for (acl = in_acl; acl; acl = acl->next) { |
| 1387 | if (src_addr >= acl->first.s_addr && src_addr <= acl->last.s_addr) |
| 1388 | return (acl->action == IP_ALLOW) ? 1 : 0; |
| 1389 | last_action = acl->action; |
| 1390 | } |
| 1391 | |
| 1392 | /* Nothing matched, so return not the last action */ |
| 1393 | return (last_action == IP_DENY) ? 1 : 0; |
| 1394 | } |
| 1395 | |
| 1396 | static int validate_acl(FFStream *stream, HTTPContext *c) |
| 1397 | { |