Mercurial > dovecot > core-2.2
changeset 21533:eb9ee9ea67eb
LAYOUT=index: Fix duplicate mailbox name renaming to actually work
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 13 Feb 2017 20:02:24 +0200 |
parents | 0754351f9f75 |
children | 576ae10cd6cc |
files | src/lib-storage/list/mailbox-list-index.c |
diffstat | 1 files changed, 8 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/list/mailbox-list-index.c Mon Feb 13 20:01:13 2017 +0200 +++ b/src/lib-storage/list/mailbox-list-index.c Mon Feb 13 20:02:24 2017 +0200 @@ -235,13 +235,14 @@ static void mailbox_list_index_generate_name(struct mailbox_list_index *ilist, - struct mailbox_list_index_node *node) + struct mailbox_list_index_node *node, + const char *prefix) { guid_128_t guid; char *name; guid_128_generate(guid); - name = p_strdup_printf(ilist->mailbox_pool, "unknown-%s", + name = p_strdup_printf(ilist->mailbox_pool, "%s%s", prefix, guid_128_to_string(guid)); node->name = name; node->flags |= MAILBOX_LIST_INDEX_FLAG_CORRUPTED_NAME; @@ -324,7 +325,7 @@ if (ilist->has_backing_store) break; /* generate a new name and use it */ - mailbox_list_index_generate_name(ilist, node); + mailbox_list_index_generate_name(ilist, node, "unknown-"); } hash_table_insert(ilist->mailbox_hash, POINTER_CAST(node->uid), node); @@ -375,7 +376,6 @@ hash_table_insert(duplicate_hash, node, node); else { const char *old_name = node->name; - guid_128_t guid; if (ilist->has_backing_store) { *error_r = t_strdup_printf( @@ -386,11 +386,10 @@ /* we have only the mailbox list index and this node may have a different GUID, so rename it. */ - guid_128_generate(guid); - node->flags |= MAILBOX_LIST_INDEX_FLAG_CORRUPTED_NAME; - node->name = p_strdup_printf(ilist->mailbox_pool, - "%s-duplicate-%s", node->name, - guid_128_to_string(guid)); + node->corrupted_ext = TRUE; + node->name_id = ++ilist->highest_name_id; + mailbox_list_index_generate_name(ilist, node, + t_strconcat(node->name, "-duplicate-", NULL)); *error_r = t_strdup_printf( "Duplicate mailbox '%s' in index, renaming to %s", old_name, node->name);