X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=acl.c;h=02df1e481e8f683a90d0c69a5ced3c40cf3f9e9c;hp=9bc83c2506f9083e577d8ff36d0c6953dd2d1285;hb=9b565c60fd159e12d255bb18db9dbff066deebea;hpb=0b36e0a77fc750af85e969efda7bda0931f389d0;ds=sidebyside diff --git a/acl.c b/acl.c index 9bc83c25..02df1e48 100644 --- a/acl.c +++ b/acl.c @@ -1,11 +1,13 @@ /* - * Copyright (C) 2005-2009 Andre Noll + * Copyright (C) 2005-2010 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ /** \file acl.c Access control lists for paraslash senders. */ +#include + #include "para.h" #include "error.h" #include "string.h" @@ -90,13 +92,17 @@ static void acl_add_entry(struct list_head *acl, char *addr, int netmask) * \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);