Changed the check_acl() function to require the peer IP address and string
address from the calling function.
This commit is contained in:
parent
795f4f2fe7
commit
44bbdb2623
16
src/acl.c
16
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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user