dovecot-2.0: mailbox_list_mailbox(): Don't show namespace prefix...

dovecot at dovecot.org dovecot at dovecot.org
Tue Apr 6 00:35:02 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/944591ed8ceb
changeset: 11080:944591ed8ceb
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Apr 06 00:34:59 2010 +0300
description:
mailbox_list_mailbox(): Don't show namespace prefix as selectable if it points to INBOX.

diffstat:

 src/lib-storage/mailbox-list.c |  13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diffs (30 lines):

diff -r 2fbd31f90277 -r 944591ed8ceb src/lib-storage/mailbox-list.c
--- a/src/lib-storage/mailbox-list.c	Mon Apr 05 23:59:08 2010 +0300
+++ b/src/lib-storage/mailbox-list.c	Tue Apr 06 00:34:59 2010 +0300
@@ -694,7 +694,7 @@
 int mailbox_list_mailbox(struct mailbox_list *list, const char *name,
 			 enum mailbox_info_flags *flags_r)
 {
-	const char *path, *fname, *rootdir;
+	const char *path, *fname, *rootdir, *inbox;
 	struct stat st;
 	unsigned int len;
 
@@ -721,6 +721,17 @@
 		   b) looking up the root dir itself (as INBOX or "") */
 		fname = "";
 	}
+	if (*fname == '\0' && *name == '\0' &&
+	    (list->ns->flags & NAMESPACE_FLAG_INBOX) != 0) {
+		/* if INBOX is in e.g. ~/Maildir, it shouldn't be possible to
+		   access it also via namespace prefix. */
+		inbox = mailbox_list_get_path(list, "INBOX",
+					      MAILBOX_LIST_PATH_TYPE_MAILBOX);
+		if (strcmp(inbox, path) == 0) {
+			*flags_r |= MAILBOX_NONEXISTENT;
+			return 0;
+		}
+	}
 	return list->v.get_mailbox_flags(list, path, fname,
 					 MAILBOX_LIST_FILE_TYPE_UNKNOWN,
 					 &st, flags_r);


More information about the dovecot-cvs mailing list