Skip to content

Commit

Permalink
imapc: Fix local state if mailbox is empty after reconnection
Browse files Browse the repository at this point in the history
If local indexes had more than 0 mails, but after reconnection the remote
IMAP server replied with "* 0 EXISTS", the mails in local index weren't
expunged. This could have resulted in:

Panic: file imapc-sync.c: line 328 (imapc_initial_sync_check): assertion failed: (mail_index_is_expunged(view, lseq) || seq_range_exists(&ctx->mbox->delayed_expunged_uids, luid))
  • Loading branch information
sirainen authored and cmouse committed Mar 28, 2018
1 parent 5522b8b commit c05b4ac
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib-storage/index/imapc/imapc-mailbox.c
Expand Up @@ -220,8 +220,10 @@ imapc_mailbox_fetch_state(struct imapc_mailbox *mbox, uint32_t first_uid)
struct imapc_command *cmd;

if (mbox->exists_count == 0) {
/* empty mailbox - no point in fetching anything */
mbox->state_fetched_success = TRUE;
/* empty mailbox - no point in fetching anything.
just make sure everything is expunged in local index. */
mbox->sync_next_lseq = 1;
imapc_mailbox_fetch_state_finish(mbox);
return;
}
if (mbox->state_fetching_uid1) {
Expand Down

0 comments on commit c05b4ac

Please sign in to comment.