]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
auth: Stop reading settings multiple times
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 27 Mar 2023 10:10:01 +0000 (13:10 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 20 Nov 2023 12:20:55 +0000 (14:20 +0200)
src/auth/auth-settings.c
src/auth/auth-settings.h
src/auth/auth.c
src/auth/main.c

index ffb883b7bd037e45691aabd09120983d1b562838..82a598ccf8d0f7bb1f8cdfbc2f191f813d94d180 100644 (file)
@@ -544,20 +544,20 @@ auth_userdb_settings_check(void *_set, pool_t pool ATTR_UNUSED,
 
 const struct auth_settings *global_auth_settings;
 
-const struct auth_settings *
-auth_settings_read(const char *service,
-                  struct master_service_settings_output *output_r)
+void auth_settings_read(struct master_service_settings_output *output_r)
 {
        struct master_service_settings_input input;
        const char *error;
 
        i_zero(&input);
-       input.service = service;
        input.disable_check_settings = TRUE;
        if (master_service_settings_read(master_service, &input,
                                         output_r, &error) < 0)
                i_fatal("%s", error);
+}
 
+const struct auth_settings *auth_settings_get(const char *service)
+{
        struct event *event = event_create(NULL);
        event_add_str(event, "protocol", service);
        const struct auth_settings *set =
index 6c921205c60b9aec7c524253fa7447f52b8976dd..df1a94df5c6447b15564e61adb34b3bdd3f4f0f6 100644 (file)
@@ -101,9 +101,7 @@ struct auth_settings {
 extern const struct setting_parser_info auth_setting_parser_info;
 extern const struct auth_settings *global_auth_settings;
 
-const struct auth_settings *
-auth_settings_read(const char *service,
-                  struct master_service_settings_output *output_r)
-       ATTR_NULL(1);
+void auth_settings_read(struct master_service_settings_output *output_r);
+const struct auth_settings *auth_settings_get(const char *service);
 
 #endif
index 7785906ef2181e806ab707099a4422120d77a08f..72784daf2c1672ecb8de62ac94ca28aa3d9a6d8f 100644 (file)
@@ -407,7 +407,6 @@ void auths_preinit(const struct auth_settings *set,
                   const struct mechanisms_register *reg,
                   const char *const *services)
 {
-       struct master_service_settings_output set_output;
        const struct auth_settings *service_set;
        struct auth *auth;
        unsigned int i;
@@ -431,7 +430,7 @@ void auths_preinit(const struct auth_settings *set,
                        }
                        not_service = services[i];
                }
-               service_set = auth_settings_read(services[i], &set_output);
+               service_set = auth_settings_get(services[i]);
                auth = auth_preinit(service_set, services[i], reg);
                array_push_back(&auths, &auth);
        }
index 79f6f70b00a772e1a1230f4408f8639be1046b60..7455d318f3f75dd3a075ea45c3f7202cae897844 100644 (file)
@@ -89,7 +89,8 @@ static const char *const *read_global_settings(void)
 {
        struct master_service_settings_output set_output;
 
-       global_auth_settings = auth_settings_read(NULL, &set_output);
+       auth_settings_read(&set_output);
+       global_auth_settings = auth_settings_get(NULL);
        if (set_output.specific_services == NULL)
                return t_new(const char *, 1);
        return set_output.specific_services;