From 06567ee554899031e6a83535a5e57b73a3c97ba6 Mon Sep 17 00:00:00 2001
From: Kurt Zeilenga <kurt@openldap.org>
Date: Tue, 13 Nov 2001 19:28:32 +0000
Subject: [PATCH] Add ldap_pvt_tls_destroy

---
 include/ldap_pvt.h      |  1 +
 libraries/libldap/tls.c | 11 +++++++++++
 2 files changed, 12 insertions(+)

diff --git a/include/ldap_pvt.h b/include/ldap_pvt.h
index d926912f9e..6116a0c9b7 100644
--- a/include/ldap_pvt.h
+++ b/include/ldap_pvt.h
@@ -169,6 +169,7 @@ ldap_pvt_str2lower LDAP_P(( char *str ));
 
 /* tls.c */
 LDAP_F (int) ldap_pvt_tls_init LDAP_P(( void ));
+LDAP_F (void) ldap_pvt_tls_destroy LDAP_P(( void ));
 LDAP_F (int) ldap_pvt_tls_connect LDAP_P(( struct ldap *ld,
 	Sockbuf *sb, void *ctx_arg ));
 LDAP_F (int) ldap_pvt_tls_accept LDAP_P(( Sockbuf *sb, void *ctx_arg ));
diff --git a/libraries/libldap/tls.c b/libraries/libldap/tls.c
index 8b839d672a..23c5042a3b 100644
--- a/libraries/libldap/tls.c
+++ b/libraries/libldap/tls.c
@@ -97,6 +97,17 @@ static void tls_init_threads( void )
 }
 #endif /* LDAP_R_COMPILE */
 
+/*
+ * Tear down the TLS subsystem. Should only be called once.
+ */
+void
+ldap_pvt_tls_destroy( void )
+{
+	SSL_CTX_free(tls_def_ctx);
+	EVP_cleanup();
+	ERR_free_strings();
+}
+
 /*
  * Initialize TLS subsystem. Should be called only once.
  */
-- 
GitLab