changeset 20521:1a31a7ef45b5

lib-storage: Initialize pop3-uidl header also when no backend UIDLs exist. The first time POP3 UIDL command is used, set the header even when there are no backend UIDLs to prevent any further UIDL caching.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 13 Jul 2016 14:07:02 -0500
parents 2a50bc7f37c1
children 2c0956060e6d
files src/lib-storage/index/index-pop3-uidl.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/index-pop3-uidl.c	Mon Jul 11 14:56:41 2016 +0300
+++ b/src/lib-storage/index/index-pop3-uidl.c	Wed Jul 13 14:07:02 2016 -0500
@@ -65,8 +65,13 @@
 	size_t size;
 	bool seen_all_msgs;
 
-	if (trans->highest_pop3_uidl_uid == 0)
+	mail_index_get_header_ext(trans->view, trans->box->pop3_uidl_hdr_ext_id,
+				  &data, &size);
+
+	if (trans->highest_pop3_uidl_uid == 0 && size >= sizeof(uidl)) {
+		/* header already set and nothing to change */
 		return;
+	}
 
 	/* First check that we actually looked at UIDL for all messages.
 	   Otherwise we can't say for sure if the newest messages had UIDLs. */
@@ -89,8 +94,6 @@
 		return;
 
 	/* check if we have already the same header */
-	mail_index_get_header_ext(trans->view, trans->box->pop3_uidl_hdr_ext_id,
-				  &data, &size);
 	if (size >= sizeof(uidl)) {
 		memcpy(&uidl, data, size);
 		if (trans->highest_pop3_uidl_uid == uidl.max_uid_with_pop3_uidl)