From a2f99d3fb8c6557d0cfdf4d40fae751eb18a53ca Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 9 Nov 2010 21:12:35 +0000 Subject: [PATCH] dsync: Don't assert-crash if trying to convert mailbox whose name is too long. --- src/dsync/dsync-worker-local.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/dsync/dsync-worker-local.c b/src/dsync/dsync-worker-local.c index d422222934..801f0696bc 100644 --- a/src/dsync/dsync-worker-local.c +++ b/src/dsync/dsync-worker-local.c @@ -1101,6 +1101,14 @@ local_worker_convert_mailbox_name(struct local_dsync_worker *worker, /* probably some reserved name (e.g. dbox-Mails) */ name = t_strconcat("_", name, NULL); } + if (!mailbox_list_is_valid_create_name(ns->list, name)) { + /* name is too long? just give up and generate a + unique name */ + uint8_t guid[MAIL_GUID_128_SIZE]; + + mail_generate_guid_128(guid); + name = mail_guid_128_to_string(guid); + } i_assert(mailbox_list_is_valid_create_name(ns->list, name)); } return name; -- 2.47.3