dovecot-2.2: sdbox: Fixed assert-crash when message with externa...

dovecot at dovecot.org dovecot at dovecot.org
Sun Dec 6 12:28:12 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/183576574417
changeset: 19463:183576574417
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Dec 06 14:27:46 2015 +0200
description:
sdbox: Fixed assert-crash when message with external attachments was copied between storages.

diffstat:

 src/lib-storage/index/dbox-single/sdbox-copy.c |  14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diffs (31 lines):

diff -r 93b0474fe9d6 -r 183576574417 src/lib-storage/index/dbox-single/sdbox-copy.c
--- a/src/lib-storage/index/dbox-single/sdbox-copy.c	Fri Dec 04 14:17:45 2015 +0200
+++ b/src/lib-storage/index/dbox-single/sdbox-copy.c	Sun Dec 06 14:27:46 2015 +0200
@@ -28,8 +28,12 @@
 	}
 	if (dest_storage->attachment_dir == NULL ||
 	    strcmp(src_storage->attachment_dir,
-		   dest_storage->attachment_dir) != 0) {
-		/* different attachment dirs between storages.
+		   dest_storage->attachment_dir) != 0 ||
+	    strcmp(src_storage->storage.set->mail_attachment_fs,
+		   dest_storage->storage.set->mail_attachment_fs) != 0 ||
+	    strcmp(src_storage->storage.set->mail_attachment_hash,
+		   dest_storage->storage.set->mail_attachment_hash) != 0) {
+		/* different attachment dirs/settings between storages.
 		   have to copy the slow way. */
 		return 0;
 	}
@@ -62,7 +66,11 @@
 					   guid_generate(), NULL);
 		dest = t_strdup_printf("%s/%s", dest_storage->attachment_dir,
 				       dest_relpath);
-		src_fsfile = fs_file_init(src_storage->attachment_fs, src,
+		/* we verified above that attachment_fs is compatible for
+		   src and dest, so it doesn't matter which storage's
+		   attachment_fs we use. in any case we need to use the same
+		   one or fs_copy() will crash with assert. */
+		src_fsfile = fs_file_init(dest_storage->attachment_fs, src,
 					  FS_OPEN_MODE_READONLY);
 		dest_fsfile = fs_file_init(dest_storage->attachment_fs, dest,
 					   FS_OPEN_MODE_READONLY);


More information about the dovecot-cvs mailing list