Mercurial > dovecot > core-2.2
changeset 9644:16849c0931be HEAD
dsync: Handle missing mail GUIDs.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 17 Jul 2009 20:11:05 -0400 |
parents | 3b285975bb15 |
children | ab31f0f00912 |
files | src/dsync/dsync-brain.c src/dsync/test-dsync-brain.c |
diffstat | 2 files changed, 13 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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;
--- 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;