Check client hostnames against ban masks more rigorously.
authorMichael Poole <mdpoole@troilus.org>
Mon, 12 Sep 2005 20:36:24 +0000 (20:36 +0000)
committerMichael Poole <mdpoole@troilus.org>
Mon, 12 Sep 2005 20:36:24 +0000 (20:36 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1481 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/channel.c

index 50694df5a3fa4c8a615d22f03d250f3ce28b0499..f7f79535c4c307d264056b8bc8f85bc2d93a0439 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-09-12  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/channel.c (find_ban): Compare ban mask against hostname
+       even when it looks like an IP, to match things like *!*@1.* when
+       users have a hostname like 1.2.3.example.com.
+
 2005-09-12  Michael Poole <mdpoole@troilus.org>
 
        * RELEASE.NOTES: Note the resolution of ambiguous ipmasks.
index de609e727f5a0f99d36a3e81ea2c1afcd84b0b7b..e1ea3bada13b16d934942606ad7756522a879740 100644 (file)
@@ -381,16 +381,15 @@ struct Ban *find_ban(struct Client *cptr, struct Ban *banlist)
     /* Compare host portion of ban. */
     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)
-      return NULL;
-    /* Otherwise, remember this ban but keep searching for an exception. */
-    found = banlist;
+         && 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;
+    }
   }
   return found;
 }