GnuTLS: more info on accept zero-error
authorJeremy Harris <jgh146exb@wizmail.org>
Mon, 8 Jun 2020 10:09:44 +0000 (11:09 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Thu, 11 Jun 2020 19:30:18 +0000 (20:30 +0100)
src/src/tls-gnu.c
test/log/2029
test/log/3454
test/log/5670

index fa489902a923229e33d48cdb1f892215a95be526..eff9e8859bdd3a28e9252e4e7b15bc633e090aaf 100644 (file)
@@ -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);
 
index 6d1107c7d7d7a7eadab87274f9522c61d5d12be5..b22a98af7962d4464b04e7937f1fe81d0b89fbbe 100644 (file)
@@ -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
index f14671d0d0a783f8c98fb6e4d30eb81cbc12f9b7..634fc42de34105bfeb7e7786160605f1e0a49e56 100644 (file)
@@ -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
index 9936c8592891b9765eec4de1bfaf35906338f3a0..23213f3e7836bef7b2994439556aee9b246224ed 100644 (file)
@@ -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