From 157a7880a444b89c2c67e4076b697435a7e60f6a Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sat, 21 May 2016 15:14:15 +0100 Subject: [PATCH] Testsuite: GnuTLS server TLD startup errors testcase --- src/src/tls-gnu.c | 4 +--- test/confs/2034 | 1 + test/log/2034 | 4 ++++ test/scripts/2000-GnuTLS/2034 | 34 ++++++++++++++++++++++++++++ test/stdout/2034 | 42 +++++++++++++++++++++++++++++++++++ 5 files changed, 82 insertions(+), 3 deletions(-) create mode 120000 test/confs/2034 create mode 100644 test/log/2034 create mode 100644 test/scripts/2000-GnuTLS/2034 create mode 100644 test/stdout/2034 diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c index 45ee1017a..c7c6b2674 100644 --- a/src/src/tls-gnu.c +++ b/src/src/tls-gnu.c @@ -1826,10 +1826,8 @@ state->fd_out = fileno(smtp_out); sigalrm_seen = FALSE; if (smtp_receive_timeout > 0) alarm(smtp_receive_timeout); do - { rc = gnutls_handshake(state->session); - } while ((rc == GNUTLS_E_AGAIN) || - (rc == GNUTLS_E_INTERRUPTED && !sigalrm_seen)); +while (rc == GNUTLS_E_AGAIN || rc == GNUTLS_E_INTERRUPTED && !sigalrm_seen); alarm(0); if (rc != GNUTLS_E_SUCCESS) diff --git a/test/confs/2034 b/test/confs/2034 new file mode 120000 index 000000000..6d0f5c2f1 --- /dev/null +++ b/test/confs/2034 @@ -0,0 +1 @@ +2006 \ No newline at end of file diff --git a/test/log/2034 b/test/log/2034 new file mode 100644 index 000000000..f59667e7a --- /dev/null +++ b/test/log/2034 @@ -0,0 +1,4 @@ +1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225 +1999-03-02 09:44:33 TLS error on connection from (rhu.barb) [127.0.0.1] (gnutls_handshake): timed out +1999-03-02 09:44:33 SMTP command timeout on connection from (rhu.barb) [127.0.0.1] +1999-03-02 09:44:33 TLS error on connection from (rhu.barb) [127.0.0.1] (gnutls_handshake): An unexpected TLS packet was received. diff --git a/test/scripts/2000-GnuTLS/2034 b/test/scripts/2000-GnuTLS/2034 new file mode 100644 index 000000000..b03c60d93 --- /dev/null +++ b/test/scripts/2000-GnuTLS/2034 @@ -0,0 +1,34 @@ +# TLS server: error in TLS session startup +gnutls +exim -DSERVER=server -bd -oX PORT_D +**** +# timeout case +client 127.0.0.1 PORT_D +??? 220 +ehlo rhu.barb +??? 250- +??? 250- +??? 250- +??? 250- +??? 250- +??? 250 +starttls +??? 220 ++++ 3 +**** +# +# bad TLS negotiation case +client 127.0.0.1 PORT_D +??? 220 +ehlo rhu.barb +??? 250- +??? 250- +??? 250- +??? 250- +??? 250- +??? 250 +starttls +??? 220 +bogus +**** +killdaemon diff --git a/test/stdout/2034 b/test/stdout/2034 new file mode 100644 index 000000000..94531616d --- /dev/null +++ b/test/stdout/2034 @@ -0,0 +1,42 @@ +Connecting to 127.0.0.1 port 1225 ... connected +??? 220 +<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000 +>>> ehlo rhu.barb +??? 250- +<<< 250-myhost.test.ex Hello rhu.barb [127.0.0.1] +??? 250- +<<< 250-SIZE 52428800 +??? 250- +<<< 250-8BITMIME +??? 250- +<<< 250-PIPELINING +??? 250- +<<< 250-STARTTLS +??? 250 +<<< 250 HELP +>>> starttls +??? 220 +<<< 220 TLS go ahead ++++ 3 +End of script +Connecting to 127.0.0.1 port 1225 ... connected +??? 220 +<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000 +>>> ehlo rhu.barb +??? 250- +<<< 250-myhost.test.ex Hello rhu.barb [127.0.0.1] +??? 250- +<<< 250-SIZE 52428800 +??? 250- +<<< 250-8BITMIME +??? 250- +<<< 250-PIPELINING +??? 250- +<<< 250-STARTTLS +??? 250 +<<< 250 HELP +>>> starttls +??? 220 +<<< 220 TLS go ahead +>>> bogus +End of script -- 2.30.2