From 2da176a0b105bc75a3289facb4b467e98bc04829 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 19 Feb 2017 01:44:21 +0200 Subject: [PATCH] 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. --- src/doveadm/dsync/dsync-mailbox-export.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/doveadm/dsync/dsync-mailbox-export.c b/src/doveadm/dsync/dsync-mailbox-export.c index a893b9854b..245f9056ab 100644 --- a/src/doveadm/dsync/dsync-mailbox-export.c +++ b/src/doveadm/dsync/dsync-mailbox-export.c @@ -631,6 +631,12 @@ dsync_mailbox_export_iter_next_attr(struct dsync_mailbox_exporter *exporter) 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 @@ dsync_mailbox_export_iter_next_attr(struct dsync_mailbox_exporter *exporter) 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 && -- 2.47.3