login-settings.c revision cca4ba2a504d70a9fe9fee37f8433997359de52c
c25356d5978632df6203437e1953bcb29e0c736fTimo Sirainen* Copyright (c) 2005-2013 Dovecot authors, see the included COPYING file */
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenstatic bool login_settings_check(void *_set, pool_t pool, const char **error_r);
105addcb709523868418cc3e3baad7ad3453a91eTimo Sirainen { type, #name, offsetof(struct login_settings, name), NULL }
aef92409cf369afdd2ecd81a4f80083cd4082f46Timo Sirainenstatic const struct setting_define login_setting_defines[] = {
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenstatic const struct login_settings login_default_settings = {
1175f27441385a7011629f295f42708f9a3a4ffcTimo Sirainen .login_log_format_elements = "user=<%u> method=%m rip=%r lip=%l mpid=%e %c session=<%{session}>",
232d5bef3c709e90e24f0874a36854b92187bb6cTimo Sirainenconst struct setting_parser_info login_setting_parser_info = {
faed8babca9914257f34fb2e603d74016d563b2dTimo Sirainenstatic const struct setting_parser_info *default_login_set_roots[] = {
e06c0b65c16ccce69bbee009ead14d7d3d17a256Timo Sirainenconst struct setting_parser_info **login_set_roots = default_login_set_roots;
e06c0b65c16ccce69bbee009ead14d7d3d17a256Timo Sirainenstatic struct master_service_settings_cache *set_cache;
838f56174b963779a88083a0d0e85b30d2d846e7Timo Sirainen/* <settings checks> */
894987bf45718f8849cc3898afdfb1ac3cfa2445Timo Sirainenstatic bool login_settings_check(void *_set, pool_t pool,
d143077bd518de129b8d446fb58e003903e50867Timo Sirainen p_strsplit(pool, set->login_log_format_elements, " ");
5a07b37a9df398b5189c14872a600384208ab74bTimo Sirainen/* </settings checks> */
5a07b37a9df398b5189c14872a600384208ab74bTimo Sirainenstatic const struct var_expand_table *
5a07b37a9df398b5189c14872a600384208ab74bTimo Sirainenlogin_set_var_expand_table(const struct master_service_settings_input *input)
6a19e109ee8c5a6f688da83a86a7f6abeb71abddTimo Sirainen static struct var_expand_table static_tab[] = {
1175f27441385a7011629f295f42708f9a3a4ffcTimo Sirainen tab[1].value = net_ip2addr(&input->remote_ip);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainenlogin_setting_dup(pool_t pool, const struct setting_parser_info *info,
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen if (!settings_check(info, pool, dest, &error)) {
2a6af811ea3de3cf9e2f15e446674dd21b0705f3Timo Sirainen const struct master_service_ssl_settings **ssl_set_r,
0d0451206a91e9f96e522075dce28a89adc2325dTimo Sirainen unsigned int i, count;
c680a6b35b459045e92814778908da5a93922107Timo Sirainen set_cache = master_service_settings_cache_init(master_service,
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen if (master_service_settings_cache_read(set_cache, &input, NULL,
5f78b33aa505b17e23cdf27b071a24e127b3db54Timo Sirainen i_fatal("Error reading configuration: %s", error);
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen cache_sets = master_service_settings_parser_get_others(master_service, parser);
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen for (count = 0; input.roots[count] != NULL; count++) ;
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen for (i = 0; i < count; i++)
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen sets[i] = login_setting_dup(pool, input.roots[i], cache_sets[i]);
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen settings_var_expand(&login_setting_parser_info, sets[0], pool,
95a1a5195d56f3cf5d1e529aad668f87ad3b979bTimo Sirainen login_setting_dup(pool, &master_service_ssl_setting_parser_info,