From bb5c3e33ce5a9351bd17cfbf8194d38de01f5697 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 8 Mar 2023 17:01:38 +0200 Subject: [PATCH] mail-crypt: Stop reading settings The settings can now be accessed without reading them again. --- src/plugins/mail-crypt/mail-crypt-pluginenv.c | 22 +++---------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/src/plugins/mail-crypt/mail-crypt-pluginenv.c b/src/plugins/mail-crypt/mail-crypt-pluginenv.c index c5ac66b06a..d271b1f816 100644 --- a/src/plugins/mail-crypt/mail-crypt-pluginenv.c +++ b/src/plugins/mail-crypt/mail-crypt-pluginenv.c @@ -9,24 +9,6 @@ #include "mail-crypt-key.h" #include "fs-crypt-settings.h" -static const struct fs_crypt_settings * -fs_crypt_load_settings(void) -{ - struct master_service_settings_input input; - struct master_service_settings_output output; - const char *error; - - i_zero(&input); - input.service = "fs-crypt"; - input.disable_check_settings = TRUE; - if (master_service_settings_read(master_service, &input, - &output, &error) < 0) - i_fatal("%s", error); - - return master_service_settings_get_or_fatal(NULL, - &fs_crypt_setting_parser_info); -} - static const char *mail_crypt_plugin_getenv(const struct fs_crypt_settings *set, const char *name) @@ -79,7 +61,9 @@ int mail_crypt_global_keys_load_pluginenv(const char *set_prefix, struct mail_crypt_global_keys *global_keys_r, const char **error_r) { - const struct fs_crypt_settings *set = fs_crypt_load_settings(); + const struct fs_crypt_settings *set = + master_service_settings_get_or_fatal(NULL, + &fs_crypt_setting_parser_info); const char *set_key = t_strconcat(set_prefix, "_public_key", NULL); const char *key_data = mail_crypt_plugin_getenv(set, set_key); -- 2.47.3