From: Stephan Bosch Date: Sun, 24 Dec 2017 13:35:15 +0000 (+0100) Subject: lib-smtp: client: Fix rawlog input stream inconsistency by updating streams right... X-Git-Tag: 2.3.1~24 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b4534c9f0acb29c4e74feb3090af16f45bf19c2a;p=thirdparty%2Fdovecot%2Fcore.git lib-smtp: client: Fix rawlog input stream inconsistency by updating streams right after initializing TLS. 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. --- diff --git a/src/lib-smtp/smtp-client-connection.c b/src/lib-smtp/smtp-client-connection.c index 23294dd137..82b0d6e5ca 100644 --- a/src/lib-smtp/smtp-client-connection.c +++ b/src/lib-smtp/smtp-client-connection.c @@ -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) {