dovecot: When trying to use mbox file as the root directory, giv...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jun 14 05:31:12 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/94161a726c8b
changeset: 5739:94161a726c8b
user: Timo Sirainen <tss at iki.fi>
date: Thu Jun 14 05:31:04 2007 +0300
description:
When trying to use mbox file as the root directory, give a nice error.
diffstat:
1 file changed, 10 insertions(+), 2 deletions(-)
src/lib-storage/index/mbox/mbox-storage.c | 12 ++++++++++--
diffs (31 lines):
diff -r 9f2e5701105f -r 94161a726c8b src/lib-storage/index/mbox/mbox-storage.c
--- a/src/lib-storage/index/mbox/mbox-storage.c Thu Jun 14 05:06:35 2007 +0300
+++ b/src/lib-storage/index/mbox/mbox-storage.c Thu Jun 14 05:31:04 2007 +0300
@@ -446,17 +446,25 @@ static int mbox_create(struct mail_stora
static int verify_inbox(struct mail_storage *storage)
{
- const char *inbox_path;
+ const char *inbox_path, *rootdir;
int fd;
inbox_path = mailbox_list_get_path(storage->list, "INBOX",
MAILBOX_LIST_PATH_TYPE_MAILBOX);
+ rootdir = mailbox_list_get_path(storage->list, "",
+ MAILBOX_LIST_PATH_TYPE_DIR);
/* make sure inbox file itself exists */
fd = open(inbox_path, O_RDWR | O_CREAT | O_EXCL, 0660);
if (fd != -1)
(void)close(fd);
- else if (errno != EEXIST) {
+ else if (errno == ENOTDIR &&
+ strncmp(inbox_path, rootdir, strlen(rootdir)) == 0) {
+ mail_storage_set_critical(storage,
+ "mbox root directory can't be a file: %s "
+ "(http://wiki.dovecot.org/MailLocation/Mbox)",
+ rootdir);
+ } else if (errno != EEXIST) {
mail_storage_set_critical(storage,
"open(%s, O_CREAT) failed: %m", inbox_path);
}
More information about the dovecot-cvs
mailing list