/** \file acl.c Access control lists for paraslash senders. */
+#include <regex.h>
+
#include "para.h"
#include "error.h"
#include "string.h"
* \param addr The address to delete.
* \param netmask The netmask of the entry to be removed from the list.
*/
-static void acl_del_entry(struct list_head *acl, char *addr, int netmask)
+static void acl_del_entry(struct list_head *acl, char *addr, unsigned netmask)
{
struct access_info *ai, *tmp;
+ struct in_addr to_delete;
+
+ inet_pton(AF_INET, addr, &to_delete);
list_for_each_entry_safe(ai, tmp, acl, node) {
- if (!strcmp(addr, inet_ntoa(ai->addr)) &&
- ai->netmask == netmask) {
+
+ if (v4_addr_match(to_delete.s_addr, ai->addr.s_addr,
+ PARA_MIN(netmask, ai->netmask))) {
PARA_NOTICE_LOG("removing %s/%i from access list\n",
addr, ai->netmask);
list_del(&ai->node);