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

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