Fix an IPcheck registry bug for IPv4 clients and a crash bug in /silence.
authorMichael Poole <mdpoole@troilus.org>
Sat, 19 Feb 2005 03:09:44 +0000 (03:09 +0000)
committerMichael Poole <mdpoole@troilus.org>
Sat, 19 Feb 2005 03:09:44 +0000 (03:09 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1313 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/IPcheck.c
ircd/m_silence.c

index d5814aea7a0548bb6518570af987f658364394db..7cb6af267cd083f6a1e23da90619f99221086376 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2005-02-18  Michael Poole <mdpoole@troilus.org>
 
+       * 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 af94d8cc50ba4a8484fdc778ff65ccfb87cfa32c..7c0b6aab4f06fb0ef290c825311aebda16dd5644 100644 (file)
@@ -120,8 +120,8 @@ static struct IPRegistryEntry* ip_registry_find(const struct irc_in_addr *ip)
   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 1be8a4b25218ace34081980b53f2634833b6fdae..f8ee5c3f83a4ac6615a41bd9bb69e9a6bd51dc52 100644 (file)
@@ -118,11 +118,13 @@ forward_silences(struct Client *sptr, char *silences, struct Client *dest)
     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 @@ forward_silences(struct Client *sptr, char *silences, struct Client *dest)
       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;