Skip to content

Commit

Permalink
lib-storage: Fix mailbox delete to not delete childrens' INDEX or CON…
Browse files Browse the repository at this point in the history
…TROL dirs

If mail_location had separate INDEX and/or CONTROL set, deleting a mailbox
with children caused the childrens' index and/or control directories to be
deleted (but the mail/ALT directories weren't).

I'm not sure why the _FLAG_MAILBOX_FILES was treated as a special case
earlier. It shouldn't make a difference.
  • Loading branch information
sirainen committed Jun 30, 2017
1 parent d851acd commit 0784c6f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib-storage/list/mailbox-list-delete.c
Expand Up @@ -296,8 +296,10 @@ static int mailbox_list_try_delete(struct mailbox_list *list, const char *name,
strcmp(path, mailbox_path) == 0)
return 0;

if (*list->set.maildir_name == '\0' &&
(list->flags & MAILBOX_LIST_FLAG_MAILBOX_FILES) == 0) {
/* Note that only ALT currently uses maildir_name in paths.
INDEX and CONTROL don't. */
if (type != MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX ||
*list->set.maildir_name == '\0') {
/* this directory may contain also child mailboxes' data.
we don't want to delete that. */
bool rmdir_path = *list->set.maildir_name != '\0';
Expand Down

0 comments on commit 0784c6f

Please sign in to comment.