dovecot-1.2: acl: If a user's namespace has no mailboxes visible...
dovecot at dovecot.org
dovecot at dovecot.org
Wed Nov 19 18:57:48 EET 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/c56835b33b14
changeset: 8447:c56835b33b14
user: Timo Sirainen <tss at iki.fi>
date: Wed Nov 19 18:46:25 2008 +0200
description:
acl: If a user's namespace has no mailboxes visible to us, remove the namespace immediately.
diffstat:
1 file changed, 14 insertions(+)
src/plugins/acl/acl-shared-storage.c | 14 ++++++++++++++
diffs (31 lines):
diff -r 1c13cf0f8bb5 -r c56835b33b14 src/plugins/acl/acl-shared-storage.c
--- a/src/plugins/acl/acl-shared-storage.c Wed Nov 19 18:45:46 2008 +0200
+++ b/src/plugins/acl/acl-shared-storage.c Wed Nov 19 18:46:25 2008 +0200
@@ -25,6 +25,8 @@ acl_shared_namespace_add(struct mail_use
};
struct var_expand_table *tab;
struct mail_namespace *ns;
+ struct mailbox_list_iterate_context *iter;
+ const struct mailbox_info *info;
const char *p, *mailbox;
string_t *str;
@@ -45,6 +47,18 @@ acl_shared_namespace_add(struct mail_use
var_expand(str, sstorage->ns_prefix_pattern, tab);
mailbox = str_c(str);
shared_storage_get_namespace(&sstorage->storage, &mailbox, &ns);
+
+ /* check if there are any mailboxes really visible to us */
+ iter = mailbox_list_iter_init(ns->list, "*",
+ MAILBOX_LIST_ITER_RETURN_NO_FLAGS);
+ while ((info = mailbox_list_iter_next(iter)) != NULL)
+ break;
+ (void)mailbox_list_iter_deinit(&iter);
+
+ if (info == NULL) {
+ /* no visible mailboxes, remove the namespace */
+ mail_namespace_destroy(ns);
+ }
}
int acl_shared_namespaces_add(struct mail_namespace *ns)
More information about the dovecot-cvs
mailing list