]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
global: Avoid specifying http_client_settings.ssl when possible
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 16 Jun 2023 14:35:11 +0000 (17:35 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 12 Feb 2025 10:34:09 +0000 (12:34 +0200)
lib-http will now automatically pull the ssl settings.

src/auth/auth-policy.c
src/lib-lua/dlua-dovecot-http.c
src/plugins/fts-solr/fts-backend-solr.c
src/plugins/fts-solr/solr-connection.c
src/plugins/fts-solr/solr-connection.h
src/plugins/fts/fts-parser-tika.c
src/plugins/push-notification/push-notification-driver-ox.c
src/stats/event-exporter-transport-http-post.c
src/stats/main.c
src/stats/stats-common.h
src/stats/test-stats-common.c

index 33f169172c1e0ab39edb6873a78ebf7eef5aa9e5..eee7fbd3740437920b3cacfcbbfd1b5e5085e985 100644 (file)
@@ -154,20 +154,13 @@ auth_policy_open_and_close_to_key(struct json_ostream *json_output,
 
 void auth_policy_init(void)
 {
-       const struct ssl_settings *ssl_set =
-               settings_get_or_fatal(master_service_get_event(master_service),
-                       &ssl_setting_parser_info);
-
        http_client_set.request_absolute_timeout_msecs =
                global_auth_settings->policy_server_timeout_msecs;
        if (global_auth_settings->debug)
                http_client_set.debug = 1;
 
-       ssl_client_settings_to_iostream_set(ssl_set, &http_client_set.ssl);
        http_client_set.event_parent = auth_event;
        http_client = http_client_init(&http_client_set);
-       settings_free(ssl_set);
-       settings_free(http_client_set.ssl);
 
        /* prepare template */
 
index fe44d482718d1e9deb076610bf4b0340242f3a5a..43bfd68a5ba1f9c771acda6b6f4560c8b306728d 100644 (file)
@@ -385,9 +385,6 @@ static int dlua_http_request_new(lua_State *L)
                return -1;
        }
 
-       if (http_url->have_ssl && client->set.ssl == NULL) {
-               return luaL_error(L, "TLS not enabled, cannot submit https request");
-       }
        http_req = http_client_request_url(client, method, http_url,
                                           dlua_http_request_callback, L);
 
@@ -530,19 +527,10 @@ static int dlua_http_client_new(lua_State *L)
 
        i_zero(&http_set);
 
-       struct dlua_script *script = dlua_script_from_state(L);
        if (parse_client_settings(L, &http_set, &error) < 0)
                luaL_error(L, "Invalid HTTP client setting: %s", error);
 
-       const struct ssl_settings *ssl_set;
-       if (settings_get(script->event, &ssl_setting_parser_info,
-                        0, &ssl_set, &error) < 0)
-               luaL_error(L, "%s", error);
-       ssl_client_settings_to_iostream_set(ssl_set, &http_set.ssl);
-       settings_free(ssl_set);
-
        client = http_client_init(&http_set);
-       settings_free(http_set.ssl);
        dlua_push_http_client(L, client);
        return 1;
 }
index 6174909f2b7c4d19c3c88a20c25a3540091f8d79..afb6e8c63cbb03a988ae181aa8d570cefeb513f2 100644 (file)
@@ -192,8 +192,7 @@ fts_backend_solr_init(struct fts_backend *_backend, const char **error_r)
                _backend->flags |= FTS_BACKEND_FLAG_TOKENIZED_INPUT;
        }
 
-       return solr_connection_init(&fuser->set, _backend->ns->user->ssl_set,
-                                   _backend->event,
+       return solr_connection_init(&fuser->set, _backend->event,
                                    &backend->solr_conn, error_r);
 }
 
