aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2026-05-07 19:55:12 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2026-05-07 19:55:12 +0000
commit13676f2923406d70489a28d8decf59cbd903e8ea (patch)
tree0452d0e3cdb1143d61470d1b6d822e484dceded6
parent0abe71af12ac88eed440bb7f5e6324e679ac5cf5 (diff)
downloadsmtpd-starttls-proxy-13676f2923406d70489a28d8decf59cbd903e8ea.tar.gz
Get back to the MX loop after a TLS failure before/during handshake
-rw-r--r--src/qmail-remote/qmail-remote.h4
-rw-r--r--src/qmail-remote/tls.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/src/qmail-remote/qmail-remote.h b/src/qmail-remote/qmail-remote.h
index 7b2bd98..9dae3f3 100644
--- a/src/qmail-remote/qmail-remote.h
+++ b/src/qmail-remote/qmail-remote.h
@@ -46,6 +46,8 @@ extern int smtproutes_match (smtproutes const *, char const *, stralloc *, size_
extern void smtproutes_free (smtproutes *) ;
-extern void run_tls (int, char const *, unsigned int, unsigned int, qmailr_tls const *, size_t, size_t const *, unsigned int, size_t, char const *) gccattr_noreturn ;
+ /* tls */
+
+extern void run_tls (int, char const *, unsigned int, unsigned int, qmailr_tls const *, size_t, size_t const *, unsigned int, size_t, char const *) ;
#endif
diff --git a/src/qmail-remote/tls.c b/src/qmail-remote/tls.c
index 9689578..309cb13 100644
--- a/src/qmail-remote/tls.c
+++ b/src/qmail-remote/tls.c
@@ -29,6 +29,8 @@ hates a child that doesn't exit 0 or 111.
and non-111 in important TLS failure cases that we want to report.
So instead of execing, we spawn it and stick around to translate
the exit code and the error message back to qmail-rspawn.
+ Also, this allows us to get back into the MX loop if we get a
+TLS error before/during the handshake.
*/
void run_tls (int fdr, char const *fmtip, unsigned int timeoutconnect, unsigned int timeoutremote, qmailr_tls const *qtls, size_t helopos, size_t const *eaddrpos, unsigned int n, size_t mxnamepos, char const *storage)
@@ -104,6 +106,7 @@ void run_tls (int fdr, char const *fmtip, unsigned int timeoutconnect, unsigned
char buf[4096] ;
size_t r = fd_read(p[0], buf, 4096) ;
if (r == -1) qmailr_tempusys("read from pipe") ;
+ if (WTERMSIG(wstat) == 96 || WTERMSIG(wstat) == 97) return ;
if (r)
{
if (r == 4096) r-- ;