Mercurial > dovecot > original-hg > dovecot-1.2
changeset 5818:86282604e2f5 HEAD
Don't use subscriptions with hidden namespaces.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 28 Jun 2007 00:04:31 +0300 |
parents | 9f2a94a226f4 |
children | 4ea31bf18a56 |
files | src/imap/cmd-list.c src/imap/cmd-subscribe.c |
diffstat | 2 files changed, 20 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/imap/cmd-list.c Thu Jun 28 00:03:59 2007 +0300 +++ b/src/imap/cmd-list.c Thu Jun 28 00:04:31 2007 +0300 @@ -460,6 +460,12 @@ cur_ref = ctx->ref; cur_mask = ctx->mask; + if ((ctx->ns->flags & NAMESPACE_FLAG_HIDDEN) != 0 && + (ctx->list_flags & MAILBOX_LIST_ITER_SUBSCRIBED) != 0) { + /* ignore hidden namespaces */ + return; + } + ctx->cur_ns_skip_trailing_sep = FALSE; if ((ns->flags & NAMESPACE_FLAG_INBOX) != 0)
--- a/src/imap/cmd-subscribe.c Thu Jun 28 00:03:59 2007 +0300 +++ b/src/imap/cmd-subscribe.c Thu Jun 28 00:04:31 2007 +0300 @@ -2,9 +2,11 @@ #include "common.h" #include "commands.h" +#include "mail-namespace.h" bool _cmd_subscribe_full(struct client_command_context *cmd, bool subscribe) { + struct mail_namespace *ns; struct mail_storage *storage; struct mailbox_list *list; const char *mailbox, *verify_name; @@ -14,20 +16,19 @@ return FALSE; verify_name = mailbox; - if ((client_workarounds & WORKAROUND_TB_EXTRA_MAILBOX_SEP) != 0 && - *mailbox != '\0') { - /* verify the validity without the trailing '/' */ - storage = client_find_storage(cmd, &mailbox); - if (storage == NULL) - return TRUE; + ns = mail_namespace_find_visible(cmd->client->namespaces, &mailbox); + if (ns == NULL) { + client_send_tagline(cmd, "NO Unknown namespace."); + return TRUE; + } + storage = ns->storage; + verify_name += strlen(ns->prefix); - if (mailbox[strlen(mailbox)-1] == - mail_storage_get_hierarchy_sep(storage)) - verify_name = t_strndup(mailbox, strlen(mailbox)-1); - } else { - storage = client_find_storage(cmd, &mailbox); - if (storage == NULL) - return TRUE; + if ((client_workarounds & WORKAROUND_TB_EXTRA_MAILBOX_SEP) != 0 && + *mailbox != '\0' && mailbox[strlen(mailbox)-1] == + mail_storage_get_hierarchy_sep(storage)) { + /* verify the validity without the trailing '/' */ + verify_name = t_strndup(mailbox, strlen(mailbox)-1); } if (!client_verify_mailbox_name(cmd, verify_name, subscribe, FALSE))