IMAP COPY creates invalid index data with zlib and mail_log plugins enabled but zlib_save off

Robert L Mathews lists at tigertech.com
Mon Nov 2 20:12:38 UTC 2015


On 10/30/15 3:06 PM, Robert L Mathews wrote:

> I've noticed that maildir IMAP COPY commands can generate invalid
> dovecot.index entries when all seven of the following are true:

As a followup to my own post, I believe I've tracked this problem down
to this code at lines 119-124 of /src/plugins/zlib/zlib-plugin.c:

 /* don't uncompress input when we are reading a mail that we're just
    in the middle of saving, and we didn't do the compression ourself.
    in such situation we're probably checking if the user-given input
    looks compressed */
 if (_mail->saving && zuser->save_handler == NULL)
         return zmail->super.istream_opened(_mail, stream);

When these lines are removed, the problem no longer happens.

I'm guessing that an IMAP COPY with the seven circumstances I mentioned
matches "we are reading a mail that we're just in the middle of saving,
and we didn't do the compression ourself". But the mail apparently does
need decompressing in this situation.

It seems odd for the code to not simply decompress the mail in all
cases. But I'm not sure what other code relies on this check, so I have
no idea whether removing these lines might cause problems.

-- 
Robert L Mathews, Tiger Technologies, http://www.tigertech.net/


More information about the dovecot mailing list