mail_crypt crashing randomly during LMTP

Timo Sirainen timo at sirainen.com
Tue Mar 31 13:47:58 EEST 2020


On 29. Mar 2020, at 17.07, Timo Sirainen <timo at sirainen.com> wrote:
> 
>> This is what the log says in the moment of crashing:
>> dovecot: lmtp(53852): Panic: Module context mail_crypt_user_module missing
>> *** backtrace *** (see: https://pastebin.com/YCiFtxmy)
> 
> It shows mailbox_free() in the backtrace, so it's probably crashing in mail_crypt_mailbox_close()'s MAIL_CRYPT_CONTEXT(box). But looking at the code, I can't see how that could be possible. Maybe there is some kind of memory corruption or something.


Looks like there's a bug when some users have mail_crypt plugin loaded and other users don't. If LMTP delivers a mail to both users within the same session, it crashes at deinit. A workaround could be to tell MTA to deliver to max recipient at a time. We'll get this fixed also to some future release. You could also apply a patch:

diff --git a/src/plugins/mail-crypt/mail-crypt-plugin.c b/src/plugins/mail-crypt/mail-crypt-plugin.c
index 43ece3d3b..a37fb4a35 100644
--- a/src/plugins/mail-crypt/mail-crypt-plugin.c
+++ b/src/plugins/mail-crypt/mail-crypt-plugin.c
@@ -345,7 +345,7 @@ static void mail_crypt_mailbox_close(struct mailbox *box)
 {
        struct mail_crypt_mailbox *mbox = MAIL_CRYPT_CONTEXT(box);
        struct mail_crypt_user *muser =
-               MAIL_CRYPT_USER_CONTEXT_REQUIRE(box->storage->user);
+               MAIL_CRYPT_USER_CONTEXT(box->storage->user);

        if (mbox->pub_key != NULL)
                dcrypt_key_unref_public(&mbox->pub_key);



More information about the dovecot mailing list