31 |
|
#include "client.h" |
32 |
|
#include "common.h" |
33 |
|
#include "hash.h" |
34 |
+ |
#include "hostmask.h" |
35 |
|
#include "irc_string.h" |
36 |
|
#include "sprintf_irc.h" |
37 |
|
#include "ircd.h" |
617 |
|
|
618 |
|
DLINK_FOREACH(ptr, list->head) |
619 |
|
{ |
620 |
< |
const struct Ban *bp = ptr->data; |
620 |
> |
struct Ban *bp = ptr->data; |
621 |
|
|
622 |
< |
if (match(bp->name, who->name) && |
623 |
< |
match(bp->username, who->username) && |
624 |
< |
(match(bp->host, who->host) || |
625 |
< |
match(bp->host, who->sockhost) || |
626 |
< |
match_cidr(bp->host, who->sockhost))) |
627 |
< |
return 1; |
622 |
> |
if (match(bp->name, who->name) && match(bp->username, who->username)) |
623 |
> |
{ |
624 |
> |
switch (bp->type) |
625 |
> |
{ |
626 |
> |
case HM_HOST: |
627 |
> |
if (match(bp->host, who->host) || match(bp->host, who->sockhost)) |
628 |
> |
return 1; |
629 |
> |
break; |
630 |
> |
case HM_IPV4: |
631 |
> |
if (who->localClient->aftype == AF_INET) |
632 |
> |
if (match_ipv4(&who->localClient->ip, &bp->addr, bp->bits)) |
633 |
> |
return 1; |
634 |
> |
break; |
635 |
> |
#ifdef IPV6 |
636 |
> |
case HM_IPV6: |
637 |
> |
if (who->localClient->aftype == AF_INET6) |
638 |
> |
if (match_ipv6(&who->localClient->ip, &bp->addr, bp->bits)) |
639 |
> |
return 1; |
640 |
> |
break; |
641 |
> |
#endif |
642 |
> |
default: |
643 |
> |
assert(0); |
644 |
> |
} |
645 |
> |
} |
646 |
|
} |
647 |
|
|
648 |
|
return 0; |