imap-login-settings.c revision 64437b1b3d20f0ffd131ff6dc226699b493437d8
5f5870385cff47efd2f58e7892f251cf13761528Timo Sirainen/* Copyright (c) 2005-2012 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[] = {
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainen { "imap", "", 143, FALSE },
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainen { "imaps", "", 993, 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 = {
1b0c3a8709a6a849c5ab4bcefe78ece6d8189325Timo Sirainen imap_login_inet_listeners, sizeof(imap_login_inet_listeners), { 0, }
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),
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 = "",
64437b1b3d20f0ffd131ff6dc226699b493437d8Timo Sirainen .imap_id_send = "",
64437b1b3d20f0ffd131ff6dc226699b493437d8Timo Sirainen .imap_id_log = ""
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};