dovecot-2.0: quota: If user has unlimited quota, ignore any spec...

dovecot at dovecot.org dovecot at dovecot.org
Mon Nov 22 20:35:10 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/3a93121f652a
changeset: 12453:3a93121f652a
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Nov 22 18:35:07 2010 +0000
description:
quota: If user has unlimited quota, ignore any specific quota rules.

diffstat:

 src/plugins/quota/quota.c |  13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diffs (42 lines):

diff -r b724ef3bdc0a -r 3a93121f652a src/plugins/quota/quota.c
--- a/src/plugins/quota/quota.c	Mon Nov 22 18:21:25 2010 +0000
+++ b/src/plugins/quota/quota.c	Mon Nov 22 18:35:07 2010 +0000
@@ -588,7 +588,7 @@
 {
 	struct quota_rule *rule;
 	int64_t bytes_limit, count_limit;
-	bool found;
+	bool enabled;
 
 	if (!root->set->force_default_rule) {
 		if (root->backend.v.init_limits != NULL) {
@@ -600,11 +600,11 @@
 	bytes_limit = root->bytes_limit;
 	count_limit = root->count_limit;
 
-	/* if default rule limits are 0, this rule applies only to specific
-	   mailboxes */
-	found = bytes_limit != 0 || count_limit != 0;
+	/* if default rule limits are 0, user has unlimited quota.
+	   ignore any specific quota rules */
+	enabled = bytes_limit != 0 || count_limit != 0;
 
-	rule = quota_root_rule_find(root->set, mailbox_name);
+	rule = enabled ? quota_root_rule_find(root->set, mailbox_name) : NULL;
 	if (rule != NULL) {
 		if (!rule->ignore) {
 			bytes_limit += rule->bytes_limit;
@@ -613,12 +613,11 @@
 			bytes_limit = 0;
 			count_limit = 0;
 		}
-		found = TRUE;
 	}
 
 	*bytes_limit_r = bytes_limit <= 0 ? 0 : bytes_limit;
 	*count_limit_r = count_limit <= 0 ? 0 : count_limit;
-	return found ? 1 : 0;
+	return enabled ? 1 : 0;
 }
 
 void quota_add_user_namespace(struct quota *quota, struct mail_namespace *ns)


More information about the dovecot-cvs mailing list