From: Timo Sirainen Date: Mon, 28 Sep 2015 13:20:02 +0000 (+0300) Subject: quota: Fixed "count" backend to ignore storages that have quota disabled. X-Git-Tag: 2.2.19.rc2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e99739b14df2035477ee58668b91a800dfee260;p=thirdparty%2Fdovecot%2Fcore.git quota: Fixed "count" backend to ignore storages that have quota disabled. For example virtual mailboxes shouldn't be counted in quota. --- diff --git a/src/plugins/quota/quota-count.c b/src/plugins/quota/quota-count.c index 34962f83fa..a7a402bddf 100644 --- a/src/plugins/quota/quota-count.c +++ b/src/plugins/quota/quota-count.c @@ -34,10 +34,12 @@ quota_count_mailbox(struct quota_root *root, struct mail_namespace *ns, } box = mailbox_alloc(ns->list, vname, MAILBOX_FLAG_READONLY); - if (mailbox_get_metadata(box, root->quota->set->vsizes ? - MAILBOX_METADATA_VIRTUAL_SIZE : - MAILBOX_METADATA_PHYSICAL_SIZE, - &metadata) < 0 || + if ((box->storage->class_flags & MAIL_STORAGE_CLASS_FLAG_NOQUOTA) != 0) { + /* quota doesn't exist for this mailbox/storage */ + } else if (mailbox_get_metadata(box, root->quota->set->vsizes ? + MAILBOX_METADATA_VIRTUAL_SIZE : + MAILBOX_METADATA_PHYSICAL_SIZE, + &metadata) < 0 || mailbox_get_status(box, STATUS_MESSAGES, &status) < 0) { errstr = mailbox_get_last_error(box, &error); if (error == MAIL_ERROR_TEMP) {