dovecot-2.2: quota: Ignore quota when handling mailbox_move().

dovecot at dovecot.org dovecot at dovecot.org
Wed Jun 20 06:22:14 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.2/rev/0a2126680120
changeset: 14615:0a2126680120
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Jun 20 06:17:40 2012 +0300
description:
quota: Ignore quota when handling mailbox_move().

diffstat:

 src/plugins/quota/quota-storage.c |  20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diffs (44 lines):

diff -r 544dc10d4b04 -r 0a2126680120 src/plugins/quota/quota-storage.c
--- a/src/plugins/quota/quota-storage.c	Wed Jun 20 06:17:00 2012 +0300
+++ b/src/plugins/quota/quota-storage.c	Wed Jun 20 06:17:40 2012 +0300
@@ -170,8 +170,17 @@
 	if (qbox->module_ctx.super.copy(ctx, mail) < 0)
 		return -1;
 
-	/* if copying used saving internally, we already checked the quota */
-	return ctx->copying_via_save ? 0 : quota_check(t, ctx->dest_mail);
+	if (ctx->copying_via_save) {
+		/* copying used saving internally, we already checked the
+		   quota */
+		return 0;
+	}
+	if (ctx->moving) {
+		/* the mail is being moved. the quota won't increase, so allow
+		   this even if user is currently over quota */
+		return 0;
+	}
+	return quota_check(t, ctx->dest_mail);
 }
 
 static int
@@ -183,7 +192,7 @@
 	uoff_t size;
 	int ret;
 
-	if (i_stream_get_size(input, TRUE, &size) > 0) {
+	if (i_stream_get_size(input, TRUE, &size) > 0 && !ctx->moving) {
 		/* Input size is known, check for quota immediately. This
 		   check isn't perfect, especially because input stream's
 		   linefeeds may contain CR+LFs while physical message would
@@ -227,6 +236,11 @@
 	if (qbox->module_ctx.super.save_finish(ctx) < 0)
 		return -1;
 
+	if (ctx->moving) {
+		/* the mail is being moved. the quota won't increase, so allow
+		   this even if user is currently over quota */
+		return 0;
+	}
 	return quota_check(ctx->transaction, ctx->dest_mail);
 }
 


More information about the dovecot-cvs mailing list