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 "imap-urlauth-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_unix_listeners_array[] = {
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch { "token-login/imap-urlauth", 0666, "", "" }
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschstatic struct file_listener_settings *imap_urlauth_unix_listeners[] = {
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch &imap_urlauth_unix_listeners_array[0]
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschstatic buffer_t imap_urlauth_unix_listeners_buf = {
da7f1a07f583df8905684a7b78469960afd7c78dPhil Carmody imap_urlauth_unix_listeners, sizeof(imap_urlauth_unix_listeners), { NULL, }
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch/* </settings checks> */
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschstruct service_settings imap_urlauth_service_settings = {
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .name = "imap-urlauth",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .protocol = "imap",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .type = "",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .executable = "imap-urlauth",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .user = "$default_internal_user",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .group = "",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .privileged_group = "",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .extra_groups = "",
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_unix_listeners_buf,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch sizeof(imap_urlauth_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_settings, name), NULL }
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschstatic const struct setting_define imap_urlauth_setting_defines[] = {
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch DEF(SET_STR, base_dir),
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch DEF(SET_BOOL, mail_debug),
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch DEF(SET_BOOL, verbose_proctitle),
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch DEF(SET_STR, imap_urlauth_logout_format),
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch DEF(SET_STR, imap_urlauth_submit_user),
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch DEF(SET_STR, imap_urlauth_stream_user),
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch SETTING_DEFINE_LIST_END
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschconst struct imap_urlauth_settings imap_urlauth_default_settings = {
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .base_dir = PKG_RUNDIR,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .mail_debug = FALSE,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .verbose_proctitle = FALSE,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .imap_urlauth_logout_format = "in=%i out=%o",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .imap_urlauth_submit_user = NULL,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .imap_urlauth_stream_user = NULL
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschstatic const struct setting_parser_info *imap_urlauth_setting_dependencies[] = {
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch NULL
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Boschconst struct setting_parser_info imap_urlauth_setting_parser_info = {
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .module_name = "imap-urlauth",
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .defines = imap_urlauth_setting_defines,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .defaults = &imap_urlauth_default_settings,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .type_offset = (size_t)-1,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .struct_size = sizeof(struct imap_urlauth_settings),
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .parent_offset = (size_t)-1,
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch .dependencies = imap_urlauth_setting_dependencies
f9511e684858bf5f6ac77ab12254b85b737beae8Stephan Bosch};