dovecot-2.0: quota: Fixed the quota limit check changes in previ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Apr 5 13:26:49 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/6cc356a5d0a5
changeset: 12715:6cc356a5d0a5
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Apr 05 13:26:45 2011 +0300
description:
quota: Fixed the quota limit check changes in previous commit.
Casting (uint64_t)-1 to (int64_t) isn't a good idea.

diffstat:

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

diffs (16 lines):

diff -r 230458801916 -r 6cc356a5d0a5 src/plugins/quota/quota.c
--- a/src/plugins/quota/quota.c	Mon Apr 04 23:19:01 2011 +0300
+++ b/src/plugins/quota/quota.c	Tue Apr 05 13:26:45 2011 +0300
@@ -1170,8 +1170,10 @@
 
 	*too_large_r = FALSE;
 
-	if (ctx->count_used + 1 <= (int64_t)ctx->count_ceil &&
-	    ctx->bytes_used + (off_t)size <= (int64_t)ctx->bytes_ceil)
+	if ((ctx->count_used < 0 ||
+	     (uint64_t)ctx->count_used + 1 <= ctx->count_ceil) &&
+	    ((ctx->bytes_used < 0 && size <= ctx->bytes_ceil) ||
+	     (uint64_t)ctx->bytes_used + size <= ctx->bytes_ceil))
 		return 1;
 
 	/* limit reached. only thing left to do now is to set too_large_r. */


More information about the dovecot-cvs mailing list