dovecot-2.2: trash plugin: Fixed handling unlimited quota limits.

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 29 08:29:29 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/2dbee58a1a0d
changeset: 18490:2dbee58a1a0d
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 29 10:22:26 2015 +0200
description:
trash plugin: Fixed handling unlimited quota limits.
Patch by Alexei Gradinari

diffstat:

 src/plugins/trash/trash-plugin.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (22 lines):

diff -r e00f9e93a9a3 -r 2dbee58a1a0d src/plugins/trash/trash-plugin.c
--- a/src/plugins/trash/trash-plugin.c	Wed Apr 29 10:13:19 2015 +0200
+++ b/src/plugins/trash/trash-plugin.c	Wed Apr 29 10:22:26 2015 +0200
@@ -204,8 +204,16 @@
 		ctx->count_over = 0;
 	}
 
-	ctx->bytes_ceil += size_expunged;
-	ctx->count_ceil += expunged_count;
+	if (ctx->bytes_ceil > ((uint64_t)-1 - size_expunged)) {
+		ctx->bytes_ceil = (uint64_t)-1;
+	} else {
+		ctx->bytes_ceil += size_expunged;
+	}
+	if (ctx->count_ceil < ((uint64_t)-1 - expunged_count)) {
+		ctx->count_ceil = (uint64_t)-1;
+	} else {
+		ctx->count_ceil += expunged_count;
+	}
 	return 1;
 }
 


More information about the dovecot-cvs mailing list