acl: add function flush_access_list().
This commit is contained in:
parent
2e6999df4a
commit
6266197e92
24
src/acl.c
24
src/acl.c
@ -357,3 +357,27 @@ int check_acl (const char *ip, const char *host)
|
|||||||
host, ip);
|
host, ip);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void flush_access_list (void)
|
||||||
|
{
|
||||||
|
struct acl_s *acl;
|
||||||
|
size_t i;
|
||||||
|
|
||||||
|
if (!access_list) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We need to free allocated data hanging off the acl entries
|
||||||
|
* before we can free the acl entries themselves.
|
||||||
|
* A hierarchical memory system would be great...
|
||||||
|
*/
|
||||||
|
for (i = 0; i != (size_t) vector_length (access_list); ++i) {
|
||||||
|
acl = (struct acl_s *) vector_getentry (access_list, i, NULL);
|
||||||
|
if (acl->type == ACL_STRING) {
|
||||||
|
safefree (acl->address.string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
vector_delete (access_list);
|
||||||
|
}
|
||||||
|
@ -25,5 +25,6 @@ typedef enum { ACL_ALLOW, ACL_DENY } acl_access_t;
|
|||||||
|
|
||||||
extern int insert_acl (char *location, acl_access_t access_type);
|
extern int insert_acl (char *location, acl_access_t access_type);
|
||||||
extern int check_acl (const char *ip_address, const char *string_address);
|
extern int check_acl (const char *ip_address, const char *string_address);
|
||||||
|
extern void flush_access_list (void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user