Blob Blame History Raw
From 85dab1964a66f2c520a88b368cacf655abdb89db Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@samba.org>
Date: Wed, 13 Nov 2019 13:59:30 +0100
Subject: [PATCH 144/187] s4:lib: Remove gnutls_global_(de)init() from libtls

This is handled by the gnutls library constructor/destructor.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 0e159b725ecf2f9a6d026170253e2d1eb73ed0c2)
---
 source4/lib/tls/tls_tstream.c | 12 ------------
 source4/lib/tls/tlscert.c     |  3 ---
 2 files changed, 15 deletions(-)

diff --git a/source4/lib/tls/tls_tstream.c b/source4/lib/tls/tls_tstream.c
index b68996db894..55bca036776 100644
--- a/source4/lib/tls/tls_tstream.c
+++ b/source4/lib/tls/tls_tstream.c
@@ -903,12 +903,6 @@ NTSTATUS tstream_tls_params_client(TALLOC_CTX *mem_ctx,
 	struct tstream_tls_params *tlsp;
 	int ret;
 
-	ret = gnutls_global_init();
-	if (ret != GNUTLS_E_SUCCESS) {
-		DEBUG(0,("TLS %s - %s\n", __location__, gnutls_strerror(ret)));
-		return NT_STATUS_NOT_SUPPORTED;
-	}
-
 	tlsp = talloc_zero(mem_ctx, struct tstream_tls_params);
 	NT_STATUS_HAVE_NO_MEMORY(tlsp);
 
@@ -1123,12 +1117,6 @@ NTSTATUS tstream_tls_params_server(TALLOC_CTX *mem_ctx,
 		return NT_STATUS_OK;
 	}
 
-	ret = gnutls_global_init();
-	if (ret != GNUTLS_E_SUCCESS) {
-		DEBUG(0,("TLS %s - %s\n", __location__, gnutls_strerror(ret)));
-		return NT_STATUS_NOT_SUPPORTED;
-	}
-
 	tlsp = talloc_zero(mem_ctx, struct tstream_tls_params);
 	NT_STATUS_HAVE_NO_MEMORY(tlsp);
 
diff --git a/source4/lib/tls/tlscert.c b/source4/lib/tls/tlscert.c
index e02ee13d7e9..f5e9a1f2d39 100644
--- a/source4/lib/tls/tlscert.c
+++ b/source4/lib/tls/tlscert.c
@@ -62,8 +62,6 @@ void tls_cert_generate(TALLOC_CTX *mem_ctx,
 	} \
 } while (0)
 
-	TLSCHECK(gnutls_global_init());
-
 	DEBUG(0,("Attempting to autogenerate TLS self-signed keys for https for hostname '%s'\n", 
 		 hostname));
 
@@ -150,7 +148,6 @@ void tls_cert_generate(TALLOC_CTX *mem_ctx,
 	gnutls_x509_privkey_deinit(cakey);
 	gnutls_x509_crt_deinit(cacrt);
 	gnutls_x509_crt_deinit(crt);
-	gnutls_global_deinit();
 
 	DEBUG(0,("TLS self-signed keys generated OK\n"));
 	return;
-- 
2.23.0