]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
maildir: Autocreate missing cur/ new/ tmp/ directories only with Maildir++ and imapdir.
authorTimo Sirainen <tss@iki.fi>
Sun, 22 Sep 2013 04:40:01 +0000 (07:40 +0300)
committerTimo Sirainen <tss@iki.fi>
Sun, 22 Sep 2013 04:40:01 +0000 (07:40 +0300)
\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.

src/lib-storage/index/maildir/maildir-storage.c

index bb15b696d01d5f8391721d004f7aca2e3fabb46a..518815cb5105cecc003e3828a429ce486afaa81f 100644 (file)
@@ -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) {