From: Timo Sirainen Date: Thu, 2 Apr 2020 21:18:28 +0000 (+0300) Subject: lib-index: If major_version or uoff_t size change in cache file, log error X-Git-Tag: 2.3.11.2~360 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b30ad2cfd7b20666ab95435b2c38f95228cfdb5e;p=thirdparty%2Fdovecot%2Fcore.git lib-index: If major_version or uoff_t size change in cache file, log error These events really aren't expected, so it's better to clearly log errors about them rather than silently delete the cache file. --- diff --git a/src/lib-index/mail-cache.c b/src/lib-index/mail-cache.c index ebddcf28b3..f409b01716 100644 --- a/src/lib-index/mail-cache.c +++ b/src/lib-index/mail-cache.c @@ -274,12 +274,14 @@ static bool mail_cache_verify_header(struct mail_cache *cache, if (hdr->major_version != MAIL_CACHE_MAJOR_VERSION) { /* version changed - upgrade silently */ - mail_cache_unlink(cache); + mail_cache_set_corrupted(cache, "Unsupported major version (%u)", + hdr->major_version); return FALSE; } if (hdr->compat_sizeof_uoff_t != sizeof(uoff_t)) { /* architecture change - handle silently(?) */ - mail_cache_unlink(cache); + mail_cache_set_corrupted(cache, "Unsupported uoff_t size (%u)", + hdr->compat_sizeof_uoff_t); return FALSE; }