Committer  : entrope
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-02-19 03:09:56 UTC

Modified files:
     ircd/m_silence.c ircd/IPcheck.c ChangeLog

Log message:

Fix an IPcheck registry bug for IPv4 clients and a crash bug in /silence.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.549 ircu2.10/ChangeLog:1.550
--- ircu2.10/ChangeLog:1.549    Fri Feb 18 18:36:02 2005
+++ ircu2.10/ChangeLog  Fri Feb 18 19:09:44 2005
@@ -1,5 +1,11 @@
 2005-02-18  Michael Poole <[EMAIL PROTECTED]>
 
+       * ircd/IPcheck.c (ip_registry_find): Use canonical form of IP
+       address to look up and compare against hash entries.
+
+       * ircd/m_silence.c (forward_silences): When we reject a silence,
+       splice it out of the ban list.  Warn the user if he is local.
+
        * ircd/s_bsd.c (connect_inet): Set IP TOS for outbound server
        connections.
 
Index: ircu2.10/ircd/IPcheck.c
diff -u ircu2.10/ircd/IPcheck.c:1.35 ircu2.10/ircd/IPcheck.c:1.36
--- ircu2.10/ircd/IPcheck.c:1.35        Mon Jan  3 15:49:32 2005
+++ ircu2.10/ircd/IPcheck.c     Fri Feb 18 19:09:43 2005
@@ -18,7 +18,7 @@
  */
 /** @file
  * @brief Code to count users connected from particular IP addresses.
- * @version $Id: IPcheck.c,v 1.35 2005/01/03 23:49:32 entrope Exp $
+ * @version $Id: IPcheck.c,v 1.36 2005/02/19 03:09:43 entrope Exp $
  */
 #include "config.h"
 
@@ -120,8 +120,8 @@
   ip_registry_canonicalize(&canon, ip);
   entry = hashTable[ip_registry_hash(&canon)];
   for ( ; entry; entry = entry->next) {
-    int bits = (ip->in6_16[0] == ntohs(0x2002)) ? 48 : 64;
-    if (ipmask_check(ip, &entry->addr, bits))
+    int bits = (canon.in6_16[0] == htons(0x2002)) ? 48 : 64;
+    if (ipmask_check(&canon, &entry->addr, bits))
       break;
   }
   return entry;
Index: ircu2.10/ircd/m_silence.c
diff -u ircu2.10/ircd/m_silence.c:1.9 ircu2.10/ircd/m_silence.c:1.10
--- ircu2.10/ircd/m_silence.c:1.9       Fri Dec 17 20:41:07 2004
+++ ircu2.10/ircd/m_silence.c   Fri Feb 18 19:09:29 2005
@@ -22,7 +22,7 @@
  */
 /** @file
  * @brief Handlers for SILENCE command.
- * @version $Id: m_silence.c,v 1.9 2004/12/18 04:41:07 entrope Exp $
+ * @version $Id: m_silence.c,v 1.10 2005/02/19 03:09:29 entrope Exp $
  */
 
 #include "config.h"
@@ -118,11 +118,13 @@
     maxlength = maxsiles * feature_int(FEAT_AVBANLEN);
     siles = totlength = 0;
     /* Count number of current silences and their total length. */
+    plast = &cli_user(sptr)->silence;
     for (sile = cli_user(sptr)->silence; sile; sile = sile->next) {
       if (sile->flags & (BAN_OVERLAPPED | BAN_ADD | BAN_DEL))
         continue;
       siles++;
       totlength += strlen(sile->banstr);
+      plast = &sile->next;
     }
     for (ii = jj = 0; ii < ac_count; ++ii) {
       sile = accepted[ii];
@@ -132,12 +134,16 @@
       if (!(sile->flags & (BAN_OVERLAPPED | BAN_DEL))) {
         slen = strlen(sile->banstr);
         if ((siles >= maxsiles) || (totlength + slen >= maxlength)) {
+          *plast = NULL;
+          if (MyUser(sptr))
+            send_reply(sptr, ERR_SILELISTFULL, accepted[ii]->banstr);
           free_ban(accepted[ii]);
           continue;
         }
         /* Update counts. */
         siles++;
         totlength += slen;
+        plast = &sile->next;
       }
       /* Store the update. */
       accepted[jj++] = sile;
----------------------- End of diff -----------------------

Reply via email to