X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Ftls-gnu.c;h=72f1787176a83dfff8674bdee74684d987765902;hb=a5dc727afcc92deab722a84ae5cf3d00ae74c5f6;hp=e28ad9b9d4dd773a0a9e0cf717ed5e6fa93d2964;hpb=8f9adfd36222d4e9e730734e00dffe874073e5b4;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c index e28ad9b9d..72f178717 100644 --- a/src/src/tls-gnu.c +++ b/src/src/tls-gnu.c @@ -53,6 +53,9 @@ require current GnuTLS, then we'll drop support for the ancient libraries). # warning "GnuTLS library version too old; tls:cert event unsupported" # define DISABLE_EVENT #endif +#if GNUTLS_VERSION_NUMBER >= 0x030000 +# define SUPPORT_SELFSIGN /* Uncertain what version is first usable but 2.12.23 is not */ +#endif #if GNUTLS_VERSION_NUMBER >= 0x030306 # define SUPPORT_CA_DIR #else @@ -824,13 +827,19 @@ gnutls_x509_privkey_t pkey = NULL; const uschar * where; int rc; +#ifndef SUPPORT_SELFSIGN +where = US"library too old"; +rc = GNUTLS_E_NO_CERTIFICATE_FOUND; +if (TRUE) goto err; +#endif + where = US"initialising pkey"; if ((rc = gnutls_x509_privkey_init(&pkey))) goto err; where = US"initialising cert"; if ((rc = gnutls_x509_crt_init(&cert))) goto err; -where = US"generating pkey"; +where = US"generating pkey"; /* Hangs on 2.12.23 */ if ((rc = gnutls_x509_privkey_generate(pkey, GNUTLS_PK_RSA, #ifdef SUPPORT_PARAM_TO_PK_BITS # ifndef GNUTLS_SEC_PARAM_MEDIUM @@ -3405,22 +3414,21 @@ if (len > INT_MAX) if (!more && state->corked) { DEBUG(D_tls) debug_printf("gnutls_record_uncork(session=%p)\n", state->session); - do { - do - /* We can't use GNUTLS_RECORD_WAIT here, as it retries on - GNUTLS_E_AGAIN || GNUTLS_E_INTR, which would break our timeout set by alarm(). - The GNUTLS_E_AGAIN should not happen ever, as our sockets are blocking anyway. - But who knows. (That all relies on the fact that GNUTLS_E_INTR and GNUTLS_E_AGAIN - match the EINTR and EAGAIN errno values.) */ - outbytes = gnutls_record_uncork(state->session, 0); - while (outbytes == GNUTLS_E_AGAIN); - - if (outbytes < 0) - { - record_io_error(state, len, US"uncork", NULL); - return -1; - } - } while (gnutls_record_check_corked(state->session) > 0); + do + /* We can't use GNUTLS_RECORD_WAIT here, as it retries on + GNUTLS_E_AGAIN || GNUTLS_E_INTR, which would break our timeout set by alarm(). + The GNUTLS_E_AGAIN should not happen ever, as our sockets are blocking anyway. + But who knows. (That all relies on the fact that GNUTLS_E_INTR and GNUTLS_E_AGAIN + match the EINTR and EAGAIN errno values.) */ + outbytes = gnutls_record_uncork(state->session, 0); + while (outbytes == GNUTLS_E_AGAIN); + + if (outbytes < 0) + { + record_io_error(state, len, US"uncork", NULL); + return -1; + } + state->corked = FALSE; } #endif