bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch/* Copyright (c) 2005-2018 Dovecot authors, see the included COPYING file */
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen#include "lib.h"
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainen#include "buffer.h"
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen#include "settings-parser.h"
9f0f2de10e4ea0c99052bf4b2bef8179f2536228Timo Sirainen#include "service-settings.h"
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen#include "login-settings.h"
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen#include "imap-login-settings.h"
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen#include <stddef.h>
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainen/* <settings checks> */
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainenstatic struct inet_listener_settings imap_login_inet_listeners_array[] = {
5d4c793b4e3dbc07f08daa4465594b1857f80725Timo Sirainen { .name = "imap", .address = "", .port = 143 },
5d4c793b4e3dbc07f08daa4465594b1857f80725Timo Sirainen { .name = "imaps", .address = "", .port = 993, .ssl = TRUE }
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainen};
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainenstatic struct inet_listener_settings *imap_login_inet_listeners[] = {
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainen &imap_login_inet_listeners_array[0],
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainen &imap_login_inet_listeners_array[1]
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainen};
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainenstatic buffer_t imap_login_inet_listeners_buf = {
da7f1a07f583df8905684a7b78469960afd7c78dPhil Carmody imap_login_inet_listeners, sizeof(imap_login_inet_listeners), { NULL, }
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainen};
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainen/* </settings checks> */
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainen
9f0f2de10e4ea0c99052bf4b2bef8179f2536228Timo Sirainenstruct service_settings imap_login_service_settings = {
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .name = "imap-login",
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .protocol = "imap",
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .type = "login",
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .executable = "imap-login",
b00adcd8d0ce70e855582c2ec64069aef4063293Timo Sirainen .user = "$default_login_user",
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .group = "",
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .privileged_group = "",
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .extra_groups = "",
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .chroot = "login",
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .drop_priv_before_exec = FALSE,
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .process_min_avail = 0,
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .process_limit = 0,
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .client_limit = 0,
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .service_count = 1,
93a7d1ee4b518b5c85f9721dc6539e4dab6aae00Timo Sirainen .idle_kill = 0,
ef56d74af7641298c506630cfba1a2ce197093c3Timo Sirainen .vsz_limit = (uoff_t)-1,
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .unix_listeners = ARRAY_INIT,
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .fifo_listeners = ARRAY_INIT,
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainen .inet_listeners = { { &imap_login_inet_listeners_buf,
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainen sizeof(imap_login_inet_listeners[0]) } }
9f0f2de10e4ea0c99052bf4b2bef8179f2536228Timo Sirainen};
9f0f2de10e4ea0c99052bf4b2bef8179f2536228Timo Sirainen
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen#undef DEF
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen#define DEF(type, name) \
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen { type, #name, offsetof(struct imap_login_settings, name), NULL }
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen
7744586e3e0fd60158abfbb03a233d3bd8d6c48bTimo Sirainenstatic const struct setting_define imap_login_setting_defines[] = {
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen DEF(SET_STR, imap_capability),
64437b1b3d20f0ffd131ff6dc226699b493437d8Timo Sirainen DEF(SET_STR, imap_id_send),
64437b1b3d20f0ffd131ff6dc226699b493437d8Timo Sirainen DEF(SET_STR, imap_id_log),
d8aa10df6d1dae56d3aa485708a34d74e9e31e79Stephan Bosch DEF(SET_BOOL, imap_literal_minus),
07142eb1dc6453bfc6206c14af7b6d3c3ec05eebAki Tuomi DEF(SET_BOOL, imap_id_retain),
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen SETTING_DEFINE_LIST_END
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen};
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen
7744586e3e0fd60158abfbb03a233d3bd8d6c48bTimo Sirainenstatic const struct imap_login_settings imap_login_default_settings = {
64437b1b3d20f0ffd131ff6dc226699b493437d8Timo Sirainen .imap_capability = "",
13eb655174f3857b38f4e3ac8658c82184715fd4Timo Sirainen .imap_id_send = "name *",
d8aa10df6d1dae56d3aa485708a34d74e9e31e79Stephan Bosch .imap_id_log = "",
07142eb1dc6453bfc6206c14af7b6d3c3ec05eebAki Tuomi .imap_literal_minus = FALSE,
07142eb1dc6453bfc6206c14af7b6d3c3ec05eebAki Tuomi .imap_id_retain = FALSE,
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen};
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen
7744586e3e0fd60158abfbb03a233d3bd8d6c48bTimo Sirainenstatic const struct setting_parser_info *imap_login_setting_dependencies[] = {
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen &login_setting_parser_info,
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen NULL
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen};
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen
7744586e3e0fd60158abfbb03a233d3bd8d6c48bTimo Sirainenstatic const struct setting_parser_info imap_login_setting_parser_info = {
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .module_name = "imap-login",
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .defines = imap_login_setting_defines,
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .defaults = &imap_login_default_settings,
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .type_offset = (size_t)-1,
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .struct_size = sizeof(struct imap_login_settings),
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .parent_offset = (size_t)-1,
7bafda1813454621e03615e83d55bccfa7cc56bdTimo Sirainen .dependencies = imap_login_setting_dependencies
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen};
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainenconst struct setting_parser_info *imap_login_setting_roots[] = {
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen &login_setting_parser_info,
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen &imap_login_setting_parser_info,
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen NULL
f059a046515f4b2b15a6c2a10a6f12f6166e39a5Timo Sirainen};