From: Timo Sirainen Date: Thu, 4 Nov 2010 18:56:47 +0000 (+0000) Subject: quota: Better fix to avoid counting quota for virtual mailboxes. X-Git-Tag: 2.0.7~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=40c24f8fe31037b61f2ac594a6dfcd123080b4b5;p=thirdparty%2Fdovecot%2Fcore.git quota: Better fix to avoid counting quota for virtual mailboxes. --- diff --git a/src/plugins/quota/quota-maildir.c b/src/plugins/quota/quota-maildir.c index 51f3f6eb77..89ddc365d3 100644 --- a/src/plugins/quota/quota-maildir.c +++ b/src/plugins/quota/quota-maildir.c @@ -636,9 +636,12 @@ static bool maildirquota_limits_init(struct maildir_quota_root *root) if (mailbox_list_get_storage(&list, &name, &storage) == 0 && strcmp(storage->name, MAILDIR_STORAGE_NAME) != 0) { /* non-maildir namespace, skip */ - i_warning("quota: Namespace '%s' is not Maildir, " - "skipping for Maildir++ quota", - root->maildirsize_ns->prefix); + if ((storage->class_flags & + MAIL_STORAGE_CLASS_FLAG_NOQUOTA) == 0) { + i_warning("quota: Namespace '%s' is not Maildir, " + "skipping for Maildir++ quota", + root->maildirsize_ns->prefix); + } root->maildirsize_path = NULL; return FALSE; } diff --git a/src/plugins/quota/quota-storage.c b/src/plugins/quota/quota-storage.c index 93324df0be..9aebd7ac5c 100644 --- a/src/plugins/quota/quota-storage.c +++ b/src/plugins/quota/quota-storage.c @@ -405,6 +405,9 @@ void quota_mailbox_allocated(struct mailbox *box) if (QUOTA_LIST_CONTEXT(box->list) == NULL) return; + if ((box->storage->class_flags & MAIL_STORAGE_CLASS_FLAG_NOQUOTA) != 0) + return; + qbox = p_new(box->pool, struct quota_mailbox, 1); qbox->module_ctx.super = *v; box->vlast = &qbox->module_ctx.super; @@ -514,8 +517,7 @@ void quota_mailbox_list_created(struct mailbox_list *list) if (root != NULL) root->ns = list->ns; - if ((list->ns->flags & NAMESPACE_FLAG_NOQUOTA) != 0 || - strncmp(list->ns->set->location, "virtual:", 8) == 0) /* FIXME: remove ugly workaround */ + if ((list->ns->flags & NAMESPACE_FLAG_NOQUOTA) != 0) add = FALSE; else if (list->ns->owner == NULL) { /* public namespace - add quota only if namespace is diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c index fbf85bc7ed..eb5d5c4496 100644 --- a/src/plugins/quota/quota.c +++ b/src/plugins/quota/quota.c @@ -760,6 +760,15 @@ quota_root_iter_init(struct mailbox *box) bool quota_root_is_namespace_visible(struct quota_root *root, struct mail_namespace *ns) { + struct mailbox_list *list = ns->list; + struct mail_storage *storage; + const char *name = ""; + + /* this check works as long as there is only one storage per list */ + if (mailbox_list_get_storage(&list, &name, &storage) == 0 && + (storage->class_flags & MAIL_STORAGE_CLASS_FLAG_NOQUOTA) != 0) + return FALSE; + if (root->ns != NULL) { if (root->ns != ns) return FALSE;