--- dovecot-1.0.rc28/src/imap/cmd-list.c.orig 2007-08-07 09:27:16.000000000 -0400 +++ dovecot-1.0.rc28/src/imap/cmd-list.c 2007-08-07 09:24:59.000000000 -0400 @@ -7,6 +7,7 @@ #include "imap-match.h" #include "commands.h" #include "namespace.h" +#include enum { _MAILBOX_LIST_HIDE_CHILDREN = 0x1000000, @@ -326,6 +327,10 @@ string_t *str = t_str_new(128); flags = MAILBOX_PLACEHOLDER; + bool is_file; + char *p = mail_storage_get_mailbox_path( + ns->storage, "INBOX", &is_file); + if (access(p,F_OK) || !access(p,R_OK)) { str_printfa(str, "* LIST (%s) \"%s\" ", mailbox_flags2str(flags, ctx->list_flags), ns->sep_str); @@ -333,6 +338,7 @@ t_strndup(ns->prefix, len-1) : ns->prefix, FALSE); client_send_line(client, str_c(str)); + } } } --- dovecot-1.0.rc28/src/lib-storage/index/maildir/maildir-list.c.orig 2007-08-07 09:27:32.000000000 -0400 +++ dovecot-1.0.rc28/src/lib-storage/index/maildir/maildir-list.c 2007-08-07 09:25:26.000000000 -0400 @@ -62,7 +62,10 @@ dirp = opendir(ctx->dir); if (dirp == NULL) { - if (errno != ENOENT) { + if (errno == EACCES) { + ctx->mailbox_ctx.flags |= MAILBOX_HIDEYHACK; + return FALSE; + } else if (errno != ENOENT) { mail_storage_set_critical(ctx->mailbox_ctx.storage, "opendir(%s) failed: %m", ctx->dir); return FALSE; @@ -309,6 +312,7 @@ (ctx->mailbox_ctx.flags & MAILBOX_LIST_FAST_FLAGS) == 0) { bool update_only = (flags & MAILBOX_LIST_SUBSCRIBED) != 0; if (!maildir_fill_readdir(ctx, glob, update_only)) { + if (!(ctx->mailbox_ctx.flags & MAILBOX_HIDEYHACK)) ctx->mailbox_ctx.failed = TRUE; return &ctx->mailbox_ctx; } --- dovecot-1.0.rc28/src/lib-storage/index/maildir/maildir-storage.c.orig 2007-08-07 09:27:44.000000000 -0400 +++ dovecot-1.0.rc28/src/lib-storage/index/maildir/maildir-storage.c 2007-08-07 09:25:44.000000000 -0400 @@ -461,6 +461,10 @@ path = istorage->inbox_path != NULL ? istorage->inbox_path : istorage->dir; + if (!access(path,F_OK) && access(path,R_OK)) { + i_error("Permissions on %s?",path); + return 0; + } if (create_maildir(istorage, path, TRUE) < 0) return -1; --- dovecot-1.0.rc28/src/lib-storage/mail-storage.h.orig 2007-08-07 09:28:00.000000000 -0400 +++ dovecot-1.0.rc28/src/lib-storage/mail-storage.h 2007-08-07 09:26:19.000000000 -0400 @@ -78,7 +78,9 @@ MAILBOX_MARKED = 0x040, MAILBOX_UNMARKED = 0x080, - MAILBOX_READONLY = 0x100 + MAILBOX_READONLY = 0x100, + /* FIXME: Kludge for namespaces without permission */ + MAILBOX_HIDEYHACK = 0x200 }; enum mailbox_status_items {