]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
quota: Fixed handling when mail size lookup fails due to mail already being expunged.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 10 Aug 2016 16:13:09 +0000 (19:13 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 15 Aug 2016 13:14:43 +0000 (16:14 +0300)
We don't want to fail it as a quota allocation failure, but just pass
through the "mail is expunged" error to the original caller.

src/plugins/quota/quota.c

index 6288302f045c216f0205890635703f17ff962ab3..80bf60065dfa42f6011d9f87b5aa2746b1e7930c 100644 (file)
@@ -1110,9 +1110,16 @@ int quota_try_alloc(struct quota_transaction_context *ctx,
                return 1;
 
        if (mail_get_physical_size(mail, &size) < 0) {
+               enum mail_error error;
+               const char *errstr = mailbox_get_last_error(mail->box, &error);
+
+               if (error == MAIL_ERROR_EXPUNGED) {
+                       /* mail being copied was already expunged. it'll fail,
+                          so just return success for the quota allocated. */
+                       return 1;
+               }
                i_error("quota: Failed to get mail size (box=%s, uid=%u): %s",
-                       mail->box->vname, mail->uid,
-                       mailbox_get_last_error(mail->box, NULL));
+                       mail->box->vname, mail->uid, errstr);
                return -1;
        }