From f6fa370ab8cc56cf06e906a1a2c714d196aac81b Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Mon, 8 Jun 2020 11:09:44 +0100 Subject: [PATCH] GnuTLS: more info on accept zero-error --- src/src/tls-gnu.c | 13 ++++++++----- test/log/2029 | 2 +- test/log/3454 | 2 +- test/log/5670 | 2 +- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c index fa489902a..eff9e8859 100644 --- a/src/src/tls-gnu.c +++ b/src/src/tls-gnu.c @@ -424,11 +424,14 @@ record_io_error(exim_gnutls_state_st *state, int rc, uschar *when, uschar *text) const uschar * msg; uschar * errstr; -if (rc == GNUTLS_E_FATAL_ALERT_RECEIVED) - msg = string_sprintf("A TLS fatal alert has been received: %s", - US gnutls_alert_get_name(gnutls_alert_get(state->session))); -else - msg = US gnutls_strerror(rc); +msg = rc == GNUTLS_E_FATAL_ALERT_RECEIVED + ? string_sprintf("A TLS fatal alert has been received: %s", + US gnutls_alert_get_name(gnutls_alert_get(state->session))) + : rc == GNUTLS_E_PREMATURE_TERMINATION && errno + ? errno == ECONNRESET /* Outlook does this to us right after sending us QUIT */ + ? string_sprintf("syscall: %s", strerror(errno)) + : string_sprintf("%s: syscall: %s", US gnutls_strerror(rc), strerror(errno)) + : US gnutls_strerror(rc); (void) tls_error(when, msg, state->host, &errstr); diff --git a/test/log/2029 b/test/log/2029 index 6d1107c7d..b22a98af7 100644 --- a/test/log/2029 +++ b/test/log/2029 @@ -1,5 +1,5 @@ ******** SERVER ******** 1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D -1999-03-02 09:44:33 10HmaX-0005vi-00 TLS error on connection from [127.0.0.1] (recv): The TLS connection was non-properly terminated. +1999-03-02 09:44:33 10HmaX-0005vi-00 TLS error on connection from [127.0.0.1] (recv): The TLS connection was non-properly terminated.: syscall: No such file or directory 1999-03-02 09:44:33 10HmaX-0005vi-00 SMTP connection lost after final dot H=[127.0.0.1] P=smtps diff --git a/test/log/3454 b/test/log/3454 index f14671d0d..634fc42de 100644 --- a/test/log/3454 +++ b/test/log/3454 @@ -1,6 +1,6 @@ ******** SERVER ******** 1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D -1999-03-02 09:44:33 TLS error on connection from [127.0.0.1] (recv): The TLS connection was non-properly terminated. +1999-03-02 09:44:33 TLS error on connection from [127.0.0.1] (recv): The TLS connection was non-properly terminated.: syscall: Permission denied 1999-03-02 09:44:33 no MAIL in SMTP connection from [127.0.0.1] D=qqs X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no C=EHLO,STARTTLS,AUTH 1999-03-02 09:44:33 no MAIL in SMTP connection from (foobar) [127.0.0.1] D=qqs A=plain:userx X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no C=EHLO,STARTTLS,EHLO,AUTH,QUIT diff --git a/test/log/5670 b/test/log/5670 index 9936c8592..23213f3e7 100644 --- a/test/log/5670 +++ b/test/log/5670 @@ -21,4 +21,4 @@ 1999-03-02 09:44:33 acl_mail: ocsp in status: 1 (notresp) 1999-03-02 09:44:33 10HmbA-0005vi-00 <= <> H=localhost (server1.example.com) [127.0.0.1] P=esmtps X=TLS1.x:ke-RSA-AES256-SHAnnn:xxx CV=no S=sss id=E10HmaZ-0005vi-00@server1.example.com 1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D -1999-03-02 09:44:33 TLS error on connection from localhost [127.0.0.1] (recv): The TLS connection was non-properly terminated. +1999-03-02 09:44:33 TLS error on connection from localhost [127.0.0.1] (recv): The TLS connection was non-properly terminated.: syscall: Permission denied -- 2.30.2