diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2002-04-17 20:52:45 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2002-04-17 20:52:45 +0000 |
commit | 44bbdb2623f2135d0104311052604484e417b993 (patch) | |
tree | 27dcd8925ae6e16c2403afd3bc7a2f7bc8ebbbc0 | |
parent | 795f4f2fe784cf9fe807a778241f7fdd5653bf61 (diff) | |
download | tinyproxy-44bbdb2623f2135d0104311052604484e417b993.tar.gz tinyproxy-44bbdb2623f2135d0104311052604484e417b993.zip |
Changed the check_acl() function to require the peer IP address and string
address from the calling function.
Diffstat (limited to '')
-rw-r--r-- | src/acl.c | 16 | ||||
-rw-r--r-- | src/acl.h | 4 |
2 files changed, 7 insertions, 13 deletions
@@ -1,4 +1,4 @@ -/* $Id: acl.c,v 1.12 2002-04-09 19:11:09 rjkaes Exp $ +/* $Id: acl.c,v 1.13 2002-04-17 20:52:45 rjkaes Exp $ * * This system handles Access Control for use of this daemon. A list of * domains, or IP addresses (including IP blocks) are stored in a list @@ -133,7 +133,7 @@ insert_acl(char *location, acl_access_t access_type) } /* - * Checks where file descriptor is allowed. + * Checks whether file descriptor is allowed. * * Returns: * 1 if allowed @@ -141,13 +141,13 @@ insert_acl(char *location, acl_access_t access_type) * -1 if error */ int -check_acl(int fd) +check_acl(int fd, const char* ip_address, const char* string_address) { struct acl_s *aclptr; - char ip_address[PEER_IP_LENGTH]; - char string_address[PEER_STRING_LENGTH]; assert(fd >= 0); + assert(ip_address != NULL); + assert(string_address != NULL); /* * If there is no access list allow everything. @@ -156,12 +156,6 @@ check_acl(int fd) if (!aclptr) return 1; - /* - * Get the IP address and the string domain. - */ - getpeer_ip(fd, ip_address); - getpeer_string(fd, string_address); - while (aclptr) { if (aclptr->type == ACL_STRING) { size_t test_length = strlen(string_address); @@ -1,4 +1,4 @@ -/* $Id: acl.h,v 1.2 2001-06-02 02:07:34 rjkaes Exp $ +/* $Id: acl.h,v 1.3 2002-04-17 20:52:45 rjkaes Exp $ * * See 'acl.c' for detailed information. * @@ -21,6 +21,6 @@ typedef enum { ACL_ALLOW, ACL_DENY } acl_access_t; extern int insert_acl(char *location, acl_access_t access_type); -extern int check_acl(int fd); +extern int check_acl(int fd, const char* ip_address, const char* string_address); #endif |