Fix bug in last commit to find_ban().
[ircu2.10.12-pk.git] / ircd / channel.c
index e1ea3bada13b16d934942606ad7756522a879740..d14e04f697aefbd9afead8553dec8e1251b4c22a 100644 (file)
@@ -380,16 +380,16 @@ struct Ban *find_ban(struct Client *cptr, struct Ban *banlist)
       continue;
     /* Compare host portion of ban. */
     hostmask = banlist->banstr + banlist->nu_len + 1;
-    if (((banlist->flags & BAN_IPMASK)
+    if (!((banlist->flags & BAN_IPMASK)
          && ipmask_check(&cli_ip(cptr), &banlist->address, banlist->addrbits))
-        || match(hostmask, cli_user(cptr)->host)
-        || (sr && match(hostmask, sr) == 0)) {
-      /* If an exception matches, no ban can match. */
-      if (banlist->flags & BAN_EXCEPTION)
-        return NULL;
-      /* Otherwise, remember this ban but keep searching for an exception. */
-      found = banlist;
-    }
+        && match(hostmask, cli_user(cptr)->host)
+        && !(sr && match(hostmask, sr)))
+        continue;
+    /* If an exception matches, no ban can match. */
+    if (banlist->flags & BAN_EXCEPTION)
+      return NULL;
+    /* Otherwise, remember this ban but keep searching for an exception. */
+    found = banlist;
   }
   return found;
 }