From b91659702c83b8f144e369ad5fa82724242c210c Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Sun, 5 Feb 2017 21:10:04 +0200 Subject: [PATCH] lib-ssl-iostream: Detect OPENSSL_cleanup() via configure It's ugly to have both OpenSSL version number check and a special LibreSSL check. --- m4/ssl.m4 | 3 +++ src/lib-ssl-iostream/dovecot-openssl-common.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/m4/ssl.m4 b/m4/ssl.m4 index 5f8503f3ac..d303b1821c 100644 --- a/m4/ssl.m4 +++ b/m4/ssl.m4 @@ -102,6 +102,9 @@ AC_DEFUN([DOVECOT_SSL], [ AC_DEFINE(HAVE_SSL_CTX_SET1_CURVES_LIST,, [Define if you have SSL_CTX_set1_curves_list]) fi + AC_CHECK_LIB(ssl, OPENSSL_cleanup, [ + AC_DEFINE(HAVE_OPENSSL_CLEANUP,, [OpenSSL supports OPENSSL_cleanup()]) + ],, $SSL_LIBS) AC_CHECK_LIB(ssl, SSL_get_current_compression, [ AC_DEFINE(HAVE_SSL_COMPRESSION,, [Build with OpenSSL compression]) ],, $SSL_LIBS) diff --git a/src/lib-ssl-iostream/dovecot-openssl-common.c b/src/lib-ssl-iostream/dovecot-openssl-common.c index ece359b08f..b63690ac95 100644 --- a/src/lib-ssl-iostream/dovecot-openssl-common.c +++ b/src/lib-ssl-iostream/dovecot-openssl-common.c @@ -101,7 +101,7 @@ bool dovecot_openssl_common_global_unref(void) ERR_remove_thread_state(NULL); #endif ERR_free_strings(); -#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined (LIBRESSL_VERSION_NUMBER) +#ifdef HAVE_OPENSSL_CLEANUP OPENSSL_cleanup(); #endif return FALSE; -- 2.47.3