dovecot: Don't auto-create INBOX if namespace doesn't have INBOX.

dovecot at dovecot.org dovecot at dovecot.org
Tue Jul 3 18:37:28 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/86f22b84e008
changeset: 5886:86f22b84e008
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Jul 03 18:34:31 2007 +0300
description:
Don't auto-create INBOX if namespace doesn't have INBOX.

diffstat:

1 file changed, 9 insertions(+), 4 deletions(-)
src/lib-storage/index/maildir/maildir-storage.c |   13 +++++++++----

diffs (41 lines):

diff -r f0685f6ec951 -r 86f22b84e008 src/lib-storage/index/maildir/maildir-storage.c
--- a/src/lib-storage/index/maildir/maildir-storage.c	Tue Jul 03 18:34:47 2007 +0300
+++ b/src/lib-storage/index/maildir/maildir-storage.c	Tue Jul 03 18:34:31 2007 +0300
@@ -285,7 +285,8 @@ maildir_create(struct mail_storage *_sto
 				    "tmp/", storage->temp_prefix, NULL);
 	}
 
-	(void)verify_inbox(_storage);
+	if ((_storage->ns->flags & NAMESPACE_FLAG_INBOX) != 0)
+		(void)verify_inbox(_storage);
 	return 0;
 }
 
@@ -507,7 +508,8 @@ maildir_mailbox_open(struct mail_storage
 		return NULL;
 	}
 
-	if (strcmp(name, "INBOX") == 0) {
+	if (strcmp(name, "INBOX") == 0 &&
+	    (_storage->ns->flags & NAMESPACE_FLAG_INBOX) != 0) {
 		if (verify_inbox(_storage) < 0)
 			return NULL;
 		return maildir_open(storage, "INBOX", flags);
@@ -956,12 +958,15 @@ maildirplusplus_iter_is_mailbox(struct m
 
 	/* Check files beginning with .nfs always because they may be
 	   temporary files created by the kernel */
-	if (storage->stat_dirs || strncmp(fname, ".nfs", 4) == 0) {
+	if (storage->stat_dirs || *fname == '\0' ||
+	    strncmp(fname, ".nfs", 4) == 0) {
 		const char *path;
 		struct stat st;
 
 		t_push();
-		path = t_strdup_printf("%s/%s", dir, fname);
+		/* if fname="", we're checking if a base maildir has INBOX */
+		path = *fname == '\0' ? t_strdup_printf("%s/cur", dir) :
+			t_strdup_printf("%s/%s", dir, fname);
 		if (stat(path, &st) == 0) {
 			if (S_ISDIR(st.st_mode))
 				ret = 1;


More information about the dovecot-cvs mailing list