]> 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)
committerGitLab <gitlab@git.dovecot.net>
Thu, 11 Aug 2016 09:30:27 +0000 (12:30 +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 cbec924cff2b51bd20d2a8595f27a1be77b4203d..9cac95c8984d74166ed2194d364f4152ead6c6e4 100644 (file)
@@ -1111,9 +1111,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;
        }