+2005-08-08 Michael Poole <mdpoole@troilus.org>
+
+ * 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 <mdpoole@troilus.org>
* configure.in: Apply a test for socklen_t that Reed found.
{
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))
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)