[Dovecot] Possible mbox corruption if mail is saved with wrong Content-Length header (2.1.6)

Jost Krieger Jost.Krieger+dovecot at rub.de
Mon Sep 3 17:11:21 EEST 2012


[Sorry about the personal reply.]

On Sun, Sep 02, 2012 at 05:28:28PM +0300, Timo Sirainen wrote:
> 
> On 31.8.2012, at 11.42, Jost Krieger wrote:
> 
> > One of our users likes to delete attachments from his mails. He is using
> > roundcube and we installed a plugin for that.
> 
> Does the plugin change the mbox file directly?

No, it just uses IMAP.
> 
> > imap(x1234567): Error: Cached message size larger than expected (6796 > 2844)
> 
> This looks like it does. Existing emails must not be changed, IMAP
> protocol forbids it (and Dovecot internals don't support it either).
> The only safe way to drop attachments is to assign a new UID for the
> mail, which basically means saving a new message without attachments
> and deleting the old one. The Content-Length header doesn't really
> have anything to do with this error.

Sorry if I was unclear. This is exactly what the plugin does. It builds
a new message, starting with the old message and leaving out the
unwanted attchment(s). Then it saves the new message, deletes the old
message and finally copies over the flags.

I had a look at the handling of "Content-Length" in dovecot and had the
impression that a new header was added but the old was not removed (if
formally ok) and on reading the first header wins. But I'm not sure, of
course.
 
Yours
Jost Krieger
-- 
| Jost.Krieger+sig at ruhr-uni-bochum.de  Please help stamp out spam! |
| Postmaster, JAPH, resident answer machine    at RUB Comp. Center |
| Sincere words are not sweet, sweet words are not sincere.        |
|                                          Lao Tse, Tao Te King 81 |



More information about the dovecot mailing list