From: Timo Sirainen Date: Sat, 25 Oct 2008 19:51:40 +0000 (+0300) Subject: Virtual mailboxes: Don't use virtual mailbox_header_lookup_ctx in backend calls. X-Git-Tag: 1.2.alpha4~152 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c8d1ccf9dec39e9e145d55b472eee43d95764189;p=thirdparty%2Fdovecot%2Fcore.git Virtual mailboxes: Don't use virtual mailbox_header_lookup_ctx in backend calls. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/index-mail-headers.c b/src/lib-storage/index/index-mail-headers.c index 5c4aa96c72..0a5c0ba791 100644 --- a/src/lib-storage/index/index-mail-headers.c +++ b/src/lib-storage/index/index-mail-headers.c @@ -730,6 +730,8 @@ int index_mail_get_header_stream(struct mail *_mail, struct istream *input; string_t *dest; + i_assert(_headers->box == _mail->box); + if (mail->data.save_bodystructure_header) { /* we have to parse the header. */ if (index_mail_parse_headers(mail, _headers) < 0) diff --git a/src/plugins/virtual/virtual-mail.c b/src/plugins/virtual/virtual-mail.c index 551c82a094..cb069274d3 100644 --- a/src/plugins/virtual/virtual-mail.c +++ b/src/plugins/virtual/virtual-mail.c @@ -81,6 +81,7 @@ static void virtual_mail_set_seq(struct mail *mail, uint32_t seq) struct virtual_mailbox *mbox = (struct virtual_mailbox *)mail->box; struct virtual_backend_box *bbox; struct mailbox_transaction_context *backend_trans; + struct mailbox_header_lookup_ctx *backend_headers; const struct virtual_mail_index_record *vrec; const struct mail_index_record *rec; const void *data; @@ -95,9 +96,15 @@ static void virtual_mail_set_seq(struct mail *mail, uint32_t seq) if (vmail->backend_mail == NULL) { backend_trans = virtual_transaction_get(mail->transaction, bbox->box); + + backend_headers = vmail->wanted_headers == NULL ? NULL : + mailbox_header_lookup_init(bbox->box, + vmail->wanted_headers->headers); vmail->backend_mail = mail_alloc(backend_trans, vmail->wanted_fields, - vmail->wanted_headers); + backend_headers); + if (backend_headers != NULL) + mailbox_header_lookup_unref(&backend_headers); array_append(&vmail->backend_mails, &vmail->backend_mail, 1); } mail_set_uid(vmail->backend_mail, vrec->real_uid); @@ -205,8 +212,14 @@ virtual_mail_get_header_stream(struct mail *mail, struct istream **stream_r) { struct virtual_mail *vmail = (struct virtual_mail *)mail; - - return mail_get_header_stream(vmail->backend_mail, headers, stream_r); + struct mailbox_header_lookup_ctx *backend_headers; + int ret; + + backend_headers = mailbox_header_lookup_init(vmail->backend_mail->box, + headers->headers); + ret = mail_get_header_stream(vmail->backend_mail, headers, stream_r); + mailbox_header_lookup_unref(&backend_headers); + return ret; } static int