summaryrefslogtreecommitdiff
path: root/external/bsd
diff options
context:
space:
mode:
authormlelstv <mlelstv@NetBSD.org>2023-01-24 08:02:57 +0000
committermlelstv <mlelstv@NetBSD.org>2023-01-24 08:02:57 +0000
commit59ddf36f12983121c19a1a0026e09567d2f157dd (patch)
tree9ea0f4f093cb211bae7f6c718ed39b60962ffb6d /external/bsd
parent564c24a7b038fde8791dba09636f423c4e5bd823 (diff)
Shut down SSL when closing connection.
Diffstat (limited to 'external/bsd')
-rw-r--r--external/bsd/fetch/dist/libfetch/common.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/external/bsd/fetch/dist/libfetch/common.c b/external/bsd/fetch/dist/libfetch/common.c
index b9d333cbf97..6c17f736504 100644
--- a/external/bsd/fetch/dist/libfetch/common.c
+++ b/external/bsd/fetch/dist/libfetch/common.c
@@ -1,4 +1,4 @@
-/* $NetBSD: common.c,v 1.3 2023/01/24 08:01:25 mlelstv Exp $ */
+/* $NetBSD: common.c,v 1.4 2023/01/24 08:02:57 mlelstv Exp $ */
/*-
* Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
* Copyright (c) 2008, 2010 Joerg Sonnenberger <joerg@NetBSD.org>
@@ -713,6 +713,22 @@ fetch_close(conn_t *conn)
{
int ret;
+#ifdef WITH_SSL
+ if (conn->ssl) {
+ SSL_shutdown(conn->ssl);
+ SSL_set_connect_state(conn->ssl);
+ SSL_free(conn->ssl);
+ conn->ssl = NULL;
+ }
+ if (conn->ssl_ctx) {
+ SSL_CTX_free(conn->ssl_ctx);
+ conn->ssl_ctx = NULL;
+ }
+ if (conn->ssl_cert) {
+ X509_free(conn->ssl_cert);
+ conn->ssl_cert = NULL;
+ }
+#endif
ret = close(conn->sd);
if (conn->cache_url)
fetchFreeURL(conn->cache_url);