From: Michael Poole Date: Tue, 4 Apr 2006 23:09:48 +0000 (+0000) Subject: Allow both *!*@1.2.3.* and *!*@1.2.3.0/22 to be banned at the same time. X-Git-Url: http://git.pk910.de/?p=ircu2.10.12-pk.git;a=commitdiff_plain;h=0609fbdf9b84cdce18fccc77ff1deceb466fad74 Allow both *!*@1.2.3.* and *!*@1.2.3.0/22 to be banned at the same time. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1635 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index 826e98e..bf9d9b8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-04-03 Michael Poole + + * ircd/channel.c (bmatch): If ipmask_check() indicates old_ban is + a CIDR-wise superset of new_ban, check whether new_ban is a + text-wise superset of old_ban. + 2006-03-31 Michael Poole * tools/iauth-test (send_server_notice): Use a colon prefix before diff --git a/ircd/channel.c b/ircd/channel.c index b97b89a..d7e3145 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -2685,8 +2685,12 @@ bmatch(struct Ban *old_ban, struct Ban *new_ban) old_ban->banstr[old_ban->nu_len] = new_ban->banstr[new_ban->nu_len] = '@'; if (res) return res; - /* Compare the addresses. */ - return !ipmask_check(&new_ban->address, &old_ban->address, old_ban->addrbits); + /* If the old ban's mask mismatches, cannot be a superset. */ + if (!ipmask_check(&new_ban->address, &old_ban->address, old_ban->addrbits)) + return 1; + /* Otherwise it depends on whether the old ban's text is a superset + * of the new. */ + return mmatch(old_ban->banstr, new_ban->banstr); } /** Add a ban from a ban list and mark bans that should be removed