From e22efc90e109ade2936eea0b062a99480310fd41 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 6 Apr 2010 00:34:59 +0300 Subject: [PATCH] mailbox_list_mailbox(): Don't show namespace prefix as selectable if it points to INBOX. --HG-- branch : HEAD --- src/lib-storage/mailbox-list.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib-storage/mailbox-list.c b/src/lib-storage/mailbox-list.c index cfe9eece5d..7a83531656 100644 --- a/src/lib-storage/mailbox-list.c +++ b/src/lib-storage/mailbox-list.c @@ -694,7 +694,7 @@ int mailbox_list_iter_deinit(struct mailbox_list_iterate_context **_ctx) 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 @@ int mailbox_list_mailbox(struct mailbox_list *list, const char *name, 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); -- 2.47.3