dovecot-2.2: lib-storage: mailbox_copy() didn't always copy all ...

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 18 17:48:52 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/61e567c7fdd7
changeset: 16297:61e567c7fdd7
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 18 17:48:38 2013 +0300
description:
lib-storage: mailbox_copy() didn't always copy all the cached fields to destination.
If the destination mailbox's cache file wasn't already opened, the default
cache decisions were used.

diffstat:

 src/lib-storage/index/index-storage.c |  9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r bafcb428167b -r 61e567c7fdd7 src/lib-storage/index/index-storage.c
--- a/src/lib-storage/index/index-storage.c	Wed Apr 17 18:47:36 2013 +0300
+++ b/src/lib-storage/index/index-storage.c	Thu Apr 18 17:48:38 2013 +0300
@@ -806,7 +806,7 @@
 			     struct mail *src_mail, uint32_t dest_seq)
 {
 	T_BEGIN {
-		struct mailbox_metadata src_metadata;
+		struct mailbox_metadata src_metadata, dest_metadata;
 		const struct mailbox_cache_field *field;
 		buffer_t *buf;
 
@@ -814,6 +814,13 @@
 					 MAILBOX_METADATA_CACHE_FIELDS,
 					 &src_metadata) < 0)
 			i_unreached();
+		/* the only reason we're doing the destination lookup is to
+		   make sure that the cache file is opened and the cache
+		   decisinos are up to date */
+		if (mailbox_get_metadata(ctx->transaction->box,
+					 MAILBOX_METADATA_CACHE_FIELDS,
+					 &dest_metadata) < 0)
+			i_unreached();
 
 		buf = buffer_create_dynamic(pool_datastack_create(), 1024);
 		array_foreach(src_metadata.cache_fields, field) {


More information about the dovecot-cvs mailing list