Allow both *!*@1.2.3.* and *!*@1.2.3.0/22 to be banned at the same time.
[ircu2.10.12-pk.git] / ircd / channel.c
index b97b89a1d57b110b777dbe3ede4169e12535070e..d7e3145845d957b00d56e02cf603871dd49d7822 100644 (file)
@@ -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