]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Handle deprecated OpenSSL thread cleanup functions
authorNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Wed, 23 Nov 2016 07:40:24 +0000 (09:40 +0200)
committerNikolai Kondrashov <Nikolai.Kondrashov@redhat.com>
Wed, 7 Dec 2016 12:44:05 +0000 (14:44 +0200)
Use appropriate OpenSSL thread cleanup function or don't use any,
depending on their deprecation status in various OpenSSL versions.

src/main/threads.c
src/main/tls.c

index 58bc90803bd2a3a126405cefb842d5d072fde95c..cc79d0c555aba410e5e16b328ecd541b42cd5ee8 100644 (file)
@@ -718,7 +718,11 @@ static void *request_handler_thread(void *arg)
         *      must remove the thread's error queue before
         *      exiting to prevent memory leaks.
         */
+#if OPENSSL_VERSION_NUMBER < 0x10000000L
        ERR_remove_state(0);
+#elif OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+       ERR_remove_thread_state(NULL);
+#endif
 #endif
 
        pthread_mutex_lock(&thread_pool.queue_mutex);
index 692bab702178a67a1f5623ff55df48cf2ecaa237..6cd912f0f7ff7641d3f849078789ae6c83e04ae2 100644 (file)
@@ -2526,7 +2526,11 @@ int tls_global_version_check(char const *acknowledged)
  */
 void tls_global_cleanup(void)
 {
+#if OPENSSL_VERSION_NUMBER < 0x10000000L
        ERR_remove_state(0);
+#elif OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
+       ERR_remove_thread_state(NULL);
+#endif
        ENGINE_cleanup();
        CONF_modules_unload(1);
        ERR_free_strings();