Blame SOURCES/postfix-2.10.1-haproxy-tls-fix.patch

30c5c5
diff --git a/src/smtpd/smtpd_haproxy.c b/src/smtpd/smtpd_haproxy.c
30c5c5
index 599e3ed..a4c527c 100644
30c5c5
--- a/src/smtpd/smtpd_haproxy.c
30c5c5
+++ b/src/smtpd/smtpd_haproxy.c
30c5c5
@@ -96,6 +96,14 @@ int     smtpd_peer_from_haproxy(SMTPD_STATE *state)
30c5c5
     VSTRING *escape_buf;
30c5c5
 
30c5c5
     /*
30c5c5
+     * While reading HAProxy handshake information, don't buffer input beyond
30c5c5
+     * the end-of-line. That would break the TLS wrappermode handshake.
30c5c5
+     */
30c5c5
+    vstream_control(state->client,
30c5c5
+		    VSTREAM_CTL_BUFSIZE, 1,
30c5c5
+		    VSTREAM_CTL_END);
30c5c5
+
30c5c5
+    /*
30c5c5
      * Note: the haproxy_srvr_parse() routine performs address protocol
30c5c5
      * checks, address and port syntax checks, and converts IPv4-in-IPv6
30c5c5
      * address string syntax (:ffff::1.2.3.4) to IPv4 syntax where permitted
30c5c5
@@ -142,6 +150,13 @@ int     smtpd_peer_from_haproxy(SMTPD_STATE *state)
30c5c5
 	 * Avoid surprises in the Dovecot authentication server.
30c5c5
 	 */
30c5c5
 	state->dest_addr = mystrdup(smtp_server_addr.buf);
30c5c5
+
30c5c5
+	/*
30c5c5
+	 * Enable normal buffering.
30c5c5
+	 */
30c5c5
+	vstream_control(state->client,
30c5c5
+			VSTREAM_CTL_BUFSIZE, VSTREAM_BUFSIZE,
30c5c5
+			VSTREAM_CTL_END);
30c5c5
 	return (0);
30c5c5
     }
30c5c5
 }