]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: pop3c - Copy SSL settings correctly
authorAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 27 Feb 2019 13:25:06 +0000 (15:25 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Thu, 21 Mar 2019 08:03:00 +0000 (10:03 +0200)
When attempting to use pop3c with immediate SSL, it would
crash due to invalid memory access during connection setup.
Also the SSL mode is not copied so SSL handshake is not attempted
at later stage.

Was broken in 01435c38e7 and ebcf7d6c92

src/lib-storage/index/pop3c/pop3c-client.c

index 42a15a2fcd012a12b387c2e6273bb04133357b2c..3005c421b1e531894e06dc38f2055eaf340d78ea 100644 (file)
@@ -93,7 +93,6 @@ struct pop3c_client *
 pop3c_client_init(const struct pop3c_client_settings *set)
 {
        struct pop3c_client *client;
-       struct ssl_iostream_settings ssl_set;
        const char *error;
        pool_t pool;
 
@@ -113,11 +112,12 @@ pop3c_client_init(const struct pop3c_client_settings *set)
                p_strdup(pool, set->dns_client_socket_path);
        client->set.temp_path_prefix = p_strdup(pool, set->temp_path_prefix);
        client->set.rawlog_dir = p_strdup(pool, set->rawlog_dir);
+       client->set.ssl_mode = set->ssl_mode;
 
        if (set->ssl_mode != POP3C_CLIENT_SSL_MODE_NONE) {
                ssl_iostream_settings_init_from(client->pool, &client->set.ssl_set, &set->ssl_set);
                client->set.ssl_set.verbose_invalid_cert = !client->set.ssl_set.allow_invalid_cert;
-               if (ssl_iostream_client_context_cache_get(&ssl_set,
+               if (ssl_iostream_client_context_cache_get(&set->ssl_set,
                                                          &client->ssl_ctx,
                                                          &error) < 0) {
                        i_error("pop3c(%s:%u): Couldn't initialize SSL context: %s",