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

dovecot at dovecot.org dovecot at dovecot.org
Sun May 20 03:26:30 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/39db9e4c2283
changeset: 14373:39db9e4c2283
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Mar 22 17:44:51 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 |  6 +++---
 src/plugins/virtual/virtual-mail.c |  8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diffs (62 lines):

diff -r 3cb33e050dc4 -r 39db9e4c2283 src/lib-storage/index/index-mail.c
--- a/src/lib-storage/index/index-mail.c	Thu Mar 22 17:12:35 2012 +0200
+++ b/src/lib-storage/index/index-mail.c	Thu Mar 22 17:44:51 2012 +0200
@@ -442,7 +442,7 @@
 	if (set->mail_cache_min_mail_count > 0) {
 		/* First check if we've configured caching not to be used with
 		   low enough message count. */
-		hdr = mail_index_get_header(_mail->box->view);
+		hdr = mail_index_get_header(_mail->transaction->view);
 		if (hdr->messages_count < set->mail_cache_min_mail_count)
 			return;
 	}
@@ -1357,7 +1357,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) {
 			if ((data->access_part & READ_BODY) != 0)
 				(void)mail_get_stream(_mail, NULL, NULL, &input);
@@ -1453,7 +1453,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, FALSE);
 		return TRUE;
 	} else {
diff -r 3cb33e050dc4 -r 39db9e4c2283 src/plugins/virtual/virtual-mail.c
--- a/src/plugins/virtual/virtual-mail.c	Thu Mar 22 17:12:35 2012 +0200
+++ b/src/plugins/virtual/virtual-mail.c	Thu Mar 22 17:44:51 2012 +0200
@@ -117,8 +117,8 @@
 
 	i_assert(!saving);
 
-	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);
@@ -131,7 +131,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;
@@ -148,7 +148,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, FALSE);


More information about the dovecot-cvs mailing list