From: Timo Sirainen Date: Sun, 22 Sep 2013 04:40:01 +0000 (+0300) Subject: maildir: Autocreate missing cur/ new/ tmp/ directories only with Maildir++ and imapdir. X-Git-Tag: 2.2.6~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=435a5772f577a6e080802bf1422deeb2bfe18baf;p=thirdparty%2Fdovecot%2Fcore.git maildir: Autocreate missing cur/ new/ tmp/ directories only with Maildir++ and imapdir. \Noselect mailboxes aren't possible with those layouts, but with other layouts they are and they shouldn't get automatically created just by selecting them. --- diff --git a/src/lib-storage/index/maildir/maildir-storage.c b/src/lib-storage/index/maildir/maildir-storage.c index bb15b696d0..518815cb51 100644 --- a/src/lib-storage/index/maildir/maildir-storage.c +++ b/src/lib-storage/index/maildir/maildir-storage.c @@ -351,7 +351,14 @@ static int maildir_mailbox_open(struct mailbox *box) if (ret < 0) return -1; - /* tmp/ directory doesn't exist. does the maildir? */ + /* tmp/ directory doesn't exist. does the maildir? autocreate missing + dirs only with Maildir++ and imapdir layouts. */ + if (strcmp(box->list->name, MAILBOX_LIST_NAME_MAILDIRPLUSPLUS) != 0 && + strcmp(box->list->name, MAILBOX_LIST_NAME_IMAPDIR) != 0) { + mail_storage_set_error(box->storage, MAIL_ERROR_NOTFOUND, + T_MAIL_ERR_MAILBOX_NOT_FOUND(box->vname)); + return -1; + } root_dir = mailbox_list_get_root_forced(box->list, MAILBOX_LIST_PATH_TYPE_MAILBOX); if (strcmp(box_path, root_dir) == 0) {