dovecot-2.0: lib-storage: Don't access mail->box->view, but mail...

dovecot at dovecot.org dovecot at dovecot.org
Thu Mar 22 18:07:47 EET 2012


details:   http://hg.dovecot.org/dovecot-2.0/rev/a3002de95797
changeset: 13078:a3002de95797
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Mar 22 18:07:41 2012 +0200
description:
lib-storage: Don't access mail->box->view, but mail->transaction->view.
They may not be the same. In such cases e.g. mail_set_uid() may have
accessed a wrong mail.

diffstat:

 src/lib-storage/index/index-mail.c |  4 ++--
 src/plugins/virtual/virtual-mail.c |  8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (53 lines):

diff -r 2fb267a8077a -r a3002de95797 src/lib-storage/index/index-mail.c
--- a/src/lib-storage/index/index-mail.c	Wed Mar 21 13:43:56 2012 +0200
+++ b/src/lib-storage/index/index-mail.c	Thu Mar 22 18:07:41 2012 +0200
@@ -1332,7 +1332,7 @@
 
 		/* open the stream only if we didn't get here from
 		   mailbox_save_init() */
-		hdr = mail_index_get_header(_mail->box->view);
+		hdr = mail_index_get_header(_mail->transaction->view);
 		if (!_mail->saving && _mail->uid < hdr->next_uid)
 			(void)mail_get_stream(_mail, NULL, NULL, &input);
 	}
@@ -1343,7 +1343,7 @@
 	struct index_mail *mail = (struct index_mail *)_mail;
 	uint32_t seq;
 
-	if (mail_index_lookup_seq(_mail->box->view, uid, &seq)) {
+	if (mail_index_lookup_seq(_mail->transaction->view, uid, &seq)) {
 		index_mail_set_seq(_mail, seq);
 		return TRUE;
 	} else {
diff -r 2fb267a8077a -r a3002de95797 src/plugins/virtual/virtual-mail.c
--- a/src/plugins/virtual/virtual-mail.c	Wed Mar 21 13:43:56 2012 +0200
+++ b/src/plugins/virtual/virtual-mail.c	Thu Mar 22 18:07:41 2012 +0200
@@ -116,8 +116,8 @@
 	const void *data;
 	bool expunged;
 
-	mail_index_lookup_ext(mail->box->view, seq, mbox->virtual_ext_id,
-			      &data, &expunged);
+	mail_index_lookup_ext(mail->transaction->view, seq,
+			      mbox->virtual_ext_id, &data, &expunged);
 	vrec = data;
 
 	bbox = virtual_backend_box_lookup(mbox, vrec->mailbox_id);
@@ -130,7 +130,7 @@
 
 	vmail->imail.data.seq = seq;
 	mail->seq = seq;
-	mail_index_lookup_uid(mail->box->view, seq, &mail->uid);
+	mail_index_lookup_uid(mail->transaction->view, seq, &mail->uid);
 
 	if (!vmail->lost) {
 		mail->expunged = vmail->backend_mail->expunged;
@@ -147,7 +147,7 @@
 {
 	uint32_t seq;
 
-	if (!mail_index_lookup_seq(mail->box->view, uid, &seq))
+	if (!mail_index_lookup_seq(mail->transaction->view, uid, &seq))
 		return FALSE;
 
 	virtual_mail_set_seq(mail, seq);


More information about the dovecot-cvs mailing list