Skip to content

Commit

Permalink
imapc: Make sure a valid UIDVALIDITY is returned by SELECT
Browse files Browse the repository at this point in the history
Fixes errors such as:
Error: Synchronization corrupted index header (in-memory index): uidvalidity=0, but next_uid=9
  • Loading branch information
sirainen authored and GitLab committed May 19, 2017
1 parent 6e853fd commit 7efe57b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lib-storage/index/imapc/imapc-mailbox.c
Expand Up @@ -584,7 +584,8 @@ imapc_resp_text_uidvalidity(const struct imapc_untagged_reply *reply,
uint32_t uid_validity;

if (mbox == NULL ||
str_to_uint32(reply->resp_text_value, &uid_validity) < 0)
str_to_uint32(reply->resp_text_value, &uid_validity) < 0 ||
uid_validity == 0)
return;

if (mbox->sync_uid_validity != uid_validity) {
Expand Down
2 changes: 2 additions & 0 deletions src/lib-storage/index/imapc/imapc-storage.c
Expand Up @@ -545,6 +545,8 @@ imapc_mailbox_verify_select(struct imapc_mailbox *mbox, const char **error_r)
{
if (!mbox->exists_received)
*error_r = "EXISTS not received";
else if (mbox->sync_uid_validity == 0)
*error_r = "UIDVALIDITY not received";
else
return TRUE;
return FALSE;
Expand Down

0 comments on commit 7efe57b

Please sign in to comment.