dovecot-2.2: maildir++ quota: Fixed relative quota_grace when ta...

dovecot at dovecot.org dovecot at dovecot.org
Thu Mar 28 11:37:16 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/426701831d00
changeset: 16126:426701831d00
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Mar 28 11:37:07 2013 +0200
description:
maildir++ quota: Fixed relative quota_grace when taking limit from maildirsize file

diffstat:

 src/plugins/quota/quota-private.h |   1 +
 src/plugins/quota/quota.c         |  15 ++++++++-------
 2 files changed, 9 insertions(+), 7 deletions(-)

diffs (56 lines):

diff -r 6d9444ea1c9a -r 426701831d00 src/plugins/quota/quota-private.h
--- a/src/plugins/quota/quota-private.h	Wed Mar 27 21:10:35 2013 +0200
+++ b/src/plugins/quota/quota-private.h	Thu Mar 28 11:37:07 2013 +0200
@@ -90,6 +90,7 @@
 	/* If user is under quota before saving a mail, allow the last mail to
 	   bring the user over quota by this many bytes. */
 	uint64_t last_mail_max_extra_bytes;
+	struct quota_rule grace_rule;
 
 	/* Limits in default_rule override backend's quota limits */
 	unsigned int force_default_rule:1;
diff -r 6d9444ea1c9a -r 426701831d00 src/plugins/quota/quota.c
--- a/src/plugins/quota/quota.c	Wed Mar 27 21:10:35 2013 +0200
+++ b/src/plugins/quota/quota.c	Thu Mar 28 11:37:07 2013 +0200
@@ -451,6 +451,9 @@
 		quota_rule_recalculate_relative_rules(&warning_rule->rule,
 						      bytes_limit, count_limit);
 	}
+	quota_rule_recalculate_relative_rules(&root_set->grace_rule,
+					      bytes_limit, 0);
+	root_set->last_mail_max_extra_bytes = root_set->grace_rule.bytes_limit;
 }
 
 static int
@@ -610,7 +613,6 @@
 {
 	const char *set_name, *value, *error;
 	char *p;
-	struct quota_rule rule;
 
 	set_name = t_strconcat(root_name, "_grace", NULL);
 	value = mail_user_plugin_getenv(user, set_name);
@@ -619,18 +621,17 @@
 		value = QUOTA_DEFAULT_GRACE;
 	}
 
-	memset(&rule, 0, sizeof(rule));
-	rule.bytes_limit = strtoll(value, &p, 10);
+	root_set->grace_rule.bytes_limit = strtoll(value, &p, 10);
 
-	if (quota_limit_parse(root_set, &rule, p, 1,
-			      &rule.bytes_limit, &error) < 0) {
+	if (quota_limit_parse(root_set, &root_set->grace_rule, p, 1,
+			      &root_set->grace_rule.bytes_limit, &error) < 0) {
 		*error_r = p_strdup_printf(root_set->set->pool,
 			"Invalid %s value '%s': %s", set_name, value, error);
 		return -1;
 	}
-	quota_rule_recalculate_relative_rules(&rule,
+	quota_rule_recalculate_relative_rules(&root_set->grace_rule,
 		root_set->default_rule.bytes_limit, 0);
-	root_set->last_mail_max_extra_bytes = rule.bytes_limit;
+	root_set->last_mail_max_extra_bytes = root_set->grace_rule.bytes_limit;
 	return 0;
 }
 


More information about the dovecot-cvs mailing list