From: Timo Sirainen Date: Sun, 25 Jun 2017 06:10:52 +0000 (+0300) Subject: lib-storage: mail_add_temp_wanted_fields() - delay opening stream X-Git-Tag: 2.2.32.rc1~125 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=19fd49921dde2df045be4c52f4c68c854dbfc04e;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: mail_add_temp_wanted_fields() - delay opening stream Allows plugins to call it in mail.get_stream() without infinite loop. --- diff --git a/src/lib-storage/index/index-mail.c b/src/lib-storage/index/index-mail.c index 0931bb2eab..500eb100a0 100644 --- a/src/lib-storage/index/index-mail.c +++ b/src/lib-storage/index/index-mail.c @@ -2006,7 +2006,16 @@ void index_mail_add_temp_wanted_fields(struct mail *_mail, data->wanted_headers = new_wanted_headers; } index_mail_update_access_parts_pre(_mail); - index_mail_update_access_parts_post(_mail); + /* Don't call _post(), which would try to open the stream. It should be + enough to delay the opening until it happens anyway. + + Otherwise there's not really any good place to call this in the + plugins: set_seq() call get_stream() internally, which can already + start parsing the headers, so it's too late. If we use get_stream() + and there's a _post() call here, it gets into infinite loop. The + loop could probably be prevented in some way, but it's probably + better to eventually try to remove the _post() call entirely + everywhere. */ } void index_mail_set_uid_cache_updates(struct mail *_mail, bool set)