Update of /cvsroot/mahogany/M/src/modules
In directory usw-pr-cvs1:/tmp/cvs-serv768/src/modules

Modified Files:
        Filters.cpp 
Log Message:
added a SPAM test for the suspicious "Received: " headers


Index: Filters.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/Filters.cpp,v
retrieving revision 1.127
retrieving revision 1.128
diff -b -u -2 -r1.127 -r1.128
--- Filters.cpp 4 Jul 2002 17:22:38 -0000       1.127
+++ Filters.cpp 8 Jul 2002 14:25:31 -0000       1.128
@@ -1988,4 +1988,17 @@
 }
 
+// check the value of Received headers and return true if we believe they
+// indicate that this is a spam
+static bool CheckReceivedHeaders(const String& value)
+{
+   // "Received: from unknown" is very suspicious
+   const char *pc = strstr(value, "from unknown");
+   if ( !pc )
+      return false;
+
+   // it should be in the beginning of the header line
+   return pc == value.c_str() || *(pc - 1) == '\n';
+}
+
 // check if we have an HTML-only message
 static bool CheckForHTMLOnly(const Message *msg)
@@ -2101,4 +2114,9 @@
          rc = msg->GetHeaderLine("X-Authentication-Warning", value) &&
                   CheckXAuthWarning(value);
+      }
+      else if ( test == SPAM_TEST_RECEIVED )
+      {
+         rc = msg->GetHeaderLine("Received", value) &&
+                  CheckReceivedHeaders(value);
       }
       else if ( test == SPAM_TEST_HTML )



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Oh, it's good to be a geek.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to