}
if (ret < 0) {
ret = stat(box_path, &st);
- } else if (ret == 0 && !box->list->set.iter_from_index_dir &&
+ } else if (ret == 0 &&
+ !box->list->mail_set->mailbox_list_iter_from_index_dir &&
*box->list->set.mailbox_dir_name == '\0') {
/* There are index files for this mailbox and no separate
mailboxes directory is configured. */
return 0;
}
- ret = (subdir != NULL || !box->list->set.iter_from_index_dir) ? 0 :
+ ret = (subdir != NULL ||
+ !box->list->mail_set->mailbox_list_iter_from_index_dir) ? 0 :
mailbox_get_path_to(box, MAILBOX_LIST_PATH_TYPE_INDEX, &index_path);
if (ret > 0 && strcmp(path, index_path) != 0) {
/* index directory is different - prefer looking it up first
if ((ret = mailbox_mkdir(box, path, type)) < 0)
return -1;
- if (box->list->set.iter_from_index_dir) {
+ if (box->list->mail_set->mailbox_list_iter_from_index_dir) {
/* need to also create the directory to index path or
iteration won't find it. */
int ret2;
const char *index_path;
struct stat st;
- /* Could be a race condition or could be because ITERINDEX is used
- and the index directory exists, but the storage directory doesn't.
- Handle the existence inconsistency by creating this directory if
- the index directory exists (don't bother checking if ITERINDEX is
+ /* Could be a race condition or could be because
+ mailbox_list_iter_from_index_dir=yes is used and the index directory
+ exists, but the storage directory doesn't. Handle the existence
+ inconsistency by creating this directory if the index directory
+ exists (don't bother checking if mailbox_list_iter_from_index_dir is
set or not - it doesn't matter since either both dirs should exist
or not). */
if (mailbox_get_path_to(box, MAILBOX_LIST_PATH_TYPE_INDEX,
const char *root_dir, *p;
size_t len;
- if (list->set.iter_from_index_dir &&
+ if (list->mail_set->mailbox_list_iter_from_index_dir &&
!list->mail_set->mailbox_list_drop_noselect &&
mailbox_list_path_is_index(list, type)) {
- /* Don't auto-rmdir parent index directories with ITERINDEX.
+ /* Don't auto-rmdir parent index directories with
+ mailbox_list_iter_from_index_dir=yes.
Otherwise it'll get us into inconsistent state with a
\NoSelect mailbox in the mail directory but not in index
directory. */
strcmp(index_path, path) == 0) {
/* CONTROL dir is the same as INDEX dir, which we already
deleted. We don't want to continue especially with
- iter_from_index_dir=yes, because it could be deleting the
- index directory. */
+ mailbox_list_iter_from_index_dir=yes, because it could be
+ deleting the index directory. */
return 0;
}
*flags_r = 0;
- if (*list->set.maildir_name != '\0' && !list->set.iter_from_index_dir) {
+ if (*list->set.maildir_name != '\0' &&
+ !list->mail_set->mailbox_list_iter_from_index_dir) {
/* maildir_name is set: This is the simple case that works for
all mail storage formats, because the only thing that
matters for existence or child checks is whether the
though maildir_name is set, it's not used for index directory.
*/
- if (!list->set.iter_from_index_dir &&
+ if (!list->mail_set->mailbox_list_iter_from_index_dir &&
list->v.is_internal_name != NULL &&
list->v.is_internal_name(list, fname)) {
/* skip internal dirs. For example Maildir's cur/new/tmp */
return 1;
}
- if (list->v.is_internal_name == NULL || list->set.iter_from_index_dir) {
+ if (list->v.is_internal_name == NULL ||
+ list->mail_set->mailbox_list_iter_from_index_dir) {
/* This mailbox format doesn't use any special directories
(e.g. Maildir's cur/new/tmp). In that case we can look at
the directory's link count to determine whether there are
ctx->info_pool = pool_alloconly_create("fs list", 1024);
ctx->sep = mail_namespace_get_sep(_list->ns);
ctx->info.ns = _list->ns;
- ctx->ctx.iter_from_index_dir = ctx->ctx.list->set.iter_from_index_dir;
+ ctx->ctx.iter_from_index_dir =
+ ctx->ctx.list->mail_set->mailbox_list_iter_from_index_dir;
if ((flags & MAILBOX_LIST_ITER_FORCE_RESYNC) != 0) {
i_assert(!hash_table_is_created(ctx->ctx.found_mailboxes));
&path) <= 0)
i_unreached();
ret = fs_list_rmdir(list, name, path);
- if (!list->set.iter_from_index_dir) {
+ if (!list->mail_set->mailbox_list_iter_from_index_dir) {
/* it should exist only in the mail directory */
if (ret == 0)
return 0;
ctx->prefix_char = strcmp(_list->name, MAILBOX_LIST_NAME_IMAPDIR) == 0 ?
'\0' : list->sep;
- if (_list->set.iter_from_index_dir)
+ if (_list->mail_set->mailbox_list_iter_from_index_dir)
ctx->dir = _list->set.index_dir;
else
ctx->dir = _list->set.root_dir;
DEF(BOOL, mailbox_list_index),
DEF(BOOL, mailbox_list_index_very_dirty_syncs),
DEF(BOOL, mailbox_list_index_include_inbox),
+ DEF(BOOL_HIDDEN, mailbox_list_iter_from_index_dir),
DEF(BOOL_HIDDEN, mailbox_list_drop_noselect),
DEF(BOOL_HIDDEN, mailbox_list_validate_fs_names),
DEF(BOOL_HIDDEN, mail_full_filesystem_access),
.mailbox_list_index = TRUE,
.mailbox_list_index_very_dirty_syncs = FALSE,
.mailbox_list_index_include_inbox = FALSE,
+ .mailbox_list_iter_from_index_dir = FALSE,
.mailbox_list_drop_noselect = TRUE,
.mailbox_list_validate_fs_names = TRUE,
.mail_full_filesystem_access = FALSE,
#define OFFSET(name) offsetof(struct mail_storage_settings, name)
static const size_t mail_storage_2nd_reset_offsets[] = {
OFFSET(mail_location),
+ OFFSET(mailbox_list_iter_from_index_dir),
};
static void
bool mailbox_list_index;
bool mailbox_list_index_very_dirty_syncs;
bool mailbox_list_index_include_inbox;
+ bool mailbox_list_iter_from_index_dir;
bool mailbox_list_drop_noselect;
bool mailbox_list_validate_fs_names;
bool mail_full_filesystem_access;
const char *root_dir, *type_name, *error;
enum mailbox_list_path_type type;
- if (list->set.iter_from_index_dir) {
+ if (list->mail_set->mailbox_list_iter_from_index_dir) {
type = MAILBOX_LIST_PATH_TYPE_INDEX;
type_name = "index";
} else {
list->set.volatile_dir = p_strdup(list->pool, set->volatile_dir);
list->set.index_control_use_maildir_name =
set->index_control_use_maildir_name;
- list->set.iter_from_index_dir = set->iter_from_index_dir;
if (*set->mailbox_dir_name == '\0')
list->set.mailbox_dir_name = "";
}
set_r->vname_escape_char = value[0];
continue;
- } else if (strcmp(key, "ITERINDEX") == 0) {
- set_r->iter_from_index_dir = TRUE;
- continue;
} else {
*error_r = t_strdup_printf("Unknown setting: %s", key);
return -1;
if (set_r->index_dir != NULL && strcmp(set_r->index_dir, "MEMORY") == 0)
set_r->index_dir = "";
- if (set_r->iter_from_index_dir &&
- (set_r->index_dir == NULL || set_r->index_dir[0] == '\0')) {
- *error_r = "ITERINDEX requires INDEX to be explicitly set";
- return -1;
- }
if (set_r->list_index_fname != NULL &&
(fname = strrchr(set_r->list_index_fname, '/')) != NULL) {
/* non-default LISTINDEX directory */
permissions_r->file_create_gid = (gid_t)-1;
permissions_r->file_create_gid_origin = "defaults";
- if (list->set.iter_from_index_dir ||
+ if (list->mail_set->mailbox_list_iter_from_index_dir ||
(list->flags & MAILBOX_LIST_FLAG_NO_MAIL_FILES) != 0) {
/* a) iterating from index dir. Use the index dir's permissions
as well, since they might be in a faster storage.
return mailbox_list_iter_deinit(&iter);
}
- if (!list->set.iter_from_index_dir) {
+ if (!list->mail_set->mailbox_list_iter_from_index_dir) {
rootdir = mailbox_list_get_root_forced(list, MAILBOX_LIST_PATH_TYPE_MAILBOX);
if (mailbox_list_get_path(list, name, MAILBOX_LIST_PATH_TYPE_DIR, &path) <= 0)
i_unreached();
have been the default since the beginning, but for backwards
compatibility it had to be made an option. */
bool index_control_use_maildir_name:1;
- /* Perform mailbox iteration using the index directory instead of the
- mail root directory. This can be helpful if the indexes are on a
- faster storage. This could perhaps be made the default at some point,
- but for now since it's less tested it's optional. */
- bool iter_from_index_dir:1;
};
struct mailbox_permissions {