From 6577b9efbb380d7b033af025bb476042edd1aec7 Mon Sep 17 00:00:00 2001 From: Michael Poole Date: Tue, 9 Aug 2005 03:35:15 +0000 Subject: [PATCH] Fix the irregular IP ban bug harder. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1454 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 5 +++++ ircd/channel.c | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 96e23aa..ca22955 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-08-08 Michael Poole + + * ircd/channel.c (find_ban): For non-IPmask bans, match the ban + string against the string form of the client's IP address. + 2005-07-16 Michael Poole * configure.in: Apply a test for socklen_t that Reed found. diff --git a/ircd/channel.c b/ircd/channel.c index 51d1c25..7a99902 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -346,12 +346,15 @@ struct Ban *find_ban(struct Client *cptr, struct Ban *banlist) { char nu[NICKLEN + USERLEN + 2]; char tmphost[HOSTLEN + 1]; + char iphost[SOCKIPLEN + 1]; + char *hostmask; char *sr; struct Ban *found; /* Build nick!user and alternate host names. */ ircd_snprintf(0, nu, sizeof(nu), "%s!%s", cli_name(cptr), cli_user(cptr)->username); + ircd_ntoa_r(iphost, &cli_ip(cptr)); if (!IsAccount(cptr)) sr = NULL; else if (HasHiddenHost(cptr)) @@ -376,10 +379,12 @@ struct Ban *find_ban(struct Client *cptr, struct Ban *banlist) if (res) continue; /* Compare host portion of ban. */ - if (!((banlist->flags & BAN_IPMASK) - && ipmask_check(&cli_ip(cptr), &banlist->address, banlist->addrbits)) - && match(banlist->banstr + banlist->nu_len + 1, cli_user(cptr)->host) - && !(sr && match(banlist->banstr + banlist->nu_len + 1, sr) == 0)) + hostmask = banlist->banstr + banlist->nu_len + 1; + if (((banlist->flags & BAN_IPMASK) + ? !ipmask_check(&cli_ip(cptr), &banlist->address, banlist->addrbits) + : match(hostmask, iphost)) + && match(hostmask, cli_user(cptr)->host) + && !(sr && match(hostmask, sr) == 0)) continue; /* If an exception matches, no ban can match. */ if (banlist->flags & BAN_EXCEPTION) -- 2.20.1