]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mailbox_list_mailbox(): Don't show namespace prefix as selectable if it points to...
authorTimo Sirainen <tss@iki.fi>
Mon, 5 Apr 2010 21:34:59 +0000 (00:34 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 5 Apr 2010 21:34:59 +0000 (00:34 +0300)
--HG--
branch : HEAD

src/lib-storage/mailbox-list.c

index cfe9eece5d409cbadeed173a6131fe590e5e8cbc..7a83531656494110b5db3a13e4a73976e85017be 100644 (file)
@@ -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);