]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
login-common: Extract client_reload_settings()
authorAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 4 Aug 2025 14:47:21 +0000 (17:47 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 7 Aug 2025 11:47:01 +0000 (14:47 +0300)
src/login-common/client-common.c
src/login-common/client-common.h

index 8e15d2658609b654d011db79152a81725a46d04e..508b799d0061824a3b3e5bb26c3d4c6ccea7f190 100644 (file)
@@ -704,18 +704,8 @@ void clients_destroy_all(void)
        clients_destroy_all_reason(MASTER_SERVICE_SHUTTING_DOWN_MSG);
 }
 
-int client_sni_callback(const char *name, const char **error_r,
-                       void *context)
+int client_settings_reload(struct client *client, const char **error_r)
 {
-       struct client *client = context;
-       struct ssl_iostream_context *ssl_ctx;
-       const struct ssl_iostream_settings *ssl_set;
-       int ret;
-
-       if (client->ssl_servername_settings_read)
-               return 0;
-       client->ssl_servername_settings_read = TRUE;
-
        const struct login_settings *old_set = client->set;
        const struct ssl_settings *old_ssl_set = client->ssl_set;
        const struct ssl_server_settings *old_ssl_server_set =
@@ -724,11 +714,6 @@ int client_sni_callback(const char *name, const char **error_r,
        client->ssl_set = NULL;
        client->ssl_server_set = NULL;
 
-       /* Add local_name also to event. This is especially important to get
-          local_name { .. } config filters to work when looking up the settings
-          again. */
-       event_add_str(client->event, "local_name", name);
-       client->local_name = p_strdup(client->pool, name);
        if (client_settings_get(client, error_r) < 0 ||
            (client->v.reload_config != NULL &&
             client->v.reload_config(client, error_r) < 0)) {
@@ -743,6 +728,28 @@ int client_sni_callback(const char *name, const char **error_r,
        settings_free(old_set);
        settings_free(old_ssl_set);
        settings_free(old_ssl_server_set);
+       return 0;
+}
+
+int client_sni_callback(const char *name, const char **error_r,
+                       void *context)
+{
+       struct client *client = context;
+       struct ssl_iostream_context *ssl_ctx;
+       const struct ssl_iostream_settings *ssl_set;
+       int ret;
+
+       if (client->ssl_servername_settings_read)
+               return 0;
+       client->ssl_servername_settings_read = TRUE;
+
+       /* Add local_name also to event. This is especially important to get
+          local_name { .. } config filters to work when looking up the settings
+          again. */
+       event_add_str(client->event, "local_name", name);
+       client->local_name = p_strdup(client->pool, name);
+       if (client_settings_reload(client, error_r) < 0)
+               return -1;
 
        ssl_server_settings_to_iostream_set(client->ssl_set,
                client->ssl_server_set, &ssl_set);
index d3a5f8722480a4d39ddfdccdc220a893b7bbbd6c..4a836729243ec34ad8cada94aecdeaf29f3bf025 100644 (file)
@@ -357,6 +357,9 @@ void client_destroy_success(struct client *client, const char *reason);
 void client_ref(struct client *client);
 bool client_unref(struct client **client) ATTR_NOWARN_UNUSED_RESULT;
 
+int client_settings_reload(struct client *client, const char **error_r)
+       ATTR_WARN_UNUSED_RESULT;
+
 void client_rawlog_init(struct client *client);
 void client_rawlog_deinit(struct client *client);