[Dovecot] Rewrite the mailbox copy functions works in imap but don't work in doveadm import command

Alex Baule alexwbaule at gmail.com
Wed Jan 19 19:48:52 EET 2011


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 !!


More information about the dovecot mailing list