You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2010/10/29 12:44:02 UTC

svn commit: r1028679 - /james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java

Author: norman
Date: Fri Oct 29 10:44:02 2010
New Revision: 1028679

URL: http://svn.apache.org/viewvc?rev=1028679&view=rev
Log:
Ignore error on parsing received headers if reject=false is set (JAMES-795)

Modified:
    james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java

Modified: james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java
URL: http://svn.apache.org/viewvc/james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java?rev=1028679&r1=1028678&r2=1028679&view=diff
==============================================================================
--- james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java (original)
+++ james/server/trunk/fetchmail/src/main/java/org/apache/james/fetchmail/MessageProcessor.java Fri Oct 29 10:44:02 2010
@@ -624,20 +624,25 @@ public class MessageProcessor extends Pr
         recipients.add(recipient);
         MailImpl mail =
             new MailImpl(getServer().getId(), getSender(), recipients, message);
-        // Ensure the mail is created with non-null remote host name and address,
-        // otherwise the Mailet chain may go splat!
-        if (getRemoteAddress() == null || getRemoteHostName() == null)
-        {
-            mail.setRemoteAddr("127.0.0.1");
-            mail.setRemoteHost("localhost");
-            setDefaultRemoteAddress(true);          
-            logStatusInfo("Remote address could not be determined. Using localhost/127.0.0.1");             
-        }
-        else
-        {
+        
+
+        try {
             mail.setRemoteAddr(getRemoteAddress());
             mail.setRemoteHost(getRemoteHostName());
             setDefaultRemoteAddress(false);            
+        } catch (UnknownHostException e) {
+            // check if we should ignore this
+            // See: JAMES-795
+            if (isRejectRemoteReceivedHeaderInvalid() == false) {
+                // Ensure the mail is created with non-null remote host name and address,
+                // otherwise the Mailet chain may go splat!
+                mail.setRemoteAddr("127.0.0.1");
+                mail.setRemoteHost("localhost");
+                setDefaultRemoteAddress(true);          
+                logStatusInfo("Remote address could not be determined. Using localhost/127.0.0.1");          
+            } else {
+                throw e;
+            }
         }
 
         logMailCreation(mail);



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org