From 348051adc5ea922f4e82d971d44f03e87557b6ec Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sat, 3 May 2014 17:46:23 +0100 Subject: [PATCH] Restore testsuite operation on earlier GnuTLS libraries --- test/confs/5750 | 2 +- test/log/2002 | 2 +- test/log/5750 | 6 ++---- test/runtest | 3 +++ test/src/client.c | 37 ++++++++++++++++++++++--------------- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/test/confs/5750 b/test/confs/5750 index a4762bd19..daff91bb3 100644 --- a/test/confs/5750 +++ b/test/confs/5750 @@ -48,7 +48,7 @@ logger: logwrite = SA <${certextract {signature_algorithm}{$tls_out_peercert}}> logwrite = SG <${certextract {signature} {$tls_out_peercert}}> logwrite = ${certextract {subject_altname}{$tls_out_peercert}{SAN <$value>}{(no SAN)}} - logwrite = ${certextract {ocsp_uri} {$tls_out_peercert} {OCU <$value>}{(no OCU)}} +# logwrite = ${certextract {ocsp_uri} {$tls_out_peercert} {OCU <$value>}{(no OCU)}} logwrite = ${certextract {crl_uri} {$tls_out_peercert} {CRU <$value>}{(no CRU)}} diff --git a/test/log/2002 b/test/log/2002 index e2777b459..50b7863d2 100644 --- a/test/log/2002 +++ b/test/log/2002 @@ -14,7 +14,7 @@ 1999-03-02 09:44:33 IN 1999-03-02 09:44:33 NB 1999-03-02 09:44:33 NA -1999-03-02 09:44:33 SA +1999-03-02 09:44:33 SA 1999-03-02 09:44:33 SG <6c 37 41 26 4d 5d f4 b5 31 10 67 ca fb 64 b6 22 98 62 f7 1e 95 7b 6c e6 74 47 21 f4 5e 89 36 3e b9 9c 8a c5 52 bb c4 af 12 93 26 3b d7 3d e0 56 71 1e 1d 21 20 02 ed f0 4e d5 5e 45 42 fd 3c 38 41 54 83 86 0b 3b bf c5 47 39 ff 15 ea 93 dc fd c7 3d 18 58 59 ca dd 2a d8 b9 f9 2f b9 76 93 f4 ae e3 91 56 80 2f 8c 04 2f ad 57 ef d2 51 19 f4 b4 ef 32 9c ac 3a 7c 0d b8 39 db b1 e3 30 73 1a> 1999-03-02 09:44:33 SAN 1999-03-02 09:44:33 CRU diff --git a/test/log/5750 b/test/log/5750 index 8c98b5b95..c3c77a642 100644 --- a/test/log/5750 +++ b/test/log/5750 @@ -10,10 +10,9 @@ 1999-03-02 09:44:33 10HmaX-0005vi-00 IN 1999-03-02 09:44:33 10HmaX-0005vi-00 NB 1999-03-02 09:44:33 10HmaX-0005vi-00 NA -1999-03-02 09:44:33 10HmaX-0005vi-00 SA +1999-03-02 09:44:33 10HmaX-0005vi-00 SA 1999-03-02 09:44:33 10HmaX-0005vi-00 SG <56 3a a4 3c cb eb b8 27 c2 90 08 74 13 88 dc 48 c6 b5 2c e5 26 be 5b 91 d4 67 e7 3c 49 12 d7 47 30 df 98 db 58 ed 18 a8 7d 4b db 97 48 f5 5c 7f 70 b9 37 63 33 f1 24 62 72 92 60 f5 6e da b6 bc 73 c8 c2 dc d6 95 9a bd 16 16 a2 ef 0a f1 d7 41 68 f6 ad 98 5a d0 ff d9 1b 51 9f 59 ce 2f 3d 84 d0 ee e8 2b eb 9b 32 1a 0e 02 3e cc 30 89 44 09 2a 75 81 46 a7 b6 ed 7d 41 eb 5a 63 fa 9c 58 ef> 1999-03-02 09:44:33 10HmaX-0005vi-00 SAN -1999-03-02 09:44:33 10HmaX-0005vi-00 OCU 1999-03-02 09:44:33 10HmaX-0005vi-00 CRU 1999-03-02 09:44:33 10HmaX-0005vi-00 TLS session failure: delivering unencrypted to 127.0.0.1 [127.0.0.1] (not in hosts_require_tls) 1999-03-02 09:44:33 10HmaX-0005vi-00 => bad@test.ex R=client T=send_to_server H=127.0.0.1 [127.0.0.1] C="250 OK id=10HmaZ-0005vi-00" @@ -30,10 +29,9 @@ 1999-03-02 09:44:33 10HmaY-0005vi-00 IN 1999-03-02 09:44:33 10HmaY-0005vi-00 NB 1999-03-02 09:44:33 10HmaY-0005vi-00 NA -1999-03-02 09:44:33 10HmaY-0005vi-00 SA +1999-03-02 09:44:33 10HmaY-0005vi-00 SA 1999-03-02 09:44:33 10HmaY-0005vi-00 SG <56 3a a4 3c cb eb b8 27 c2 90 08 74 13 88 dc 48 c6 b5 2c e5 26 be 5b 91 d4 67 e7 3c 49 12 d7 47 30 df 98 db 58 ed 18 a8 7d 4b db 97 48 f5 5c 7f 70 b9 37 63 33 f1 24 62 72 92 60 f5 6e da b6 bc 73 c8 c2 dc d6 95 9a bd 16 16 a2 ef 0a f1 d7 41 68 f6 ad 98 5a d0 ff d9 1b 51 9f 59 ce 2f 3d 84 d0 ee e8 2b eb 9b 32 1a 0e 02 3e cc 30 89 44 09 2a 75 81 46 a7 b6 ed 7d 41 eb 5a 63 fa 9c 58 ef> 1999-03-02 09:44:33 10HmaY-0005vi-00 SAN -1999-03-02 09:44:33 10HmaY-0005vi-00 OCU 1999-03-02 09:44:33 10HmaY-0005vi-00 CRU 1999-03-02 09:44:33 10HmaY-0005vi-00 Completed 1999-03-02 09:44:33 End queue run: pid=pppp -qf diff --git a/test/runtest b/test/runtest index c6a365f25..458c9a659 100755 --- a/test/runtest +++ b/test/runtest @@ -543,6 +543,9 @@ RESET_AFTER_EXTRA_LINE_READ: s/TLS error on connection to \d{1,3}(.\d{1,3}){3} \[\d{1,3}(.\d{1,3}){3}\] \(gnutls_handshake\): A TLS packet with unexpected length was received./a TLS session is required for ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4], but an attempt to start TLS failed/g; s/TLS error on connection from \[127.0.0.1\] \(recv\): A TLS packet with unexpected length was received./TLS error on connection from [127.0.0.1] (recv): The TLS connection was non-properly terminated./g; + # signature algorithm names + s/RSA-SHA1/RSA_SHA/; + # ======== Caller's login, uid, gid, home, gecos ======== diff --git a/test/src/client.c b/test/src/client.c index be6bffbac..e7210f223 100644 --- a/test/src/client.c +++ b/test/src/client.c @@ -60,24 +60,27 @@ static int sigalrm_seen = 0; latter needs a whole pile of tables. */ #ifdef HAVE_OPENSSL -#define HAVE_TLS -#include -#include -#include -#include -#include -#include -#include +# define HAVE_TLS +# include +# include +# include +# include +# include +# include +# include #endif #ifdef HAVE_GNUTLS -#define HAVE_TLS -#include -#include -#include +# define HAVE_TLS +# include +# include +# if GNUTLS_VERSION_NUMBER >= 0x030103 +# define HAVE_OCSP +# include +# endif -#define DH_BITS 768 +# define DH_BITS 768 /* Local static variables for GNUTLS */ @@ -113,7 +116,7 @@ static const int mac_priority[16] = { static const int comp_priority[16] = { GNUTLS_COMP_NULL, 0 }; static const int cert_type_priority[16] = { GNUTLS_CRT_X509, 0 }; -#endif +#endif /*HAVE_GNUTLS*/ @@ -767,8 +770,10 @@ if (certfile != NULL) printf("Certificate file = %s\n", certfile); if (keyfile != NULL) printf("Key file = %s\n", keyfile); tls_init(certfile, keyfile); tls_session = tls_session_init(); +#ifdef HAVE_OCSP if (ocsp_stapling) gnutls_ocsp_status_request_enable_client(tls_session, NULL, 0, NULL); +#endif gnutls_transport_set_ptr(tls_session, (gnutls_transport_ptr)sock); /* When the server asks for a certificate and the client does not have one, @@ -803,7 +808,7 @@ if (tls_on_connect) if (!tls_active) printf("Failed to start TLS\n"); - #ifdef HAVE_GNUTLS + #if defined(HAVE_GNUTLS) && defined(HAVE_OCSP) else if ( ocsp_stapling && gnutls_ocsp_status_request_is_checked(tls_session, 0) == 0) printf("Failed to verify certificate status\n"); @@ -917,6 +922,7 @@ int rc; printf("Bad certificate\n"); fflush(stdout); } + #ifdef HAVE_OCSP else if (gnutls_ocsp_status_request_is_checked(tls_session, 0) == 0) { printf("Failed to verify certificate status\n"); @@ -938,6 +944,7 @@ int rc; } fflush(stdout); } + #endif } #endif else -- 2.25.1