sbrewin 2004/02/15 06:37:09
Modified: src/xdocs fetchmail_configuration_2_2.xml
src/java/org/apache/james/fetchmail MessageProcessor.java
Log:
Ensure mail is always created with a remote address and remote hostname.
See http://nagoya.apache.org/jira/secure/ViewIssue.jspa?key=JAMES-152
Revision Changes Path
1.4 +2 -1 james-server/src/xdocs/fetchmail_configuration_2_2.xml
Index: fetchmail_configuration_2_2.xml
===================================================================
RCS file: /home/cvs/james-server/src/xdocs/fetchmail_configuration_2_2.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- fetchmail_configuration_2_2.xml 13 Feb 2004 18:29:38 -0000 1.3
+++ fetchmail_configuration_2_2.xml 15 Feb 2004 14:37:09 -0000 1.4
@@ -506,7 +506,8 @@
will not be injected into the James input spool. If "false", mail whose
specified recieved header is invalid will be injected into the James input spool
with
the Mail Attribute <code>org.apache.james.fetchmail.isInvalidReceivedHeader</code>
-added to the mail.
+added to the mail, the remote address set to <code>127.0.0.1</code> and the remote
+host name set to <code>localhost</code>.
</dd>
<dt><strong>leaveonserver</strong></dt>
<dd>A boolean. If "true", mail whose specified recieved header is invalid
1.4 +13 -3
james-server/src/java/org/apache/james/fetchmail/MessageProcessor.java
Index: MessageProcessor.java
===================================================================
RCS file:
/home/cvs/james-server/src/java/org/apache/james/fetchmail/MessageProcessor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- MessageProcessor.java 13 Feb 2004 18:29:38 -0000 1.3
+++ MessageProcessor.java 15 Feb 2004 14:37:09 -0000 1.4
@@ -341,7 +341,7 @@
{
rejectRemoteReceivedHeaderInvalid();
return;
- }
+ }
// Create the mail
// If any of the mail addresses are malformed, we will get a
@@ -596,8 +596,18 @@
recipients.add(recipient);
MailImpl mail =
new MailImpl(getServer().getId(), getSender(), recipients, message);
- mail.setRemoteAddr(getRemoteAddress());
- mail.setRemoteHost(getRemoteHostName());
+ // 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");
+ }
+ else
+ {
+ mail.setRemoteAddr(getRemoteAddress());
+ mail.setRemoteHost(getRemoteHostName());
+ }
if (getLogger().isDebugEnabled())
{
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]