From: Andre Noll Date: Sun, 13 Jan 2008 15:02:39 +0000 (+0100) Subject: http_send.c: Only pass the fd to host_in_access_perm_list(). X-Git-Tag: v0.3.1~95^2~8 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=6087405d00ebd7f3a6d8f383ab99b786a99029c2 http_send.c: Only pass the fd to host_in_access_perm_list(). No need to pass a pointer to struct http_client as only its ->fd member is used. Rename this function to host_in_acl while we're at it. --- diff --git a/http_send.c b/http_send.c index 7fe216b1..ab437f4b 100644 --- a/http_send.c +++ b/http_send.c @@ -214,14 +214,14 @@ 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_access_perm_list(struct http_client *hc) +static int host_in_acl(int fd) { struct access_info *ai, *tmp; struct sockaddr_storage ss; socklen_t sslen = sizeof(ss); struct in_addr v4_addr; - if (getpeername(hc->fd, (struct sockaddr *)&ss, &sslen) < 0) { + if (getpeername(fd, (struct sockaddr *)&ss, &sslen) < 0) { PARA_ERROR_LOG("Can not determine peer address: %s\n", strerror(errno)); goto no_match; } @@ -294,8 +294,8 @@ static void http_post_select(fd_set *rfds, fd_set *wfds) err_msg = "server full"; goto err_out; } - match = host_in_access_perm_list(hc); - PARA_DEBUG_LOG("host_in_access_perm_list: %d\n", match); + match = host_in_acl(hc->fd); + PARA_DEBUG_LOG("host_in_acl: %d\n", match); if ((match && !conf.http_default_deny_given) || (!match && conf.http_default_deny_given)) { err_msg = "permission denied";