changeset 21595:b6b3381b9660

dsync: Don't assert-crash if duplicate attributes are seen Just ignore the duplicates. Normally this shouldn't happen, but due to some bugs for example a Sieve script could be returned once by doveadm_sieve plugin and another time from mail_attribute_dict.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Sun, 19 Feb 2017 01:44:21 +0200
parents 359be6775382
children d99ff372361f
files src/doveadm/dsync/dsync-mailbox-export.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/doveadm/dsync/dsync-mailbox-export.c	Sun Feb 19 15:47:48 2017 +0200
+++ b/src/doveadm/dsync/dsync-mailbox-export.c	Sun Feb 19 01:44:21 2017 +0200
@@ -631,6 +631,12 @@
 			   skip for this sync. */
 			continue;
 		}
+		if (attr_change != NULL && attr_change->exported) {
+			/* duplicate attribute returned.
+			   shouldn't normally happen, but don't crash. */
+			i_warning("Ignoring duplicate attributes '%s'", key);
+			continue;
+		}
 
 		attr = &exporter->attr;
 		i_zero(attr);
@@ -639,7 +645,6 @@
 		attr->value_stream = value.value_stream;
 		attr->last_change = value.last_change;
 		if (attr_change != NULL) {
-			i_assert(!attr_change->exported);
 			attr_change->exported = TRUE;
 			attr->key = attr_change->key;
 			attr->deleted = attr_change->deleted &&