X-Git-Url: https://git.exim.org/users/heiko/exim.git/blobdiff_plain/ce80533b305c56d57cb7ec1484491f191132cf84..5dcadbf4edc474a0e55a3caaa3604ed06b6a3926:/test/src/client.c?ds=inline diff --git a/test/src/client.c b/test/src/client.c index 5b998e269..de36ef065 100644 --- a/test/src/client.c +++ b/test/src/client.c @@ -429,7 +429,7 @@ if (certificate != NULL) { rc = gnutls_certificate_set_x509_key_file(x509_cred, CS certificate, CS privatekey, GNUTLS_X509_FMT_PEM); - if (rc < 0) gnutls_error("gnutls_certificate", rc); + if (rc < 0) gnutls_error(US"gnutls_certificate", rc); } /* Associate the parameters with the x509 credentials structure. */ @@ -569,12 +569,31 @@ nextinput: alarm(timeout); if (srv->tls_active) { - #ifdef HAVE_OPENSSL +#ifdef HAVE_OPENSSL + int error; rc = SSL_read(srv->ssl, inbuffer, bsiz - 1); - #endif - #ifdef HAVE_GNUTLS + if (rc <= 0) + switch (error = SSL_get_error(srv->ssl, rc)) + { + case SSL_ERROR_ZERO_RETURN: + break; + case SSL_ERROR_SYSCALL: + printf("%s\n", ERR_error_string(ERR_get_error(), NULL)); break; + rc = -1; + case SSL_ERROR_SSL: + printf("%s\n", ERR_error_string(ERR_get_error(), NULL)); break; + SSL_shutdown(srv->ssl); + SSL_free(srv->ssl); + srv->tls_active = FALSE; + goto nextinput; + default: + printf("SSL error code %d\n", error); + } + +#endif +#ifdef HAVE_GNUTLS rc = gnutls_record_recv(tls_session, CS inbuffer, bsiz - 1); - #endif +#endif } else rc = read(srv->sock, inbuffer, bsiz); @@ -591,6 +610,8 @@ nextinput: printf("Expected EOF read\n"); continue; } + else if (resp_optional) + continue; /* next scriptline */ else { printf("Unexpected EOF read\n"); @@ -1169,7 +1190,7 @@ SSL_CTX_set_info_callback(srv.ctx, (void (*)())info_callback); #ifdef HAVE_GNUTLS if (certfile != NULL) printf("Certificate file = %s\n", certfile); if (keyfile != NULL) printf("Key file = %s\n", keyfile); -tls_init(certfile, keyfile); +tls_init(US certfile, US keyfile); tls_session = tls_session_init(); #ifdef HAVE_OCSP if (ocsp_stapling)