From 247e2ea6d529f1ef1a26659eabd605be8b3b01cd Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Fri, 19 Aug 2005 15:55:06 +0000 Subject: [PATCH] - Temporary workaround for spamfilter bug: action 'viruschan' in combination with the 'u' (user) target can cause severe problems (crashes, etc). For now, we have disabled 'viruschan' in combination with 'u'. A real fix will require quite some work, sorry. --- Changes | 3 +++ src/modules/m_tkl.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/Changes b/Changes index 6e2d5a018..ad5ddc208 100644 --- a/Changes +++ b/Changes @@ -832,3 +832,6 @@ causing close_connection to read from it (when deciding on doing a quick reconnect). Could have caused a crash, although nobody ever reported one... - Removed useless strncpyzt with dest==src. +- Temporary workaround for spamfilter bug: action 'viruschan' in combination with the + 'u' (user) target can cause severe problems (crashes, etc). For now, we have disabled + 'viruschan' in combination with 'u'. A real fix will require quite some work, sorry. diff --git a/src/modules/m_tkl.c b/src/modules/m_tkl.c index abb9191ca..383f62ba6 100644 --- a/src/modules/m_tkl.c +++ b/src/modules/m_tkl.c @@ -742,6 +742,17 @@ char reason[512]; } actionbuf[0] = banact_valtochar(action); actionbuf[1] = '\0'; + + /* (temporary?) disable 'u' (user) target in combination with 'viruschan' action -- else causes crashes + * SIDENOTE: This workaround is present at two places, 1) here, and 2) at the checking/banning code, + * why? well because there might be existing *lines! which is a very real assumption... + */ + if ((action == BAN_ACT_VIRUSCHAN) && (targets & SPAMF_USER)) + { + sendnotice(sptr, "Unfortunately, at least for the moment, the action 'viruschan' is incompatible with target 'u' (user) " + "for technical reasons. It caused crashes in previous versions, and has been (temporary?) disabled for now."); + return -1; + } /* now check the regex... */ p = unreal_checkregex(parv[6],0,1); @@ -2299,6 +2310,24 @@ char *str; if (IsVirus(sptr)) /* Already tagged */ return 0; + + if (!IsClient(sptr)) + { + /* Problem! viruschan selected, but we got a just connected user, + * this causes severe problems (atm). [this check is also present + * when adding the thing]. We just kill them instead for now... + * which seems the best alternative: adding shun/*lines is clearly + * not what the oper/service wanted, blocking/tempshunning does not + * give the user any hint about what is going in, and KILL is most + * obvious/clear, and less intrussive (you remove the spamfilter and + * the user can access the network again). -- Syzop + */ + sendto_realops("[WORKAROUND] Warning: spamfilter on target 'u' (user) + target 'viruschan' " + "is (temporary) no longer supported because it caused crashes, " + "user %s is killed instead!", sptr->name); + return place_host_ban(sptr, BAN_ACT_KILL, + unreal_decodespace(tk->ptr.spamf->tkl_reason), 0); + } ircsprintf(buf, "0,%s", SPAMFILTER_VIRUSCHAN); xparv[0] = sptr->name; xparv[1] = buf;