mail-storage-settings.c revision d2e74f2af690b8e2d536400f02f397cbed1334b7
/* Copyright (c) 2005-2013 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "hash-format.h"
#include "var-expand.h"
#include "unichar.h"
#include "settings-parser.h"
#include "mail-index.h"
#include "mail-user.h"
#include "mail-namespace.h"
#include "mail-storage-private.h"
#include "mail-storage-settings.h"
#include <stddef.h>
static const struct setting_define mail_storage_setting_defines[] = {
};
const struct mail_storage_settings mail_storage_default_settings = {
.mail_location = "",
.mail_attachment_fs = "sis posix",
.mail_attachment_dir = "",
.mail_attachment_hash = "%{sha1}",
.mail_attribute_dict = "",
.mail_prefetch_count = 0,
.mail_cache_fields = "flags",
.mail_always_cache_fields = "",
.mail_never_cache_fields = "imap.envelope",
.mailbox_idle_check_interval = 30,
.mail_max_keyword_length = 50,
.mail_max_lock_timeout = 0,
.mail_save_crlf = FALSE,
.mail_fsync = "optimized:never:always",
.mmap_disable = FALSE,
.dotlock_use_excl = TRUE,
.mail_nfs_index = FALSE,
.mail_debug = FALSE,
.lock_method = "fcntl:flock:dotlock",
.pop3_uidl_format = "%08Xu%08Xv",
.ssl_client_ca_dir = "",
.ssl_client_ca_file = "",
.ssl_crypto_device = ""
};
const struct setting_parser_info mail_storage_setting_parser_info = {
.module_name = "mail",
.struct_size = sizeof(struct mail_storage_settings),
};
static const struct setting_define mailbox_setting_defines[] = {
};
const struct mailbox_settings mailbox_default_settings = {
.name = "",
.special_use = "",
.driver = ""
};
const struct setting_parser_info mailbox_setting_parser_info = {
.struct_size = sizeof(struct mailbox_settings),
};
{ SET_DEFLIST_UNIQUE, name, \
static const struct setting_define mail_namespace_setting_defines[] = {
};
const struct mail_namespace_settings mail_namespace_default_settings = {
.name = "",
.type = "private:shared:public",
.separator = "",
.prefix = "",
.location = "",
.list = "yes:no:children",
.subscriptions = TRUE,
};
const struct setting_parser_info mail_namespace_setting_parser_info = {
.struct_size = sizeof(struct mail_namespace_settings),
};
{ SET_DEFLIST_UNIQUE, name, \
static const struct setting_define mail_user_setting_defines[] = {
};
static const struct mail_user_settings mail_user_default_settings = {
.base_dir = PKG_RUNDIR,
.auth_socket_path = "auth-userdb",
.mail_temp_dir = "/tmp",
.mail_uid = "",
.mail_gid = "",
.mail_home = "",
.mail_chroot = "",
.mail_access_groups = "",
.mail_privileged_group = "",
.valid_chroot_dirs = "",
.first_valid_uid = 500,
.last_valid_uid = 0,
.first_valid_gid = 1,
.last_valid_gid = 0,
.mail_plugins = "",
.mail_log_prefix = "%s(%u): ",
.namespaces = ARRAY_INIT,
};
const struct setting_parser_info mail_user_setting_parser_info = {
.module_name = "mail",
.struct_size = sizeof(struct mail_user_settings),
};
const void *
const struct mail_user_settings *set,
const char *driver)
{
const void *dset;
i_panic("Default settings not found for storage driver %s",
driver);
}
return dset;
}
const struct mail_storage_settings *
{
}
{
}
const struct dynamic_settings_parser *
{
struct dynamic_settings_parser *parsers;
struct mail_storage *const *storages;
unsigned int i, j, count;
for (i = 0, j = 1; i < count; i++) {
continue;
j++;
}
return parsers;
}
static void
{
}
/* <settings checks> */
const char **error_r)
{
struct hash_format *format;
const char *p, *error;
bool uidl_format_ok;
char c;
if (set->mailbox_idle_check_interval == 0) {
*error_r = "mailbox_idle_check_interval must not be 0";
return FALSE;
}
else {
set->mail_fsync);
return FALSE;
}
*error_r = "mail_nfs_index=yes requires mmap_disable=yes";
return FALSE;
}
if (set->mail_nfs_index &&
*error_r = "mail_nfs_index=yes requires mail_fsync=always";
return FALSE;
}
&set->parsed_lock_method)) {
set->lock_method);
return FALSE;
}
if (p[0] != '%' || p[1] == '\0')
continue;
c = var_get_key(++p);
switch (c) {
case 'v':
case 'u':
case 'm':
case 'f':
case 'g':
break;
case '%':
break;
default:
"Unknown pop3_uidl_format variable: %%%c", c);
return FALSE;
}
}
if (!uidl_format_ok) {
*error_r = "pop3_uidl_format setting doesn't contain any "
"%% variables.";
return FALSE;
}
*error_r = "mail_attachment_hash setting "
"must not contain '/' characters";
return FALSE;
}
return FALSE;
}
*error_r = "mail_attachment_hash setting "
"must not contain '-' characters";
return FALSE;
}
#ifndef CONFIG_BINARY
"ssl_client_ca_dir: access(%s) failed: %m",
return FALSE;
}
#endif
return TRUE;
}
const char **error_r)
{
struct mail_namespace_settings *const *namespaces;
const char *name;
unsigned int i, count;
"Hierarchy separator must be only one character long",
name);
return FALSE;
}
if (!uni_utf8_str_is_valid(name)) {
name);
return FALSE;
}
&count);
} else {
namespaces = NULL;
count = 0;
}
for (i = 0; i < count; i++) {
break;
}
if (i == count) {
"Namespace '%s': alias_for points to "
return FALSE;
}
"Namespace '%s': alias_for chaining isn't "
namespaces[i]->alias_for);
return FALSE;
}
}
return TRUE;
}
static bool mailbox_special_use_exists(const char *name)
{
if (name[0] != '\\')
return FALSE;
name++;
return TRUE;
return TRUE;
return TRUE;
return TRUE;
return TRUE;
return TRUE;
return TRUE;
return FALSE;
}
static bool
const char **error_r)
{
unsigned int i;
if (!mailbox_special_use_exists(uses[i])) {
"mailbox %s: unknown special_use: %s",
return FALSE;
}
}
/* make sure there are no extra spaces */
return TRUE;
}
const char **error_r)
{
return FALSE;
}
return FALSE;
}
return TRUE;
}
const char **error_r ATTR_UNUSED)
{
#ifndef CONFIG_BINARY
#else
"mail_plugin_dir: access(%s) failed: %m",
return FALSE;
}
#endif
return TRUE;
}
/* </settings checks> */