dovecot-2.2: quota: Fixed error handling in quota counting code.
dovecot at dovecot.org
dovecot at dovecot.org
Fri Jul 3 10:57:13 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/f3847ac93623
changeset: 18900:f3847ac93623
user: Timo Sirainen <tss at iki.fi>
date: Fri Jul 03 13:54:18 2015 +0300
description:
quota: Fixed error handling in quota counting code.
Errors weren't logged and some error checking was missing.
diffstat:
src/plugins/quota/quota-count.c | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diffs (64 lines):
diff -r ae19beafa55b -r f3847ac93623 src/plugins/quota/quota-count.c
--- a/src/plugins/quota/quota-count.c Thu Jul 02 11:06:04 2015 +0200
+++ b/src/plugins/quota/quota-count.c Fri Jul 03 13:54:18 2015 +0300
@@ -19,6 +19,7 @@
struct mail *mail;
struct mail_search_args *search_args;
enum mail_error error;
+ const char *errstr;
uoff_t size;
int ret = 0;
@@ -30,10 +31,13 @@
box = mailbox_alloc(ns->list, vname, MAILBOX_FLAG_READONLY);
if (mailbox_sync(box, MAILBOX_SYNC_FLAG_FULL_READ) < 0) {
- error = mailbox_get_last_mail_error(box);
+ errstr = mailbox_get_last_error(box, &error);
mailbox_free(&box);
- if (error == MAIL_ERROR_TEMP)
+ if (error == MAIL_ERROR_TEMP) {
+ i_error("quota: Couldn't sync mailbox %s: %s",
+ vname, errstr);
return -1;
+ }
/* non-temporary error, e.g. ACLs denied access. */
return 0;
}
@@ -49,10 +53,22 @@
while (mailbox_search_next(ctx, &mail)) {
if (mail_get_physical_size(mail, &size) == 0)
*bytes_r += size;
+ else {
+ errstr = mailbox_get_last_error(box, &error);
+ if (error != MAIL_ERROR_EXPUNGED) {
+ i_error("quota: Couldn't get size of mail UID %u in %s: %s",
+ mail->uid, vname, mailbox_get_last_error(box, NULL));
+ ret = -1;
+ break;
+ }
+ }
*count_r += 1;
}
- if (mailbox_search_deinit(&ctx) < 0)
+ if (mailbox_search_deinit(&ctx) < 0) {
+ i_error("quota: Listing mails in %s failed: %s",
+ vname, mailbox_get_last_error(box, NULL));
ret = -1;
+ }
if (ret < 0)
mailbox_transaction_rollback(&trans);
@@ -83,8 +99,11 @@
break;
}
}
- if (mailbox_list_iter_deinit(&ctx) < 0)
+ if (mailbox_list_iter_deinit(&ctx) < 0) {
+ i_error("quota: Listing namespace '%s' failed: %s",
+ ns->prefix, mailbox_list_get_last_error(ns->list, NULL));
ret = -1;
+ }
if (ns->prefix_len > 0 && ret == 0 &&
(ns->prefix_len != 6 || strncasecmp(ns->prefix, "INBOX", 5) != 0)) {
/* if the namespace prefix itself exists, count it also */
More information about the dovecot-cvs
mailing list