Mercurial > dovecot > core-2.2
changeset 15800:004b69090776
dbox: Fail if trying to create a mailbox that already exists.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sat, 02 Feb 2013 00:31:44 +0200 |
parents | bf80034a547d |
children | 93633121bc9d |
files | src/lib-storage/index/dbox-common/dbox-storage.c |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/dbox-common/dbox-storage.c Thu Jan 31 18:27:22 2013 +0200 +++ b/src/lib-storage/index/dbox-common/dbox-storage.c Sat Feb 02 00:31:44 2013 +0200 @@ -254,6 +254,12 @@ if (mailbox_open(box) < 0) return -1; + if (mail_index_get_header(box->view)->uid_validity != 0) { + mail_storage_set_error(box->storage, MAIL_ERROR_EXISTS, + "Mailbox already exists"); + return -1; + } + /* if alt path already exists and contains files, rebuild storage so that we don't start overwriting files. */ alt_path = mailbox_list_get_path(box->list, box->name,