From ed34a210eff7707787ee154e5581528b8f4b2daa Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 20 Apr 2011 17:44:36 +0300 Subject: [PATCH] maildir: If uidlist has an empty GUID entry, log an error and remove it. This fixes an assert-crash in dsync. --- src/lib-storage/index/maildir/maildir-mail.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/lib-storage/index/maildir/maildir-mail.c b/src/lib-storage/index/maildir/maildir-mail.c index ca26d7870b..492561ab32 100644 --- a/src/lib-storage/index/maildir/maildir-mail.c +++ b/src/lib-storage/index/maildir/maildir-mail.c @@ -485,8 +485,17 @@ maildir_mail_get_special(struct mail *_mail, enum mail_fetch_field field, guid = maildir_uidlist_lookup_ext(mbox->uidlist, _mail->uid, MAILDIR_UIDLIST_REC_EXT_GUID); if (guid != NULL) { - *value_r = p_strdup(mail->data_pool, guid); - return 0; + if (*guid != '\0') { + *value_r = p_strdup(mail->data_pool, guid); + return 0; + } + + mail_storage_set_critical(_mail->box->storage, + "Maildir %s: Corrupted dovecot-uidlist: " + "UID %u had empty GUID, clearing it", + _mail->box->path, _mail->uid); + maildir_uidlist_set_ext(mbox->uidlist, _mail->uid, + MAILDIR_UIDLIST_REC_EXT_GUID, NULL); } /* default to base filename: */ -- 2.47.3