]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: If major_version or uoff_t size change in cache file, log error
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 2 Apr 2020 21:18:28 +0000 (00:18 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 15 Apr 2020 09:41:43 +0000 (12:41 +0300)
These events really aren't expected, so it's better to clearly log errors
about them rather than silently delete the cache file.

src/lib-index/mail-cache.c

index ebddcf28b3e59956a16d0a921a0a9ea5950ec879..f409b01716adad51484a655621ea14f2037c68b6 100644 (file)
@@ -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;
        }