Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-08-09 03:35:25 UTC

Modified files:
     ChangeLog ircd/channel.c

Log message:

Fix the irregular IP ban bug harder.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.668 ircu2.10/ChangeLog:1.669
--- ircu2.10/ChangeLog:1.668    Sat Jul 16 17:18:58 2005
+++ ircu2.10/ChangeLog  Mon Aug  8 20:35:14 2005
@@ -1,3 +1,8 @@
+2005-08-08  Michael Poole <[EMAIL PROTECTED]>
+
+       * 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 <[EMAIL PROTECTED]>
 
        * configure.in: Apply a test for socklen_t that Reed found.
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.137 ircu2.10/ircd/channel.c:1.138
--- ircu2.10/ircd/channel.c:1.137       Thu Jul 14 20:15:27 2005
+++ ircu2.10/ircd/channel.c     Mon Aug  8 20:35:15 2005
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Channel management and maintenance
- * @version $Id: channel.c,v 1.137 2005/07/15 03:15:27 entrope Exp $
+ * @version $Id: channel.c,v 1.138 2005/08/09 03:35:15 entrope Exp $
  */
 #include "config.h"
 
@@ -346,12 +346,15 @@
 {
   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))
@@ -376,10 +379,12 @@
     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)
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to