http_send.c: Make host_in_acl() generic.
[paraslash.git] / http_send.c
index ab437f4b72eb96308f07451925b9e9c150656c03..e140f5f2c48b1cf806fbb4c70a0618df1d18290e 100644 (file)
@@ -214,7 +214,7 @@ static int v4_addr_match(uint32_t addr_1, uint32_t addr_2, uint8_t netmask)
        return (htonl(addr_1) & mask) == (htonl(addr_2) & mask);
 }
 
-static int host_in_acl(int fd)
+static int host_in_acl(int fd, struct list_head *acl)
 {
        struct access_info *ai, *tmp;
        struct sockaddr_storage ss;
@@ -229,7 +229,7 @@ static int host_in_acl(int fd)
        if (!v4_addr.s_addr)
                goto no_match;
 
-       list_for_each_entry_safe(ai, tmp, &http_acl, node)
+       list_for_each_entry_safe(ai, tmp, acl, node)
                if (v4_addr_match(v4_addr.s_addr, ai->addr.s_addr, ai->netmask))
                        return 1;
 no_match:
@@ -294,7 +294,7 @@ static void http_post_select(fd_set *rfds, fd_set *wfds)
                err_msg = "server full";
                goto err_out;
        }
-       match = host_in_acl(hc->fd);
+       match = host_in_acl(hc->fd, &http_acl);
        PARA_DEBUG_LOG("host_in_acl: %d\n", match);
        if ((match && !conf.http_default_deny_given) ||
                        (!match && conf.http_default_deny_given)) {