Double Carriage return breaks header ..

John Fawcett johnml at
Sat May 28 10:03:57 EDT 2005

John Fawcett wrote:
> Ken Murchison wrote:
>>lists-cyrus at wrote:
>>>Hello list,
>>>We're currently running Cyrus IMAP 2.2.8 and having the following
>>>When a message arrives via LMTP with the header "Subject:
>>>SUBJECTLINE\r\r\n" the message i broken and all other header-lines after
>>>this line are put in the body! This is not cute at all ..
>>>I suppose this "conversion" happens in spool_copy_msg()?
>>Cyrus isn't converting anything.  What you're seeing is GIGO (garbage
>>in, garbage out).  The message is broken per RFC 2822.  You should
>>complain about the software that generated this message.
> cyrus will convert bare \r to \r\n. So the above sequence would
> become \r\n\r\n. This is the sequence (ie a blank line) which
> indicates the end of the header section, so this would explain
> precisely the behavious that is being seen.
> What alternative behaviour would be correct? I suspect that it would
> be better to remove \r instead of adding an extra \n as currently
> happens. An alternative would be to reject malformed messages
> instead of attepting to fix the message and getting it wrong.
> Anyone know of a good reason why cyrus converts bare \r to \r\n?
> John

Following up to my own post: I just took another look at the
code. Cyrus doesn't convert bare \r to \r\n as I suggested,
but bare \n to \r\n.

Instead bare \r are just dropped. so that doesn't explain at
all what was being seen. I don't think the above issue results
from these conversions in spool_copy_msg().


>>>The message pass through Exim, Amavis and SpamAssassin without any
>>>problem before it's reaching Cyrus.
>>>Somebody have an idea how to correct this properly?
>>If you want to build more intelligence into Cyrus' message parsing, we'd
>>be glad to look at a patch, but we're not going to expend a lot of
>>energy trying to "fix" broken messages.
> ---
> Cyrus Home Page:
> Cyrus Wiki/FAQ:
> List Archives/Info:

Cyrus Home Page:
Cyrus Wiki/FAQ:
List Archives/Info:

More information about the Info-cyrus mailing list