login-settings.c revision 7bafda1813454621e03615e83d55bccfa7cc56bd
5f5870385cff47efd2f58e7892f251cf13761528Timo Sirainen/* Copyright (c) 2005-2009 Dovecot authors, see the included COPYING file */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen#include "common.h"
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen#include "hostpid.h"
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen#include "var-expand.h"
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen#include "settings-parser.h"
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen#include "master-service-settings.h"
5733207dc3ec10e6e5a6e0a8b30fbd1b061062b9Timo Sirainen#include "login-settings.h"
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen#include <stddef.h>
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen#include <unistd.h>
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainenstatic bool login_settings_check(void *_set, pool_t pool, const char **error_r);
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen#undef DEF
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen#define DEF(type, name) \
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen { type, #name, offsetof(struct login_settings, name), NULL }
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenstatic const struct setting_define login_setting_defines[] = {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_STR, login_trusted_networks),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_STR_VARS, login_greeting),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_STR, login_log_format_elements),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_STR, login_log_format),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_ENUM, ssl),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_STR, ssl_ca_file),
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen DEF(SET_STR, ssl_cert),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_STR, ssl_key),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_STR, ssl_key_password),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_STR, ssl_parameters_file),
5733207dc3ec10e6e5a6e0a8b30fbd1b061062b9Timo Sirainen DEF(SET_STR, ssl_cipher_list),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_STR, ssl_cert_username_field),
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen DEF(SET_BOOL, ssl_verify_client_cert),
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen DEF(SET_BOOL, ssl_require_client_cert),
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen DEF(SET_BOOL, ssl_username_from_cert),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_BOOL, verbose_ssl),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_BOOL, disable_plaintext_auth),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_BOOL, verbose_auth),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_BOOL, auth_debug),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_BOOL, verbose_proctitle),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen DEF(SET_UINT, mail_max_userip_connections),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen SETTING_DEFINE_LIST_END
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen};
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainenstatic const struct login_settings login_default_settings = {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .login_trusted_networks = "",
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .login_greeting = PACKAGE_NAME" ready.",
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .login_log_format_elements = "user=<%u> method=%m rip=%r lip=%l %c",
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .login_log_format = "%$: %s",
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .ssl = "yes:no:required",
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .ssl_ca_file = "",
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .ssl_cert = "",
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .ssl_key = "",
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .ssl_key_password = "",
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .ssl_parameters_file = "ssl-parameters.dat",
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .ssl_cipher_list = "ALL:!LOW:!SSLv2:!EXP:!aNULL",
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .ssl_cert_username_field = "commonName",
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .ssl_verify_client_cert = FALSE,
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen .ssl_require_client_cert = FALSE,
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen .ssl_username_from_cert = FALSE,
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen .verbose_ssl = FALSE,
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen .disable_plaintext_auth = TRUE,
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen .verbose_auth = FALSE,
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen .auth_debug = FALSE,
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen .verbose_proctitle = FALSE,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .mail_max_userip_connections = 10
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen};
2726de0d31ed0f1a1425e4c8d167f7681e07fc25Timo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenconst struct setting_parser_info login_setting_parser_info = {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .module_name = "login",
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .defines = login_setting_defines,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .defaults = &login_default_settings,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .type_offset = (size_t)-1,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .struct_size = sizeof(struct login_settings),
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .parent_offset = (size_t)-1,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen .check_func = login_settings_check
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen};
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainenstatic const struct setting_parser_info *default_login_set_roots[] = {
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen &login_setting_parser_info,
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen NULL
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen};
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainenconst struct setting_parser_info **login_set_roots = default_login_set_roots;
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen/* <settings checks> */
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainenstatic int ssl_settings_check(void *_set ATTR_UNUSED, const char **error_r)
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen{
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen struct login_settings *set = _set;
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen#ifndef HAVE_SSL
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen *error_r = t_strdup_printf("SSL support not compiled in but ssl=%s",
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen set->ssl);
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen return FALSE;
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen#else
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen if (*set->ssl_cert == '\0') {
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen *error_r = "ssl enabled, but ssl_cert not set";
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen return FALSE;
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen }
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen if (*set->ssl_key == '\0') {
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen *error_r = "ssl enabled, but ssl_key not set";
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen return FALSE;
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen }
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen if (set->ssl_verify_client_cert && *set->ssl_ca_file == '\0') {
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen *error_r = "ssl_verify_client_cert set, but ssl_ca_file not";
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen return FALSE;
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen }
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen#ifndef CONFIG_BINARY
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen if (*set->ssl_ca_file != '\0' && access(set->ssl_ca_file, R_OK) < 0) {
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen *error_r = t_strdup_printf("ssl_ca_file: access(%s) failed: %m",
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen set->ssl_ca_file);
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen return FALSE;
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen }
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen#endif
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen return TRUE;
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen#endif
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen}
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenstatic bool login_settings_check(void *_set, pool_t pool, const char **error_r)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen{
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct login_settings *set = _set;
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen set->log_format_elements_split =
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen p_strsplit(pool, set->login_log_format_elements, " ");
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen if (set->ssl_require_client_cert || set->ssl_username_from_cert) {
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen /* if we require valid cert, make sure we also ask for it */
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen set->ssl_verify_client_cert = TRUE;
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen }
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen if (strcmp(set->ssl, "no") == 0) {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen /* disabled */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen } else if (strcmp(set->ssl, "yes") == 0) {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen if (!ssl_settings_check(set, error_r))
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen return FALSE;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen } else if (strcmp(set->ssl, "required") == 0) {
b75feeb580a78d76188f66d589939b298da4b61bTimo Sirainen if (!ssl_settings_check(set, error_r))
00b6a40fd9f032914b41fe2cfe52d902db29829bTimo Sirainen return FALSE;
b75feeb580a78d76188f66d589939b298da4b61bTimo Sirainen set->disable_plaintext_auth = TRUE;
b75feeb580a78d76188f66d589939b298da4b61bTimo Sirainen } else {
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen *error_r = t_strdup_printf("Unknown ssl setting value: %s",
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen set->ssl);
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen return FALSE;
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen }
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen return TRUE;
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen}
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen/* </settings checks> */
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainenstatic const struct var_expand_table *
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainenlogin_set_var_expand_table(const struct master_service_settings_input *input)
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen{
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen static struct var_expand_table static_tab[] = {
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen { 'l', NULL, "lip" },
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen { 'r', NULL, "rip" },
b75feeb580a78d76188f66d589939b298da4b61bTimo Sirainen { 'p', NULL, "pid" },
b75feeb580a78d76188f66d589939b298da4b61bTimo Sirainen { 's', NULL, "service" },
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen { '\0', NULL, "hostname" },
447bf65ddb82ec279e7386828748ef47e199a6afTimo Sirainen { '\0', NULL, NULL }
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen };
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct var_expand_table *tab;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen tab = t_malloc(sizeof(static_tab));
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen memcpy(tab, static_tab, sizeof(static_tab));
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen tab[0].value = net_ip2addr(&input->local_ip);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen tab[1].value = net_ip2addr(&input->remote_ip);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen tab[2].value = my_pid;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen tab[3].value = input->service;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen tab[4].value = my_hostname;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen return tab;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen}
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenstruct login_settings *
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenlogin_settings_read(struct master_service *service, pool_t pool,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen const struct ip_addr *local_ip,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen const struct ip_addr *remote_ip,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen const char *local_host,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen void ***other_settings_r)
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen{
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen struct master_service_settings_input input;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen const char *error;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen void **sets;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen unsigned int i;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
5733207dc3ec10e6e5a6e0a8b30fbd1b061062b9Timo Sirainen memset(&input, 0, sizeof(input));
5733207dc3ec10e6e5a6e0a8b30fbd1b061062b9Timo Sirainen input.roots = login_set_roots;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen input.module = login_process_name;
5733207dc3ec10e6e5a6e0a8b30fbd1b061062b9Timo Sirainen input.service = login_protocol;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen input.local_host = local_host;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen if (local_ip != NULL)
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen input.local_ip = *local_ip;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen if (remote_ip != NULL)
7dd73e056c7d9976080393d9cd731f69111818eeTimo Sirainen input.remote_ip = *remote_ip;
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen /* this function always clears the previous settings pool. since we're
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen doing per-connection lookups, we always need to duplicate the
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen settings using another pool. */
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen if (master_service_settings_read(service, &input, &error) < 0)
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen i_fatal("Error reading configuration: %s", error);
dc1bc1685e4a0d58ae7bacaecc282d0ebde2d7daTimo Sirainen
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen sets = master_service_settings_get_others(service);
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen for (i = 0; sets[i] != NULL; i++) {
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen sets[i] = settings_dup(input.roots[i], sets[i], pool);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen if (!settings_check(input.roots[i], pool, sets[i], &error)) {
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen const char *name = input.roots[i]->module_name;
5733207dc3ec10e6e5a6e0a8b30fbd1b061062b9Timo Sirainen i_fatal("settings_check(%s) failed: %s",
5733207dc3ec10e6e5a6e0a8b30fbd1b061062b9Timo Sirainen name != NULL ? name : "unknown", error);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen }
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen }
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen settings_var_expand(&login_setting_parser_info, sets[0], pool,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen login_set_var_expand_table(&input));
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen *other_settings_r = sets + 1;
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen return sets[0];
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen}
b6b9c99fefbbc662bd9a0006566133c4480bf0e8Timo Sirainen