1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-01 19:06:38 +02:00

- Spamfilter: regexes (and reasons) are now more limited in size, this is to combat "I set

a spamfilter, but cannot remove it" problems. In practice this means - depending on the
  length of your spamfilter reason - regexes will be max ~300 characters.
  Spamfilters set in the .conf can be slightly longer (which still causes them to be
  truncated in '/stats f', but they don't have to be removed anyway so it's kinda
  acceptable if it's really needed). This should fix bug #2083, reported by White_Magic.
This commit is contained in:
Bram Matthys
2005-08-28 16:28:40 +00:00
parent 82d4c429da
commit 0bc12e552c
2 changed files with 25 additions and 1 deletions
+6
View File
@@ -838,3 +838,9 @@
- Fixed crash with invalid set::network-name (eg: high ascii), reported by galahad
(#0002584), now printing an error instead (the network name is limited by the 005 spec).
- Added Bulgarian example.bg.conf, translated by Peace.
- Spamfilter: regexes (and reasons) are now more limited in size, this is to combat "I set
a spamfilter, but cannot remove it" problems. In practice this means - depending on the
length of your spamfilter reason - regexes will be max ~300 characters.
Spamfilters set in the .conf can be slightly longer (which still causes them to be
truncated in '/stats f', but they don't have to be removed anyway so it's kinda
acceptable if it's really needed). This should fix bug #2083, reported by White_Magic.
+19 -1
View File
@@ -690,7 +690,8 @@ char *tkllayer[11] = {
};
int targets = 0, action = 0;
char targetbuf[64], actionbuf[2];
char reason[512];
char reason[512];
int n;
if (IsServer(sptr))
return 0;
@@ -783,6 +784,23 @@ char reason[512];
tkllayer[9] = reason;
tkllayer[10] = parv[6];
/* SPAMFILTER LENGTH CHECK.
* We try to limit it here so '/stats f' output shows ok, output of that is:
* :servername 229 destname F <target> <action> <num> <num> <num> <reason> <setby> :<regex>
* : ^NICKLEN ^ NICKLEN ^check ^check ^check
* And for the other fields (and spacing/etc) we count on max 40 characters.
* We also do >500 instead of >510, since that looks cleaner ;).. so actually we count
* on 50 characters for the rest... -- Syzop
*/
n = strlen(reason) + strlen(parv[6]) + strlen(tkllayer[5]) + (NICKLEN * 2) + 40;
if (n > 500)
{
sendnotice(sptr, "Sorry, spamfilter too long. You'll either have to trim down the "
"reason or the regex (exceeded by %d bytes)", n - 500);
return 0;
}
if (whattodo == 0)
{