Re: LMTP bounces with invalid chars in MAIL FROM adress

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> Hi,
>>
>> I've seen a growing number of bounced mails from Cyrus LMTP where
>> Postfix
>> logs "501 5.5.4 Syntax error in parameters (in reply to MAIL FROM
>> command))"
>>
>> The problem is that those messages really have invalid from adresses,
>> like
>> "RosaSánchez@xxxxxxxxxxxxx", but Postfix still accepts them. Later,
>> Cyrus
>> runs parseaddr() on it ans correctly refuses to accept the mail.
>>
>> Now, I'm interested to hear how others handle this case, if possible how
>> they handle it with postfix. I know that enabling
>> strict_rfc821_envelopes
>> would possibly help but that seem to be a bad idea.
>
> I've searched the postfix-users list and as expected I'm not the only one
> to see this issue:
>
> http://marc.info/?l=postfix-users&m=120168533827364&w=2
>
> Since postfix (and I think also other MTA's) are a bit relaxed on what
> they accept as "MAIL FROM:" addresses, is there a very good reason for
> Cyrus to be so strict?

I've just added this

http://bugzilla.cyrusimap.org/bugzilla3/show_bug.cgi?id=3402

May I ask for a quick review of the attached patch? It works but I'm not
sure what it breaks :)

Thanks,
Simon
--- cyrus-imapd-2.4.6/imap/lmtpengine.c.orig	2010-12-20 14:15:49.000000000 +0100
+++ cyrus-imapd-2.4.6/imap/lmtpengine.c	2011-02-17 13:27:49.000000000 +0100
@@ -462,6 +462,7 @@
 {
     char *p, *ret;
     int len;
+    int munge8bit = config_getswitch(IMAPOPT_MUNGE8BIT);
 
     p = s;
 
@@ -500,6 +501,12 @@
 		if (!*++p) return 0;
 	    }
 	    else {
+		if (*p & 128 && munge8bit) {
+		    /* this prevents us from becoming a backscatter
+		       source because popular MTAs allow 8bit in
+		       local-part of adresses. */
+		    *p = 'X';
+		}
 		if (*p <= ' ' || (*p & 128) ||
 		    strchr("<>()[]\\,;:\"", *p)) return 0;
 	    }
----
Cyrus Home Page: http://www.cyrusimap.org/
List Archives/Info: http://lists.andrew.cmu.edu/pipermail/info-cyrus/

[Index of Archives]     [Cyrus SASL]     [Squirrel Mail]     [Asterisk PBX]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [KDE]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux