]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Fix adding forced cache decisions to existing cache files
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 22 Jan 2018 15:38:32 +0000 (17:38 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Mon, 29 Jan 2018 13:21:40 +0000 (15:21 +0200)
If a field already existed in the cache file, the cache decision from the
file was always used. This caused force-decisions to be ignored.

src/lib-index/mail-cache-fields.c

index 8f3c62ab856fbc9d9a41d2283b1fbcd160949f78..acb8e75bfa4546ae637accd6ca126719a982a307 100644 (file)
@@ -398,7 +398,9 @@ int mail_cache_header_fields_read(struct mail_cache *cache)
                                           &orig_key, &orig_value)) {
                        /* already exists, see if decision can be updated */
                        fidx = POINTER_CAST_TO(orig_value, unsigned int);
-                       if (!cache->fields[fidx].decision_dirty) {
+                       if (!cache->fields[fidx].decision_dirty &&
+                           (cache->fields[fidx].field.decision &
+                            MAIL_CACHE_DECISION_FORCED) == 0) {
                                cache->fields[fidx].field.decision =
                                        decisions[i];
                        }