dovecot: Don't use subscriptions with hidden namespaces.
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jun 28 01:52:04 EEST 2007
details: http://hg.dovecot.org/dovecot/rev/86282604e2f5
changeset: 5818:86282604e2f5
user: Timo Sirainen <tss at iki.fi>
date: Thu Jun 28 00:04:31 2007 +0300
description:
Don't use subscriptions with hidden namespaces.
diffstat:
2 files changed, 19 insertions(+), 12 deletions(-)
src/imap/cmd-list.c | 6 ++++++
src/imap/cmd-subscribe.c | 25 +++++++++++++------------
diffs (63 lines):
diff -r 9f2a94a226f4 -r 86282604e2f5 src/imap/cmd-list.c
--- 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
@@ -459,6 +459,12 @@ static void list_namespace_init(struct c
cur_ns_prefix = ns->prefix;
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;
diff -r 9f2a94a226f4 -r 86282604e2f5 src/imap/cmd-subscribe.c
--- 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 @@ bool _cmd_subscribe_full(struct client_c
return FALSE;
verify_name = mailbox;
+ 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 ((client_workarounds & WORKAROUND_TB_EXTRA_MAILBOX_SEP) != 0 &&
- *mailbox != '\0') {
+ *mailbox != '\0' && mailbox[strlen(mailbox)-1] ==
+ mail_storage_get_hierarchy_sep(storage)) {
/* verify the validity without the trailing '/' */
- storage = client_find_storage(cmd, &mailbox);
- if (storage == NULL)
- return TRUE;
-
- 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;
+ verify_name = t_strndup(mailbox, strlen(mailbox)-1);
}
if (!client_verify_mailbox_name(cmd, verify_name, subscribe, FALSE))
More information about the dovecot-cvs
mailing list