]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: mail_add_temp_wanted_fields() - delay opening stream
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sun, 25 Jun 2017 06:10:52 +0000 (09:10 +0300)
committerGitLab <gitlab@git.dovecot.net>
Sun, 25 Jun 2017 08:43:17 +0000 (11:43 +0300)
Allows plugins to call it in mail.get_stream() without infinite loop.

src/lib-storage/index/index-mail.c

index 0b920691da504146270e57cdd3ae030a61f98f41..25525c95cf4e12587f3060a9c5334f75c2628c58 100644 (file)
@@ -2009,7 +2009,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)