]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Rename acl functions.
authorAndre Noll <maan@systemlinux.org>
Sun, 13 Jan 2008 15:46:28 +0000 (16:46 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 13 Jan 2008 15:46:28 +0000 (16:46 +0100)
Prefix public functions with acl.

acl.c
acl.h
http_send.c

diff --git a/acl.c b/acl.c
index 3a30bd453306cfc65c0dc0605af9e9015b88f1d6..552ee0b1a34a338e2d0d7640bdba90a6e98eee7c 100644 (file)
--- a/acl.c
+++ b/acl.c
@@ -37,7 +37,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);
 }
 
-int host_in_acl(int fd, struct list_head *acl)
+int acl_lookup(int fd, struct list_head *acl)
 {
        struct access_info *ai, *tmp;
        struct sockaddr_storage ss;
@@ -59,7 +59,7 @@ no_match:
        return 0;
 }
 
-void add_acl_entry(struct list_head *acl, struct in_addr addr,
+void acl_add_entry(struct list_head *acl, struct in_addr addr,
                int netmask)
 {
        struct access_info *ai = para_malloc(sizeof(struct access_info));
@@ -71,7 +71,7 @@ void add_acl_entry(struct list_head *acl, struct in_addr addr,
 }
 
 
-void del_acl_entry(struct list_head *acl, struct in_addr addr,
+void acl_del_entry(struct list_head *acl, struct in_addr addr,
                int netmask)
 {
        struct access_info *ai, *tmp;
@@ -89,7 +89,7 @@ void del_acl_entry(struct list_head *acl, struct in_addr addr,
        }
 }
 
-char *get_acl_contents(struct list_head *acl)
+char *acl_get_contents(struct list_head *acl)
 {
        struct access_info *ai, *tmp_ai;
        char *ret = NULL;
@@ -103,7 +103,7 @@ char *get_acl_contents(struct list_head *acl)
        return ret;
 }
 
-void init_acl(struct list_head *acl, char * const *acl_info, int num)
+void acl_init(struct list_head *acl, char * const *acl_info, int num)
 {
        int i;
 
@@ -122,7 +122,7 @@ void init_acl(struct list_head *acl, char * const *acl_info, int num)
                netmask = atoi(++p);
                if (netmask < 0 || netmask > 32)
                        goto err;
-               add_acl_entry(acl, addr, netmask);
+               acl_add_entry(acl, addr, netmask);
                goto success;
 err:
                PARA_CRIT_LOG("syntax error: %s\n", acl_info[i]);
diff --git a/acl.h b/acl.h
index 994fd6fe29c1d337158d24b8fb0058d65fb6d0ec..34686e91f50b50c4a4652c2420721015acbe68e0 100644 (file)
--- a/acl.h
+++ b/acl.h
@@ -1,8 +1,8 @@
 
-void init_acl(struct list_head *acl, char * const *acl_info, int num);
-int host_in_acl(int fd, struct list_head *acl);
-void add_acl_entry(struct list_head *acl, struct in_addr addr,
+void acl_init(struct list_head *acl, char * const *acl_info, int num);
+int acl_lookup(int fd, struct list_head *acl);
+void acl_add_entry(struct list_head *acl, struct in_addr addr,
                int netmask);
-void del_acl_entry(struct list_head *acl, struct in_addr addr,
+void acl_del_entry(struct list_head *acl, struct in_addr addr,
                int netmask);
-char *get_acl_contents(struct list_head *acl);
+char *acl_get_contents(struct list_head *acl);
index d2bd3531cf4069c428e6091fa1d722830e88269e..0cab7420322e9a347119ee47210a702e88be0261 100644 (file)
@@ -249,8 +249,8 @@ static void http_post_select(fd_set *rfds, fd_set *wfds)
                err_msg = "server full";
                goto err_out;
        }
-       match = host_in_acl(hc->fd, &http_acl);
-       PARA_DEBUG_LOG("host_in_acl: %d\n", match);
+       match = acl_lookup(hc->fd, &http_acl);
+       PARA_DEBUG_LOG("acl lookup returned %d\n", match);
        if ((match && !conf.http_default_deny_given) ||
                        (!match && conf.http_default_deny_given)) {
                err_msg = "permission denied";
@@ -349,18 +349,18 @@ static int http_com_off(__a_unused struct sender_command_data *scd)
 static int http_com_deny(struct sender_command_data *scd)
 {
        if (conf.http_default_deny_given)
-               del_acl_entry(&http_acl, scd->addr, scd->netmask);
+               acl_del_entry(&http_acl, scd->addr, scd->netmask);
        else
-               add_acl_entry(&http_acl, scd->addr, scd->netmask);
+               acl_add_entry(&http_acl, scd->addr, scd->netmask);
        return 1;
 }
 
 static int http_com_allow(struct sender_command_data *scd)
 {
        if (conf.http_default_deny_given)
-               add_acl_entry(&http_acl, scd->addr, scd->netmask);
+               acl_add_entry(&http_acl, scd->addr, scd->netmask);
        else
-               del_acl_entry(&http_acl, scd->addr, scd->netmask);
+               acl_del_entry(&http_acl, scd->addr, scd->netmask);
        return 1;
 }
 
@@ -369,7 +369,7 @@ static char *http_info(void)
        char *clnts = NULL, *ret;
        struct http_client *hc, *tmp_hc;
 
-       char *acl_contents = get_acl_contents(&http_acl);
+       char *acl_contents = acl_get_contents(&http_acl);
        list_for_each_entry_safe(hc, tmp_hc, &clients, node) {
                char *tmp = make_message("%s%s ", clnts? clnts : "", hc->name);
                free(clnts);
@@ -429,7 +429,7 @@ void http_send_init(struct sender *s)
        s->client_cmds[SENDER_ADD] = NULL;
        s->client_cmds[SENDER_DELETE] = NULL;
        self = s;
-       init_acl(&http_acl, conf.http_access_arg, conf.http_access_given);
+       acl_init(&http_acl, conf.http_access_arg, conf.http_access_given);
        if (!conf.http_no_autostart_given)
                open_tcp_port(conf.http_port_arg); /* ignore errors */
        PARA_DEBUG_LOG("%s", "http sender init complete\n");