From: Timo Sirainen Date: Mon, 5 Apr 2010 21:34:59 +0000 (+0300) Subject: mailbox_list_mailbox(): Don't show namespace prefix as selectable if it points to... X-Git-Tag: 2.0.beta5~194 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e22efc90e109ade2936eea0b062a99480310fd41;p=thirdparty%2Fdovecot%2Fcore.git mailbox_list_mailbox(): Don't show namespace prefix as selectable if it points to INBOX. --HG-- branch : HEAD --- 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);