]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - http_send.c
Implement access control for the dccp sender.
[paraslash.git] / http_send.c
index 63bfec03c9d1cd17ac4b34a7609c32c28c218ead..9a55ba0ecb1f540d93d12442e693cf642f8aa5c0 100644 (file)
@@ -98,7 +98,7 @@ static void http_send(long unsigned current_chunk,
 
 static void http_post_select(fd_set *rfds, __a_unused fd_set *wfds)
 {
 
 static void http_post_select(fd_set *rfds, __a_unused fd_set *wfds)
 {
-       int ret, fd, match;
+       int ret, fd;
        struct sender_client *sc, *tmp;
        struct private_http_sender_data *phsd;
 
        struct sender_client *sc, *tmp;
        struct private_http_sender_data *phsd;
 
@@ -147,11 +147,8 @@ static void http_post_select(fd_set *rfds, __a_unused fd_set *wfds)
        ret = mark_fd_nonblocking(fd);
        if (ret < 0)
                goto err_out;
        ret = mark_fd_nonblocking(fd);
        if (ret < 0)
                goto err_out;
-       match = acl_lookup(fd, &http_acl);
-       PARA_DEBUG_LOG("acl lookup returned %d\n", match);
-       ret = -E_ACL_PERM;
-       if ((match && !conf.http_default_deny_given) ||
-                       (!match && conf.http_default_deny_given))
+       ret = acl_check_access(fd, &http_acl, conf.http_default_deny_given);
+       if (ret < 0)
                goto err_out;
        numclients++;
        sc = para_calloc(sizeof(*sc));
                goto err_out;
        numclients++;
        sc = para_calloc(sizeof(*sc));
@@ -207,19 +204,15 @@ static int http_com_off(__a_unused struct sender_command_data *scd)
 
 static int http_com_deny(struct sender_command_data *scd)
 {
 
 static int http_com_deny(struct sender_command_data *scd)
 {
-       if (conf.http_default_deny_given)
-               acl_del_entry(&http_acl, scd->addr, scd->netmask);
-       else
-               acl_add_entry(&http_acl, scd->addr, scd->netmask);
+       acl_deny(scd->addr, scd->netmask, &http_acl,
+               conf.http_default_deny_given);
        return 1;
 }
 
 static int http_com_allow(struct sender_command_data *scd)
 {
        return 1;
 }
 
 static int http_com_allow(struct sender_command_data *scd)
 {
-       if (conf.http_default_deny_given)
-               acl_add_entry(&http_acl, scd->addr, scd->netmask);
-       else
-               acl_del_entry(&http_acl, scd->addr, scd->netmask);
+       acl_allow(scd->addr, scd->netmask, &http_acl,
+               conf.http_default_deny_given);
        return 1;
 }
 
        return 1;
 }