dovecot-2.2: quota: Quota count tracking still was still incorre...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jul 3 08:38:39 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/6fcf8199b079
changeset: 17569:6fcf8199b079
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Jul 03 11:37:07 2014 +0300
description:
quota: Quota count tracking still was still incorrect in over-quota conditions.

diffstat:

 src/plugins/quota/quota-util.c      |  6 +++---
 src/plugins/quota/test-quota-util.c |  4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diffs (32 lines):

diff -r d25443778208 -r 6fcf8199b079 src/plugins/quota/quota-util.c
--- a/src/plugins/quota/quota-util.c	Wed Jul 02 23:41:10 2014 +0300
+++ b/src/plugins/quota/quota-util.c	Thu Jul 03 11:37:07 2014 +0300
@@ -395,11 +395,11 @@
 		/* we've deleted some messages. we should be ok, unless we
 		   were already over quota and still are after these
 		   deletions. */
+		const uint64_t count_deleted = (uint64_t)-ctx->count_used;
+
 		if (ctx->count_over > 0) {
-			if (ctx->count_over > (uint64_t)-ctx->count_used + 1)
+			if (count_deleted - 1 < ctx->count_over)
 				return TRUE;
-		} else {
-			return TRUE;
 		}
 	} else {
 		if (ctx->count_ceil < 1 ||
diff -r d25443778208 -r 6fcf8199b079 src/plugins/quota/test-quota-util.c
--- a/src/plugins/quota/test-quota-util.c	Wed Jul 02 23:41:10 2014 +0300
+++ b/src/plugins/quota/test-quota-util.c	Thu Jul 03 11:37:07 2014 +0300
@@ -25,6 +25,10 @@
 		{ MAXU64,   MAXU64,        0,   1, TRUE },
 		{ MAXU64, MAXU64-1,        0,   1, FALSE },
 		{ MAXU64, MAXU64-1,        1,   1, TRUE },
+		{ MAXU64-1, MAXU64-1,      0,   1, TRUE },
+		{ MAXU64-1, MAXU64-1,     -1,   1, FALSE },
+		{ MAXU64-2, MAXU64-1,     -1,   1, TRUE },
+		{ MAXU64-2, MAXU64-1,     -2,   1, FALSE },
 
 		/* these are for bytes tests: */
 


More information about the dovecot-cvs mailing list