]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Virtual mailboxes: Don't use virtual mailbox_header_lookup_ctx in backend calls.
authorTimo Sirainen <tss@iki.fi>
Sat, 25 Oct 2008 19:51:40 +0000 (22:51 +0300)
committerTimo Sirainen <tss@iki.fi>
Sat, 25 Oct 2008 19:51:40 +0000 (22:51 +0300)
--HG--
branch : HEAD

src/lib-storage/index/index-mail-headers.c
src/plugins/virtual/virtual-mail.c

index 5c4aa96c729f2029d2b8fa52a58458995f240d19..0a5c0ba791cdc939036d5b94573cdda4716d14b7 100644 (file)
@@ -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)
index 551c82a094ff6ac4197ad88da4b8cb0bc78f6527..cb069274d3321acbcee5762b87c8908955c39507 100644 (file)
@@ -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