]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: Don't assert-crash if duplicate attributes are seen
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 18 Feb 2017 23:44:21 +0000 (01:44 +0200)
committerGitLab <gitlab@git.dovecot.net>
Sun, 19 Feb 2017 16:41:29 +0000 (18:41 +0200)
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

index a893b9854bc2268792a789a34b1037b0f2a9d08d..245f9056abe36ff2d45b7a22b7a3a92339d988ab 100644 (file)
@@ -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 &&