]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: client: Fix rawlog input stream inconsistency by updating streams right...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sun, 24 Dec 2017 13:35:15 +0000 (14:35 +0100)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Tue, 13 Mar 2018 18:22:01 +0000 (19:22 +0100)
Restructured the code to call a new function called smtp_client_connection_streams_changed() which performs all the necessary updates.
Before, enabling rawlog could break the TLS handshake.

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

index 23294dd13705dd80534dfef189cd603a56dbe8a9..82b0d6e5cab6858994041a456f5c3791f6a5bdc1 100644 (file)
@@ -1137,27 +1137,9 @@ static void smtp_client_connection_destroy(struct connection *_conn)
 static void
 smtp_client_connection_established(struct smtp_client_connection *conn)
 {
-       struct stat st;
-
        if (conn->to_connect != NULL)
                timeout_reset(conn->to_connect);
 
-       /* (re-)initialize rawlog */
-       if (conn->set.rawlog_dir != NULL &&
-           stat(conn->set.rawlog_dir, &st) == 0) {
-               iostream_rawlog_create(conn->set.rawlog_dir,
-                                      &conn->conn.input, &conn->conn.output);
-       }
-
-       /* create/update reply parser */
-       if (conn->reply_parser == NULL) {
-               conn->reply_parser = smtp_reply_parser_init(
-                       conn->conn.input, conn->set.max_reply_size);
-       } else {
-               smtp_reply_parser_set_stream(conn->reply_parser,
-                                            conn->conn.input);
-       }
-
        /* set flush callback */
        o_stream_set_flush_callback(conn->conn.output,
                smtp_client_connection_output, conn);
@@ -1344,6 +1326,7 @@ smtp_client_connection_connected(struct connection *_conn, bool success)
 
        conn->raw_input = conn->conn.input;
        conn->raw_output = conn->conn.output;
+       smtp_client_connection_streams_changed(conn);
 
        if (conn->ssl_mode == SMTP_CLIENT_SSL_MODE_IMMEDIATE) {
                if (smtp_client_connection_ssl_init(conn, &error) < 0) {