]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: client: Fix segfault by making the initialization of the connection after...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Tue, 25 Sep 2018 22:26:32 +0000 (00:26 +0200)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Wed, 26 Sep 2018 09:21:06 +0000 (11:21 +0200)
Before, the connection was not guaranteed to be fully initialized after the SSL
handshake. The problem would occur when the handshake finished while writing the
SSL output stream.

src/lib-http/http-client-connection.c

index de6e1d62ca364584a16e938cefa819201e4392c8..d983ab6e1d333bfbc527d74491d1ed4c2d091b84 100644 (file)
@@ -979,8 +979,10 @@ static void http_client_connection_input(struct connection *_conn)
                        i_assert(ret == 0);
                        return;
                }
+       }
 
-               /* ready for first request */
+       if (!conn->connect_succeeded) {
+               /* just got ready for first request */
                http_client_connection_ready(conn);
        }
 
@@ -1353,6 +1355,7 @@ http_client_connection_ready(struct http_client_connection *conn)
        const struct http_client_settings *set = &peer->client->set;
 
        e_debug(conn->event, "Ready for requests");
+       i_assert(!conn->connect_succeeded);
 
        /* connected */
        conn->connected = TRUE;