[Dovecot] >From escaping

Timo Sirainen tss at iki.fi
Tue Oct 5 17:55:27 EEST 2004


On 5.10.2004, at 17:29, Mark E. Mallett wrote:

>> Dovecot (and eg. mutt) uses Content-Length header to figure out how
>> large the message body is, so clients can't mess anything by sending
>> From-lines. Also Dovecot requires that From-line has correct syntax 
>> and
>> valid timestamp or it's not treated as From-line.
>
> Cool..  Just a little devil's advocation here:
>
> That's great as long as dovecot is the only one that will ever touch
> the mbox.

Right. Perhaps it should be optional. Although I'm not sure how hard I 
want Dovecot to try to be backwards compatible with all kinds of mbox 
software.

>   There are a lot of different "correct" formats of "From "
> lines, including some homegrown ones, and there are various code
> bases out there that recognize "From " separators in different ways.
> That's one reason that intelligent "From " quoting/recognition is
> not always better than being dumb about it (IMHO at least).  I favor
> being aware of the fact that you might be maintaining an mbox that
> has to be compatible with all manners of access.

I think Dovecot has pretty similiar From-line requirements than 
UW-IMAP, or at least I once did some changes to make sure it parsed all 
the same ones.

> As an aside, mutt uses content-length only if available, and
> calculates it if not (I would assume dovecot generates it always, if
> it's going to rely on it?).

I meant when Dovecot or mutt saves mails, it always adds the 
Content-Length header. When parsing mails without Content-Length, it's 
added only if doing so doesn't cause much extra disk I/O and if the 
message size is >= 1024 bytes (ie. when jumping over the message might 
actually reduce disk reads).

>   (and in fact mutt, up to 1.4.2.1 at
> least, is broken in the way it recognizes "From " lines if the
> content-length is missing: specifically, it would recognize "From " 
> lines
> even if not preceded by a blank line.. I patched it here.)

I don't think From-line has to be preceded by empty line? My 
understanding is that mbox works like:

 From ... LF
message text
LF

If message text doesn't end with LF, there's no empty line before 
From-line.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 186 bytes
Desc: This is a digitally signed message part
URL: <http://dovecot.org/pipermail/dovecot/attachments/20041005/b10fb24f/attachment-0001.bin>


More information about the dovecot mailing list