/* Copyright (c) 2007-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "ioloop.h"
#include "mkdir-parents.h"
#include "master-service.h"
#include "mail-index-modseq.h"
#include "mail-index-alloc-cache.h"
#include "mailbox-log.h"
#include "mailbox-list-private.h"
#include "index-pop3-uidl.h"
#include "dbox-mail.h"
#include "dbox-save.h"
#include "mdbox-map.h"
#include "mdbox-file.h"
#include "mdbox-sync.h"
#include "mdbox-storage-rebuild.h"
#include "mdbox-storage.h"
extern struct mail_storage mdbox_storage;
extern struct mailbox mdbox_mailbox;
{
}
{
const char *dir;
*error_r = "mdbox: MAILBOXDIR must not be empty";
return -1;
}
}
}
{
}
static const char *
{
if (debug)
return path;
}
if (debug)
}
return NULL;
}
struct mailbox_list_settings *set)
{
else {
if (debug)
i_debug("mdbox: couldn't find root dir");
return FALSE;
}
}
if (debug)
return FALSE;
}
if (debug)
return FALSE;
}
return TRUE;
}
static struct mailbox *
{
/* dbox can't work without index files */
}
{
return -1;
return -1;
sizeof(struct mdbox_mail_index_record),
sizeof(uint32_t));
mbox->hdr_ext_id =
sizeof(struct mdbox_index_header), 0, 0);
mbox->guid_ext_id =
0, GUID_128_SIZE, 1);
return 0;
}
{
(void)mdbox_storage_rebuild(mstorage);
}
{
const void *data;
if (data_size < MDBOX_INDEX_HEADER_MIN_SIZE &&
"mdbox: Invalid dbox header size: %"PRIuSIZE_T,
return -1;
}
if (data_size > 0)
return 0;
}
struct mail_index_transaction *trans,
const struct mailbox_update *update)
{
bool need_resize;
need_resize = TRUE;
}
sizeof(new_hdr.mailbox_guid));
}
if (need_resize) {
sizeof(new_hdr));
}
}
}
const struct mailbox_update *update,
struct mail_index_transaction *trans)
{
return -1;
}
else if (uid_validity == 0) {
/* set uidvalidity */
}
}
}
}
}
/* initialize pop3-uidl header when creating mailbox
(not on mailbox_update()) */
}
if (mail_index_transaction_commit(&new_trans) < 0) {
return -1;
}
}
return 0;
}
const struct mailbox_update *update,
struct mail_index_transaction *trans)
{
int ret;
return ret;
}
{
/* already set it corrupted (possibly recursing back here) */
return;
}
}
}
static const char *
{
return "";
}
{
}
{
}
static int
{
bool need_resize;
int ret = 0;
/* there's a race condition between mkdir and getting the mailbox GUID.
normally this is handled by mdbox syncing, but GUID can be looked up
without syncing. when we detect this situation we'll try to finish
creating the indexes first, which usually means just waiting for
the sync lock to get unlocked by the other process creating them. */
return -1;
}
/* regenerate it */
ret = -1;
}
if (ret == 0)
return ret;
}
static int
enum mailbox_metadata_items items,
struct mailbox_metadata *metadata_r)
{
return -1;
if ((items & MAILBOX_METADATA_GUID) != 0) {
return -1;
}
return 0;
}
static int
{
if (mailbox_open(box) < 0)
return -1;
}
return -1;
}
.v = {
NULL,
NULL,
}
};
.v = {
NULL,
NULL,
}
};
};