Richard Platel
2013-Nov-27 21:17 UTC
[Dovecot] dovecot-antispam plugin problem with multiple messages
Hi With dovecot 2.2.5, and dovecot-antispam built from a recent HEAD pull, when copying multiple messages to or from a Spam folder, the plugin sends multiple copies of the first message to the backend. I've tried this with the pipe and spool2dir backends. For example with the spool2dir backend, via IMAP doing A COPY 1:3 Spam yields 3 copies of message id 1 in the dir: dev:imap-8.1 rplatel at imap01:/var/run/dovecot_as_tmp$ sudo -u mail md5sum * 28ad0a215eb7ecbd3a814a8a334d85bf 00000000001385586164-rplatel at ff-dev.com-00001s 28ad0a215eb7ecbd3a814a8a334d85bf 00000000001385586164-rplatel at ff-dev.com-00002s 28ad0a215eb7ecbd3a814a8a334d85bf 00000000001385586164-rplatel at ff-dev.com-00003s I see the same behaviour with the pipe backend, the pipe program is invoked 3 times, but with the same message content.
Richard Platel
2013-Nov-29 19:46 UTC
[Dovecot] dovecot-antispam plugin problem with multiple messages
This seems to fix the issue --- a/dovecot-antispam-plugin/src/antispam-storage-2.0.c +++ b/dovecot-antispam-plugin/src/antispam-storage-2.0.c @@ -91,15 +91,6 @@ antispam_copy(struct mail_save_context *ctx, struct mail *mai int ret; bool src_trash, dst_trash; - if (!ctx->dest_mail) { - /* always need mail */ - if (!ast->mail) - ast->mail = mail_alloc(t, MAIL_FETCH_STREAM_HEADER | - MAIL_FETCH_STREAM_BODY, - NULL); - ctx->dest_mail = ast->mail; - } - i_assert(mail->box); asbox->save_hack = FALSE; @@ -145,7 +136,7 @@ antispam_copy(struct mail_save_context *ctx, struct mail *ma else ret = asbox->cfg->backend->handle_mail( asbox->cfg, t, ast->backendctx, - ctx->dest_mail, + mail, move_to_class(asbox->movetype)); /* On Nov 27, 2013, at 4:17 PM, Richard Platel <rplatel at tucows.com> wrote:> Hi > > With dovecot 2.2.5, and dovecot-antispam built from a recent HEAD pull, when copying multiple messages to or from a Spam folder, the plugin sends multiple copies of the first message to the backend. I've tried this with the pipe and spool2dir backends. > > For example with the spool2dir backend, via IMAP doing > > A COPY 1:3 Spam > > yields 3 copies of message id 1 in the dir: > dev:imap-8.1 rplatel at imap01:/var/run/dovecot_as_tmp$ sudo -u mail md5sum * > 28ad0a215eb7ecbd3a814a8a334d85bf 00000000001385586164-rplatel at ff-dev.com-00001s > 28ad0a215eb7ecbd3a814a8a334d85bf 00000000001385586164-rplatel at ff-dev.com-00002s > 28ad0a215eb7ecbd3a814a8a334d85bf 00000000001385586164-rplatel at ff-dev.com-00003s > > I see the same behaviour with the pipe backend, the pipe program is invoked 3 times, but with the same message content. > >