director-settings.c revision b97e952db93a681968777dfda9728cc92ff0d7c4
2310N/A/* Copyright (c) 2009-2017 Dovecot authors, see the included COPYING file */
2310N/A
2310N/A#include "lib.h"
3237N/A#include "buffer.h"
2310N/A#include "settings-parser.h"
3237N/A#include "service-settings.h"
2310N/A#include "director-settings.h"
2310N/A
3237N/A/* <settings checks> */
3237N/Astatic bool director_settings_verify(void *_set, pool_t pool, const char **error_r);
3237N/A
3237N/Astatic struct file_listener_settings director_unix_listeners_array[] = {
3237N/A { "login/director", 0, "", "" },
3237N/A { "director-admin", 0600, "", "" }
2310N/A};
2310N/Astatic struct file_listener_settings *director_unix_listeners[] = {
2310N/A &director_unix_listeners_array[0],
2310N/A &director_unix_listeners_array[1]
2310N/A};
2310N/Astatic buffer_t director_unix_listeners_buf = {
2310N/A director_unix_listeners,
3237N/A sizeof(director_unix_listeners), { NULL, }
3237N/A};
3237N/Astatic struct file_listener_settings director_fifo_listeners_array[] = {
3237N/A { "login/proxy-notify", 0, "", "" }
2310N/A};
2310N/Astatic struct file_listener_settings *director_fifo_listeners[] = {
2310N/A &director_fifo_listeners_array[0]
2310N/A};
2310N/Astatic buffer_t director_fifo_listeners_buf = {
2310N/A director_fifo_listeners,
3237N/A sizeof(director_fifo_listeners), { NULL, }
3237N/A};
3237N/A/* </settings checks> */
3237N/A
2310N/Astruct service_settings director_service_settings = {
3237N/A .name = "director",
2310N/A .protocol = "",
2310N/A .type = "",
2310N/A .executable = "director",
2310N/A .user = "$default_internal_user",
2310N/A .group = "",
2310N/A .privileged_group = "",
2310N/A .extra_groups = "",
2310N/A .chroot = ".",
2310N/A
2310N/A .drop_priv_before_exec = FALSE,
2310N/A
2310N/A .process_min_avail = 0,
2310N/A .process_limit = 1,
2310N/A .client_limit = 0,
2310N/A .service_count = 0,
2310N/A .idle_kill = UINT_MAX,
3237N/A .vsz_limit = (uoff_t)-1,
3237N/A
3237N/A .unix_listeners = { { &director_unix_listeners_buf,
3237N/A sizeof(director_unix_listeners[0]) } },
3237N/A .fifo_listeners = { { &director_fifo_listeners_buf,
3237N/A sizeof(director_fifo_listeners[0]) } },
3237N/A .inet_listeners = ARRAY_INIT,
3237N/A
3237N/A .process_limit_1 = TRUE
3237N/A};
3237N/A#undef DEF
3237N/A#define DEF(type, name) \
3237N/A { type, #name, offsetof(struct director_settings, name), NULL }
3237N/A
3237N/Astatic const struct setting_define director_setting_defines[] = {
3237N/A DEF(SET_STR, master_user_separator),
2310N/A
3237N/A DEF(SET_STR, director_servers),
3237N/A DEF(SET_STR, director_mail_servers),
3237N/A DEF(SET_STR, director_username_hash),
3237N/A DEF(SET_STR, director_flush_socket),
3237N/A DEF(SET_TIME, director_user_expire),
3237N/A DEF(SET_TIME, director_user_kick_delay),
3237N/A DEF(SET_UINT, director_max_parallel_moves),
3237N/A DEF(SET_UINT, director_max_parallel_kicks),
3237N/A DEF(SET_SIZE, director_output_buffer_size),
3237N/A
3237N/A SETTING_DEFINE_LIST_END
3237N/A};
3237N/A
3237N/Aconst struct director_settings director_default_settings = {
3237N/A .master_user_separator = "",
3237N/A
3237N/A .director_servers = "",
3237N/A .director_mail_servers = "",
3237N/A .director_username_hash = "%Lu",
3237N/A .director_flush_socket = "",
3237N/A .director_user_expire = 60*15,
2310N/A .director_user_kick_delay = 2,
3237N/A .director_max_parallel_moves = 100,
2310N/A .director_max_parallel_kicks = 100,
2310N/A .director_output_buffer_size = 10 * 1024 * 1024,
2310N/A};
2310N/A
2310N/Aconst struct setting_parser_info director_setting_parser_info = {
2310N/A .module_name = "director",
2310N/A .defines = director_setting_defines,
2310N/A .defaults = &director_default_settings,
2310N/A
2310N/A .type_offset = (size_t)-1,
2310N/A .struct_size = sizeof(struct director_settings),
2310N/A
2310N/A .parent_offset = (size_t)-1,
2310N/A
2310N/A .check_func = director_settings_verify
2310N/A};
2310N/A
2310N/A/* <settings checks> */
2310N/Astatic bool
2310N/Adirector_settings_verify(void *_set, pool_t pool ATTR_UNUSED, const char **error_r)
2310N/A{
2310N/A struct director_settings *set = _set;
2310N/A
2310N/A if (set->director_user_expire < 10) {
2310N/A *error_r = "director_user_expire is too low";
2310N/A return FALSE;
2310N/A }
2310N/A return TRUE;
2310N/A}
2310N/A/* </settings checks> */
2310N/A