/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "base64.h"
#include "crc32.h"
#include "hash.h"
#include "dsync-mailbox-state.h"
#define DSYNC_STATE_MINOR_VERSION 0
{
}
{
sizeof(state->mailbox_guid));
buffer_set_used_size(buf, 0);
}
}
}
{
/* v0 had no version header and no last_messages_count */
return -1;
/* looks like valid v0 format, silently treat it as empty state */
return 0;
}
const char **error_r)
{
const unsigned char *data;
unsigned int i, count;
*error_r = "Invalid base64 data";
return -1;
}
/* v1: 4 byte header, mailboxes[], CRC32 */
/* v0: Empty state */
return 0;
}
*error_r = "Input too small";
return -1;
}
*error_r = "Invalid input size";
return dsync_mailbox_states_retry_import_v0(buf);
}
*error_r = "CRC32 mismatch";
return dsync_mailbox_states_retry_import_v0(buf);
}
data += 4;
}
return 0;
}