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

Modified Files:
        Filters.cpp 
Log Message:
excluded another benign X-Auth-Warning from consideration

Index: Filters.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/modules/Filters.cpp,v
retrieving revision 1.128
retrieving revision 1.129
diff -b -u -2 -r1.128 -r1.129
--- Filters.cpp 8 Jul 2002 14:25:31 -0000       1.128
+++ Filters.cpp 7 Sep 2002 00:05:58 -0000       1.129
@@ -1962,8 +1962,12 @@
       return false;
 
-   // there seems to be a common mosconfiguration problem with some LANs which
-   // results in values of X-Authentication-Warning header like
+   // there seems to be a few common misconfiguration problems which
+   // result in generation of X-Authentication-Warning headers like this
    //
-   //    smtpserver.domain.com: Host host.domain.com [ip] claimed to be host
+   //    Host host.domain.com [ip] claimed to be host
+   //
+   // or like that:
+   //
+   //    Host alias.domain.com [ip] claimed to be mail.domain.com
    //
    // which are, of course, harmless, i.e. don't mean that this is spam, so we
@@ -1974,16 +1978,48 @@
    pc2 += strlen(CLAIMED_STRING);
 
-   // check if they're equal
-   while ( *pc != '.' && *pc2 != '\r' )
+   // check if the host names are equal (case 1 above)
+   const char *host1 = pc,
+              *host2 = pc2;
+
+   bool hostsEqual = true;
+   while ( *host1 != '.' && *host2 != '\r' )
    {
-      if ( *pc++ != *pc2++ )
+      if ( *host1++ != *host2++ )
       {
-         // hosts don't match, so it's a serious warning
-         return true;
+         // hosts don't match
+         hostsEqual = false;
+
+         break;
       }
    }
 
    // did the host names match?
-   return *pc == '.' && *pc2 == '\r';
+   if ( hostsEqual && *host1 == '.' && *host2 == '\r' )
+   {
+      // they did, ignore this warning
+      return false;
+   }
+
+   // check if the domains match
+   const char *domain1 = strchr(pc, '.'),
+              *domain2 = strchr(pc2, '.');
+
+   if ( !domain1 || !domain2 )
+   {
+      // no domain at all -- this looks suspicious
+      return true;
+   }
+
+   while ( *domain1 != ' ' && *domain2 != '\r' )
+   {
+      if ( *domain1++ != *domain2++ )
+      {
+         // domain differ as well, seems like a valid warning
+         return true;
+      }
+   }
+
+   // did the domains match fully?
+   return *domain1 == ' ' && *domain2 == '\r';
 }
 



-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone?  Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to