From 44bbdb2623f2135d0104311052604484e417b993 Mon Sep 17 00:00:00 2001 From: Robert James Kaes Date: Wed, 17 Apr 2002 20:52:45 +0000 Subject: Changed the check_acl() function to require the peer IP address and string address from the calling function. --- src/acl.c | 16 +++++----------- src/acl.h | 4 ++-- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/acl.c b/src/acl.c index c0a8611..fe7bee8 100644 --- a/src/acl.c +++ b/src/acl.c @@ -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); diff --git a/src/acl.h b/src/acl.h index 73ea83c..112bb36 100644 --- a/src/acl.h +++ b/src/acl.h @@ -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 -- cgit v1.2.3