]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Initialize pop3-uidl header also when no backend UIDLs exist.
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 13 Jul 2016 19:07:02 +0000 (14:07 -0500)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 13 Jul 2016 19:18:56 +0000 (22:18 +0300)
The first time POP3 UIDL command is used, set the header even when there are
no backend UIDLs to prevent any further UIDL caching.

src/lib-storage/index/index-pop3-uidl.c

index 5ebc7073ff67da40e9c059560ae70b7daf546eb8..b5c8e0195d0a748eedd5f7168cd8fd7f0c66e736 100644 (file)
@@ -65,8 +65,13 @@ void index_pop3_uidl_update_exists_finish(struct mailbox_transaction_context *tr
        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 @@ void index_pop3_uidl_update_exists_finish(struct mailbox_transaction_context *tr
                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)