# HG changeset patch # User Timo Sirainen # Date 1247875865 14400 # Node ID 16849c0931be52c4b58d0954b36d6324c387652c # Parent 3b285975bb1592c5ff81f3ae9374230ab8b3873a dsync: Handle missing mail GUIDs. diff -r 3b285975bb15 -r 16849c0931be src/dsync/dsync-brain.c --- a/src/dsync/dsync-brain.c Fri Jul 17 20:09:22 2009 -0400 +++ b/src/dsync/dsync-brain.c Fri Jul 17 20:11:05 2009 -0400 @@ -225,6 +225,8 @@ buffer_create_data(&guid_128_buf, dest, dest_len); mail_generate_guid_128_hash(guid, guid_128); + if (mail_guid_128_is_empty(guid_128)) + return ""; binary_to_hex_append(&guid_128_buf, guid_128, sizeof(guid_128)); buffer_append_c(&guid_128_buf, '\0'); return guid_128_buf.data; @@ -274,8 +276,12 @@ return 0; } - /* UIDs match, but do GUIDs? */ - if (strcmp(src_guid, dest_guid) != 0) { + /* UIDs match, but do GUIDs? If either of the GUIDs aren't set, it + means that either the storage doesn't support GUIDs or we're + handling an old-style expunge record. In that case just assume + they match. */ + if (strcmp(src_guid, dest_guid) != 0 && + *src_guid != '\0' && *dest_guid != '\0') { /* UID conflict. give new UIDs to messages in both src and dest (if they're not expunged already) */ sync->uid_conflict = TRUE; diff -r 3b285975bb15 -r 16849c0931be src/dsync/test-dsync-brain.c --- a/src/dsync/test-dsync-brain.c Fri Jul 17 20:09:22 2009 -0400 +++ b/src/dsync/test-dsync-brain.c Fri Jul 17 20:11:05 2009 -0400 @@ -96,6 +96,11 @@ memcpy(guid_128, sha1_sum, MAIL_GUID_128_SIZE); } +bool mail_guid_128_is_empty(const uint8_t guid_128[MAIL_GUID_128_SIZE] ATTR_UNUSED) +{ + return FALSE; +} + static bool mailbox_find(const char *name, unsigned int *idx_r) { unsigned int i;