index 6d8108f10a8cd1cd6026e1a52bb7ce927dae65f2..d6ef9736e5f8a62f974da75b8f8eb3b23f21e3ae 100644 (file)
@@ -64,7 +64,6 @@ static char *solr_connection_create_http_base_url(struct http_url *http_url)
 }
 
 int solr_connection_init(const struct fts_solr_settings *solr_set,
-                        const struct ssl_iostream_settings *ssl_client_set,
                         struct event *event_parent,
                         struct solr_connection **conn_r, const char **error_r)
 {
@@ -104,7 +103,6 @@ int solr_connection_init(const struct fts_solr_settings *solr_set,
                http_set.max_attempts = 3;
                http_set.connect_timeout_msecs = 5*1000;
                http_set.request_timeout_msecs = 60*1000;
-               http_set.ssl = ssl_client_set;
                http_set.debug = solr_set->debug;
                http_set.rawlog_dir = solr_set->rawlog_dir;
                http_set.event_parent = conn->event;
index ebad8be390fa744a8d91fd4df69c4fc50b0f66cb..ecca737cbc431651472726ca163e902a6f8ce136 100644 (file)
@@ -7,7 +7,6 @@ struct solr_connection;
 struct fts_solr_settings;
 
 int solr_connection_init(const struct fts_solr_settings *solr_set,
-                        const struct ssl_iostream_settings *ssl_client_set,
                         struct event *event_parent,
                         struct solr_connection **conn_r,
                         const char **error_r);
index f9b234e067b8d9c6f27655c593f7f38bf8b51afe..cfbc82045d8b3681b6713ede5630c0108597a976 100644 (file)
@@ -73,7 +73,6 @@ tika_get_http_client_url(struct fts_parser_context *parser_context, struct http_
                http_set.max_attempts = 3;
                http_set.connect_timeout_msecs = 5*1000;
                http_set.request_timeout_msecs = 60*1000;
-               http_set.ssl = user->ssl_set;
                http_set.debug = event_want_debug(user->event);
                http_set.event_parent = user->event;
 
index 047d40ea5aacc1a06180f6ab5f6898caf9b75d82..14a5e1bc05e5b75fb9dff748e8e31cb3243cbb99 100644 (file)
@@ -73,7 +73,6 @@ push_notification_driver_ox_init_global(
                http_set.max_attempts = config->http_max_retries+1;
                http_set.request_timeout_msecs = config->http_timeout_msecs;
                http_set.event_parent = user->event;
-               http_set.ssl = user->ssl_set;
 
                ox_global->http_client = http_client_init(&http_set);
        }
index 0f1291ac0770b880613220b983f7737bb2fcf57f..b6d978ef0759876db3549f2ac340c673b593a9b6 100644 (file)
@@ -54,10 +54,7 @@ void event_export_transport_http_post(const struct exporter *exporter,
                struct http_client_settings set = {
                        .dns_client_socket_path = "dns-client",
                };
-               if (ssl_set != NULL)
-                       ssl_client_settings_to_iostream_set(ssl_set, &set.ssl);
                exporter_http_client = http_client_init(&set);
-               settings_free(set.ssl);
        }
 
        req = http_client_request_url_str(exporter_http_client, "POST",
index d92988a9d048ab2bacf2d8abec5de16e6fc90a1b..4d944e78189020a6bfa9acacc781eb1671bc7e81 100644 (file)
@@ -15,7 +15,6 @@
 #include "client-reader.h"
 #include "client-http.h"
 
-const struct ssl_settings *ssl_set;
 struct stats_metrics *stats_metrics;
 time_t stats_startup_time;
 
@@ -52,9 +51,6 @@ static void main_init(void)
        stats_settings =
                settings_get_or_fatal(master_service_get_event(master_service),
                                      &stats_setting_parser_info);
-       ssl_set =
-               settings_get_or_fatal(master_service_get_event(master_service),
-                                     &ssl_setting_parser_info);
 
        stats_startup_time = ioloop_time;
        if (stats_metrics_init(master_service_get_event(master_service),
@@ -76,7 +72,6 @@ static void main_deinit(void)
        stats_event_categories_deinit();
        stats_metrics_deinit(&stats_metrics);
        settings_free(stats_settings);
-       settings_free(ssl_set);
 }
 
 int main(int argc, char *argv[])
index 682b407f597c8bdb91465cfe3600777d4f46cf05..09af424a98fbb2c0c61d0cec8520a16188cd58e4 100644 (file)
@@ -4,7 +4,6 @@
 #include "lib.h"
 #include "stats-settings.h"
 
-extern const struct ssl_settings *ssl_set;
 extern struct stats_metrics *stats_metrics;
 extern time_t stats_startup_time;
 
index e11d5e119cd6360ad0e55e14f9eb7721c07b8a75..f4b91add668f10b89ad6416f88ea16955b25cd91 100644 (file)
@@ -15,7 +15,6 @@ struct event_category child_test_category = {
 };
 
 pool_t test_pool;
-const struct ssl_settings *ssl_set = NULL;
 struct stats_metrics *stats_metrics = NULL;
 time_t stats_startup_time;