X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/c4b4086235b1d5e21fcf1ad72a1b05813e15dcbd..b367453a08bff7123dfe0b841de290e17372ad7c:/src/src/tls-gnu.c diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c index bc16ec03e..796581b0e 100644 --- a/src/src/tls-gnu.c +++ b/src/src/tls-gnu.c @@ -154,6 +154,9 @@ builtin_macro_create(US"_HAVE_TLS_OCSP_LIST"); #if defined(EXIM_HAVE_INOTIFY) || defined(EXIM_HAVE_KEVENT) builtin_macro_create(US"_HAVE_TLS_CA_CACHE"); # endif +# ifdef EXIM_HAVE_ALPN +builtin_macro_create(US"_HAVE_TLS_ALPN"); +# endif } #else @@ -461,7 +464,7 @@ if (!gnutls_allow_auto_pkcs11) #ifndef GNUTLS_AUTO_GLOBAL_INIT if ((rc = gnutls_global_init())) - return tls_error_gnu(UNULL, S"gnutls_global_init", rc, errstr); + return tls_error_gnu(NULL, US"gnutls_global_init", rc, errstr); #endif #if EXIM_GNUTLS_LIBRARY_LOG_LEVEL >= 0 @@ -1523,9 +1526,14 @@ else if ( !tls_certificate && !tls_privatekey else DEBUG(D_tls) debug_printf("TLS: not preloading server certs\n"); -/* If tls_verify_certificates is non-empty and has no $, load CAs */ +/* If tls_verify_certificates is non-empty and has no $, load CAs. +If none was configured and we can't handle "system", treat as empty. */ -if (opt_set_and_noexpand(tls_verify_certificates)) +if ( opt_set_and_noexpand(tls_verify_certificates) +#ifndef SUPPORT_SYSDEFAULT_CABUNDLE + && Ustrcmp(tls_verify_certificates, "system") != 0 +#endif + ) { if (tls_set_watch(tls_verify_certificates, FALSE)) { @@ -1629,7 +1637,14 @@ else DEBUG(D_tls) debug_printf("TLS: not preloading client certs, for transport '%s'\n", t->name); -if (opt_set_and_noexpand(ob->tls_verify_certificates)) +/* If tls_verify_certificates is non-empty and has no $, load CAs. +If none was configured and we can't handle "system", treat as empty. */ + +if ( opt_set_and_noexpand(ob->tls_verify_certificates) +#ifndef SUPPORT_SYSDEFAULT_CABUNDLE + && Ustrcmp(ob->tls_verify_certificates, "system") != 0 +#endif + ) { if (!watch || tls_set_watch(ob->tls_verify_certificates, FALSE)) { @@ -1845,7 +1860,8 @@ else provided. Experiment shows that, if the certificate file is empty, an unhelpful error message is provided. However, if we just refrain from setting anything up in that case, certificate verification fails, which seems to be the correct -behaviour. */ +behaviour. +If none was configured and we can't handle "system", treat as empty. */ if (!state->lib_state.cabundle) { @@ -3861,12 +3877,15 @@ return buf; } +/* Get up to the given number of bytes from any cached data, and feed to dkim. */ void -tls_get_cache(void) +tls_get_cache(unsigned lim) { #ifndef DISABLE_DKIM exim_gnutls_state_st * state = &state_server; int n = state->xfer_buffer_hwm - state->xfer_buffer_lwm; +if (n > lim) + n = lim; if (n > 0) dkim_exim_verify_feed(state->xfer_buffer+state->xfer_buffer_lwm, n); #endif