From b28aa0de85b6b54ba40db198205e06c58c34022e Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 4 Dec 2025 14:42:01 +0000 Subject: bugfix: turn socket blocking before handing off to the TLS tunnel --- src/smtpd-starttls-proxy/smtpd-starttls-proxy-io.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/smtpd-starttls-proxy/smtpd-starttls-proxy-io.c b/src/smtpd-starttls-proxy/smtpd-starttls-proxy-io.c index e9ef7ab..98345a8 100644 --- a/src/smtpd-starttls-proxy/smtpd-starttls-proxy-io.c +++ b/src/smtpd-starttls-proxy/smtpd-starttls-proxy-io.c @@ -236,7 +236,7 @@ static void child (int fdr, int fdw) tain deadline ; PROG = "smtpd-starttls-proxy-io" ; - if (ndelay_on(0) < 0 || ndelay_on(1) < 0 || ndelay_on(fdr) < 0 || ndelay_on(fdw) < 0) + if (ndelay_on(0) == -1 || ndelay_on(1) == -1 || ndelay_on(fdr) == -1 || ndelay_on(fdw) == -1) strerr_diefu1sys(111, "make fds non-blocking") ; buffer_init(&io[1].in, &buffer_read, fdr, io[1].inbuf, INSIZE) ; buffer_init(&io[1].out, &buffer_write, fdw, io[1].outbuf, OUTSIZE) ; @@ -326,6 +326,8 @@ static void child (int fdr, int fdw) if (wantexec >= 2) { int got = 0 ; + if (ndelay_off(0) == -1 || ndelay_off(1) == -1) + strerr_diefu1sys(111, "make fds blocking") ; if (write(fdctl, "Y", 1) != 1) strerr_diefu1sys(111, "send ucspi-tls start command") ; fd_shutdown(fdctl, 1) ; -- cgit v1.3.1