Update of /cvsroot/mahogany/M/src/modules
In directory usw-pr-cvs1:/tmp/cvs-serv2546/src/modules
Modified Files:
Filters.cpp
Log Message:
fixed X-Auth-Warning test and added an HTML spam test
Index: Filters.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/Filters.cpp,v
retrieving revision 1.117
retrieving revision 1.118
diff -b -u -2 -r1.117 -r1.118
--- Filters.cpp 26 Jun 2002 18:02:52 -0000 1.117
+++ Filters.cpp 27 Jun 2002 11:17:18 -0000 1.118
@@ -1867,12 +1867,12 @@
// func_isspam() helper: check the given MIME part and all of its children
// for Korean charset, return true if any of them has it
-static bool CheckMimePartForKoreanCSet(const MimePart *mimePart)
+static bool CheckMimePartForKoreanCSet(const MimePart *part)
{
- while ( mimePart )
+ while ( part )
{
- if ( CheckMimePartForKoreanCSet(mimePart->GetNested()) )
+ if ( CheckMimePartForKoreanCSet(part->GetNested()) )
return true;
- String cset = mimePart->GetParam("charset").Lower();
+ String cset = part->GetParam("charset").Lower();
if ( cset == "ks_c_5601-1987" || cset == "euc-kr" )
{
@@ -1880,5 +1880,5 @@
}
- mimePart = mimePart->GetNext();
+ part = part->GetNext();
}
@@ -1886,4 +1886,16 @@
}
+// another func_isspam() helper: check the value of X-Authentication-Warning
+// header and return true if we believe it indicates that this is a spam
+static bool CheckXAuthWarning(const String& value)
+{
+ // check for "^.*Host.+claimed to be.+$" regex manually
+ const char *pc = strstr(value, "Host");
+ if ( !pc )
+ return false;
+
+ return strstr(pc + 1, "claimed to be") != NULL;
+}
+
static Value func_isspam(ArgList *args, FilterRuleImpl *p)
{
@@ -1963,5 +1975,12 @@
// only spammers change their address in such way
rc = msg->GetHeaderLine("X-Authentication-Warning", value) &&
- value.Matches("Host * claimed to be *");
+ CheckXAuthWarning(value);
+ }
+ else if ( test == "html" )
+ {
+ // we accept the multipart/alternative messages with a text/plain and
+ // a text/html part but not the top level text/html messages
+ const MimePart *part = msg->GetTopMimePart();
+ rc = part && part->GetType().GetFull() == "TEXT/HTML";
}
#ifdef USE_RBL
@@ -2010,4 +2029,6 @@
}
#endif // USE_RBL
+ //else: simply ignore unknown tests, don't complain as it would be
+ // too annoying probably
}
-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates