From: Michael Poole Date: Sat, 19 Feb 2005 03:09:44 +0000 (+0000) Subject: Fix an IPcheck registry bug for IPv4 clients and a crash bug in /silence. X-Git-Url: http://git.pk910.de/?a=commitdiff_plain;h=211e6b6caa1a4289285ee9fad77ede7497cb8487;p=ircu2.10.12-pk.git Fix an IPcheck registry bug for IPv4 clients and a crash bug in /silence. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@1313 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- diff --git a/ChangeLog b/ChangeLog index d5814ae..7cb6af2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2005-02-18 Michael Poole + * 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. diff --git a/ircd/IPcheck.c b/ircd/IPcheck.c index af94d8c..7c0b6aa 100644 --- a/ircd/IPcheck.c +++ b/ircd/IPcheck.c @@ -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; diff --git a/ircd/m_silence.c b/ircd/m_silence.c index 1be8a4b..f8ee5c3 100644 --- a/ircd/m_silence.c +++ b/ircd/m_silence.c @@ -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;