bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch#include "lib.h"
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch#include "buffer.h"
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch#include "settings-parser.h"
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch#include "service-settings.h"
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch#include "mail-storage-settings.h"
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch#include "imap-urlauth-worker-settings.h"
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch#include <stddef.h>
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch#include <unistd.h>
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch/* <settings checks> */
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschstatic struct file_listener_settings imap_urlauth_worker_unix_listeners_array[] = {
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch { "imap-urlauth-worker", 0600, "$default_internal_user", "" }
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschstatic struct file_listener_settings *imap_urlauth_worker_unix_listeners[] = {
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch &imap_urlauth_worker_unix_listeners_array[0]
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschstatic buffer_t imap_urlauth_worker_unix_listeners_buf = {
da7f1a07f583df8905684a7b78469960afd7c78dPhil Carmody imap_urlauth_worker_unix_listeners, sizeof(imap_urlauth_worker_unix_listeners), { NULL, }
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch/* </settings checks> */
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschstruct service_settings imap_urlauth_worker_service_settings = {
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .name = "imap-urlauth-worker",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .protocol = "imap",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .type = "",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .executable = "imap-urlauth-worker",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .user = "",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .group = "",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .privileged_group = "",
d7952621661d9a9102393d27d061dad3d22083fdTimo Sirainen .extra_groups = "$default_internal_group",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .chroot = "",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .drop_priv_before_exec = FALSE,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .process_min_avail = 0,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .process_limit = 1024,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .client_limit = 1,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .service_count = 1,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .idle_kill = 0,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .vsz_limit = (uoff_t)-1,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .unix_listeners = { { &imap_urlauth_worker_unix_listeners_buf,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch sizeof(imap_urlauth_worker_unix_listeners[0]) } },
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .fifo_listeners = ARRAY_INIT,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .inet_listeners = ARRAY_INIT
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch#undef DEF
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch#define DEF(type, name) \
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch { type, #name, offsetof(struct imap_urlauth_worker_settings, name), NULL }
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschstatic const struct setting_define imap_urlauth_worker_setting_defines[] = {
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch DEF(SET_BOOL, verbose_proctitle),
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch DEF(SET_STR, imap_urlauth_host),
009217abb57a24a4076092e8e4e165545747839eStephan Bosch DEF(SET_IN_PORT, imap_urlauth_port),
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch SETTING_DEFINE_LIST_END
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschconst struct imap_urlauth_worker_settings imap_urlauth_worker_default_settings = {
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .verbose_proctitle = FALSE,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .imap_urlauth_host = "",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .imap_urlauth_port = 143
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschstatic const struct setting_parser_info *imap_urlauth_worker_setting_dependencies[] = {
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch &mail_user_setting_parser_info,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch NULL
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschconst struct setting_parser_info imap_urlauth_worker_setting_parser_info = {
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .module_name = "imap-urlauth-worker",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .defines = imap_urlauth_worker_setting_defines,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .defaults = &imap_urlauth_worker_default_settings,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .type_offset = (size_t)-1,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .struct_size = sizeof(struct imap_urlauth_worker_settings),
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .parent_offset = (size_t)-1,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .dependencies = imap_urlauth_worker_setting_dependencies
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};