]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Make sure mailbox autocreation doesn't get into infinite loop
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 18 Nov 2017 21:10:47 +0000 (23:10 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 20 Nov 2017 12:30:00 +0000 (14:30 +0200)
If mailbox_create() -> mailbox_open() fails with MAIL_ERROR_NOTFOUND, it
would have looped back to mailbox_create() and continued this until
running out of stack.

src/lib-storage/mail-storage.c

index f7dc7745e2e0ec4090e1db26397577c09489f852..880a16814b7e7facf48dd2208ba2330bbd5489cb 100644 (file)
@@ -1255,7 +1255,7 @@ mailbox_open_full(struct mailbox *box, struct istream *input)
        } T_END;
 
        if (ret < 0 && box->storage->error == MAIL_ERROR_NOTFOUND &&
-           !box->deleting &&
+           !box->deleting && !box->creating &&
            box->input == NULL && mailbox_is_autocreated(box)) T_BEGIN {
                ret = mailbox_autocreate_and_reopen(box);
        } T_END;