long lines in body causes "Message contains invalid header"

Maarten de Boer mdeboer at iua.upf.es
Thu May 27 05:38:51 EDT 2004


Hello,

This is my first message to the list. Let me start by saying that I am
a sysadmin who is very pleased with cyrus in general, as are the users.
Never had any real problems in years. Until now...:

I encountered the following problem with cyrdeliver. A user sent a mail
to another user on the same server. This mail never reached its
destination, neither did the sender receive a bounce.

(Note that I use cyrus 2.1.15, so I am not sure whether what I describe
below occurs with 2.1.16 as well, but it is really easy to test for
anyone running 2.1.16, with the perl script given)

Investigating the logs, I found that cyrdeliver caused a error: 

  "Message contains invalid header" 

Exim (I call cyrdeliver from exim) bounced the message to inform the
sender that the message could not be delivered, but when the bounced
message arrived at cyrdeliver, the same error occured.

The message contains an attachment with a very long line (an XML file
without linebreaks). It seems this triggered the cyrdeliver error. I
did some experiments on the command line, piping a message with a body
containing 1 very long line into cyrdeliver, and effectively, when this
line contains 8188 characters, cyrdeliver gives the error.

file test.pl
----------------------------------------
print "From: mdeboer at iua.upf.es\n\n";
for ($i=0;$i<8188;$i++) { print "."; }
print "\n";
----------------------------------------
$ perl test.pl | cyrdeliver mdeboer
mdeboer: Message contains invalid header

(if I replace 8188 with 8187, the mail is delivered correctly)

A quick glance at the code, reveales several buffers of size 8192, so
I suppose it is related with this. My questions are:

- Does this happen as well with 2.1.16? If it doesn't, we can happily
discard this mail, and I upgrade. This can be easily tested with the
script above.

- Should cyrdeliver be able to deliver messages with lines that long? It
is not something likely to happen in normal mail, but in this case, the
long line was in a Content-type: text/xml attachment, that looks totally
legal to me. (Is it? Or should the mail-client prevent this?)

- How come the error message talks about an "invalid header", when the
problem occurs in the body?

- What makes this problem a nasty one, is that the bounce was not
delivered, so effectively, we are dealing with a lost mail here. Exim
allows to limit the message size of bounced messages, which maybe I
could use to avoid the bounce not triggering the same cyrdeliver error,
but that seems like a kludge to me. Any other solution? Maybe I could
write a script that checks my exim log, and warns me when this (rare)
condition occurs...

Thank you for your time.

Maarten
---
Cyrus Home Page: http://asg.web.cmu.edu/cyrus
Cyrus Wiki/FAQ: http://cyruswiki.andrew.cmu.edu
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html




More information about the Info-cyrus mailing list