From 0c5c743ea06f546cfd1f08ea39039408338ddc61 Mon Sep 17 00:00:00 2001 From: Michal Hlavinka Date: Nov 25 2013 09:58:30 +0000 Subject: improved cache file handling exposed several old bugs related to fetching mail headers. - iostream handling changes were causing some connections to be disconnected before flushing their output --- diff --git a/.gitignore b/.gitignore index 6096b02..a0d4c4b 100644 --- a/.gitignore +++ b/.gitignore @@ -75,3 +75,4 @@ pigeonhole-snap0592366457df.tar.bz2 /dovecot-2.2-pigeonhole-0.4.2.tar.gz /dovecot-2.2.7.tar.gz /dovecot-2.2.8.tar.gz +/dovecot-2.2.9.tar.gz diff --git a/dovecot-2.2.8-47923cfd4b56.patch b/dovecot-2.2.8-47923cfd4b56.patch deleted file mode 100644 index 4b3925a..0000000 --- a/dovecot-2.2.8-47923cfd4b56.patch +++ /dev/null @@ -1,35 +0,0 @@ - -# HG changeset patch -# User Timo Sirainen -# Date 1384952846 -7200 -# Node ID 47923cfd4b5616f943c8e043c09e64e94b5c24f9 -# Parent 4ef184875799baa65b4b6048ccde49eefbfd9050 -lib-storage: mail_get_headers*() returned only the first header from cache. - -diff -r 4ef184875799 -r 47923cfd4b56 src/lib-storage/index/index-mail-headers.c ---- a/src/lib-storage/index/index-mail-headers.c Wed Nov 20 14:50:53 2013 +0200 -+++ b/src/lib-storage/index/index-mail-headers.c Wed Nov 20 15:07:26 2013 +0200 -@@ -603,7 +603,7 @@ - unsigned char *data; - unsigned int field_idx; - string_t *dest; -- size_t i, len; -+ size_t i, len, len2; - int ret; - ARRAY(const char *) header_values; - -@@ -657,10 +657,10 @@ - while (i < len && IS_LWSP(data[i])) i++; - - /* @UNSAFE */ -- len = get_header_size(dest, i); -- data[i + len] = '\0'; -+ len2 = get_header_size(dest, i); -+ data[i + len2] = '\0'; - value = (const char *)data + i; -- i += len + 1; -+ i += len2 + 1; - - array_append(&header_values, &value, 1); - } - diff --git a/dovecot-2.2.8-4ef184875799.patch b/dovecot-2.2.8-4ef184875799.patch deleted file mode 100644 index 780cd48..0000000 --- a/dovecot-2.2.8-4ef184875799.patch +++ /dev/null @@ -1,24 +0,0 @@ - -# HG changeset patch -# User Timo Sirainen -# Date 1384951853 -7200 -# Node ID 4ef184875799baa65b4b6048ccde49eefbfd9050 -# Parent a91437fe94b67fc0b5ef8f3177a9ebe1deccc9e3 -lib-storage: mail_get_*header*() still didn't handle cached values correctly. -If header ends with ":", the ":" shouldn't be returned as part of the value. - -diff -r a91437fe94b6 -r 4ef184875799 src/lib-storage/index/index-mail-headers.c ---- a/src/lib-storage/index/index-mail-headers.c Wed Nov 20 14:38:55 2013 +0200 -+++ b/src/lib-storage/index/index-mail-headers.c Wed Nov 20 14:50:53 2013 +0200 -@@ -653,8 +653,8 @@ - /* cached. skip "header name: " parts in dest. */ - for (i = 0; i < len; i++) { - if (data[i] == ':') { -- while (IS_LWSP(data[i+1])) i++; -- if (i+1 != len) i++; -+ i++; -+ while (i < len && IS_LWSP(data[i])) i++; - - /* @UNSAFE */ - len = get_header_size(dest, i); - diff --git a/dovecot-2.2.8-a91437fe94b6.patch b/dovecot-2.2.8-a91437fe94b6.patch deleted file mode 100644 index 321e085..0000000 --- a/dovecot-2.2.8-a91437fe94b6.patch +++ /dev/null @@ -1,32 +0,0 @@ - -# HG changeset patch -# User Timo Sirainen -# Date 1384951135 -7200 -# Node ID a91437fe94b67fc0b5ef8f3177a9ebe1deccc9e3 -# Parent f4eb4b5884b2e89e146a32b2d1db1f14f753008f -lib-storage: mail_get_*header*() were unnecessarily looking up the headers twice. - -diff -r f4eb4b5884b2 -r a91437fe94b6 src/lib-storage/index/index-mail-headers.c ---- a/src/lib-storage/index/index-mail-headers.c Wed Nov 20 14:37:44 2013 +0200 -+++ b/src/lib-storage/index/index-mail-headers.c Wed Nov 20 14:38:55 2013 +0200 -@@ -760,6 +760,9 @@ - mail_cache_set_corrupted(_mail->box->cache, - "Broken header %s for mail UID %u", - field, _mail->uid); -+ /* retry by parsing the full header */ -+ } else { -+ break; - } - } - return ret; -@@ -788,6 +791,9 @@ - mail_cache_set_corrupted(_mail->box->cache, - "Broken header %s for mail UID %u", - field, _mail->uid); -+ /* retry by parsing the full header */ -+ } else { -+ break; - } - } - *value_r = list[0]; - diff --git a/dovecot-2.2.8-f4eb4b5884b2.patch b/dovecot-2.2.8-f4eb4b5884b2.patch deleted file mode 100644 index af17b27..0000000 --- a/dovecot-2.2.8-f4eb4b5884b2.patch +++ /dev/null @@ -1,23 +0,0 @@ - -# HG changeset patch -# User Timo Sirainen -# Date 1384951064 -7200 -# Node ID f4eb4b5884b2e89e146a32b2d1db1f14f753008f -# Parent 4a0c03f98ca350634430e5c3bd5f8e5efc030a45 -lib-storage: mail_get_*header*() didn't remove leading whitespace for headers from cache. -But it was removed when the headers were found by parsing the full header. - -diff -r 4a0c03f98ca3 -r f4eb4b5884b2 src/lib-storage/index/index-mail-headers.c ---- a/src/lib-storage/index/index-mail-headers.c Tue Nov 19 23:18:11 2013 +0200 -+++ b/src/lib-storage/index/index-mail-headers.c Wed Nov 20 14:37:44 2013 +0200 -@@ -653,7 +653,8 @@ - /* cached. skip "header name: " parts in dest. */ - for (i = 0; i < len; i++) { - if (data[i] == ':') { -- if (i+1 != len && data[++i] == ' ') i++; -+ while (IS_LWSP(data[i+1])) i++; -+ if (i+1 != len) i++; - - /* @UNSAFE */ - len = get_header_size(dest, i); - diff --git a/dovecot.spec b/dovecot.spec index 5283172..f88147c 100644 --- a/dovecot.spec +++ b/dovecot.spec @@ -3,7 +3,7 @@ Summary: Secure imap and pop3 server Name: dovecot Epoch: 1 -Version: 2.2.8 +Version: 2.2.9 %global prever %{nil} Release: 1%{?dist} #dovecot itself is MIT, a few sources are PD, pigeonhole is LGPLv2 @@ -36,10 +36,6 @@ Patch5: dovecot-2.1-privatetmp.patch #wait for network Patch6: dovecot-2.1.10-waitonline.patch -Patch7: dovecot-2.2.8-f4eb4b5884b2.patch -Patch8: dovecot-2.2.8-a91437fe94b6.patch -Patch9: dovecot-2.2.8-4ef184875799.patch -Patch10: dovecot-2.2.8-47923cfd4b56.patch Source15: prestartscript Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -136,10 +132,6 @@ This package provides the development files for dovecot. %patch4 -p1 -b .reload %patch5 -p1 -b .privatetmp %patch6 -p1 -b .waitonline -%patch7 -p1 -b .f4eb4b5884b2 -%patch8 -p1 -b .a91437fe94b6 -%patch9 -p1 -b .4ef184875799 -%patch10 -p1 -b .47923cfd4b56 sed -i '/DEFAULT_INCLUDES *=/s|$| '"$(pkg-config --cflags libclucene-core)|" src/plugins/fts-lucene/Makefile.in %build @@ -493,6 +485,12 @@ make check %{_libdir}/%{name}/dict/libdriver_pgsql.so %changelog +* Mon Nov 25 2013 Michal Hlavinka - 1:2.2.9-1 +- improved cache file handling exposed several old bugs related to fetching + mail headers. +- iostream handling changes were causing some connections to be disconnected + before flushing their output + * Wed Nov 20 2013 Michal Hlavinka - 1:2.2.8-1 - Fixed infinite loop in message parsing if message ends with "--boundary" and CR (without LF). Messages saved via SMTP/LMTP can't diff --git a/sources b/sources index dea4d38..25f5ae0 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -c1594f7ffa470b6134a94c59fd85bbe8 dovecot-2.2.8.tar.gz +6e620a4020b7cc9855cbb304a63efc87 dovecot-2.2.9.tar.gz e8cb4976db9811d37e9d870f2f75ffef dovecot-2.2-pigeonhole-0.4.2.tar.gz