Alex Baule
2011-Jan-19 17:48 UTC
[Dovecot] Rewrite the mailbox copy functions works in imap but don't work in doveadm import command
Hi Timo !! I rewrite the copy function from mailbox (using a plugin) My rewrite is like this: static int emexis_antispam_copy(struct mail_save_context *ctx, struct mail *mail){ struct mailbox *box = ctx->transaction->box; union mailbox_module_context *zbox = EMEXIS_CONTEXT(box); struct mail_private *_mail = (struct mail_private *)mail; union mail_module_context *zmail = EMEXIS_MAIL_CONTEXT(_mail); struct istream *input; const char *headerFile; char *bodyFile; int fd; int increment; ......Do some stuffs and verifications OK.... // GETTING THE FILE TO READ SOME STUFF FROM HEADER. if (zmail->super.get_stream(mail, NULL, NULL, &input) >= 0){ i_warning("GET STREAM COPY OK..."); }else{ i_warning("GET STREAM COPY NOT OK..."); } // REALLY COPY EMAIL copyret = zbox->super.copy(ctx, mail); } OK, when i use the IMAP , using a client and copy a email, it's works fine. But, when i use a doveadm import command, the part "(zmail->super.get_stream(mail, NULL, NULL, &input) >= 0)" fails, with no error message, only a segfault.... doveadm[14980]: segfault at 9c ip b7698000 sp bf83d7d0 error 4 in libdovecot.so.0.0.0[b7663000+6d000] doveadm[14983]: segfault at 9c ip b7661000 sp bf9c9ee0 error 4 in libdovecot.so.0.0.0[b762c000+6d000] doveadm[14986]: segfault at 9c ip b75b3000 sp bfcd82e0 error 4 in libdovecot.so.0.0.0[b757e000+6d000] doveadm[14989]: segfault at 9c ip b7684000 sp bfa5d3c0 error 4 in libdovecot.so.0.0.0[b764f000+6d000] There is difference between imap using a client , and doveadm import command ? If have some difference, can i identify and do some workarround ? Tks Timo !!
Timo Sirainen
2011-Feb-22 08:47 UTC
[Dovecot] Rewrite the mailbox copy functions works in imap but don't work in doveadm import command
On Wed, 2011-01-19 at 15:48 -0200, Alex Baule wrote:> But, when i use a doveadm import command, the part > "(zmail->super.get_stream(mail, NULL, NULL, &input) >= 0)" fails, with no > error message, only a segfault....Use mail_get_stream() instead here, otherwise your plugin may break with other plugins. Also this is possibly related to a bug I just fixed: http://hg.dovecot.org/dovecot-2.0/rev/dc4e0320c087