Module Name:    src
Committed By:   mlelstv
Date:           Tue Jan 24 08:02:58 UTC 2023

Modified Files:
        src/external/bsd/fetch/dist/libfetch: common.c

Log Message:
Shut down SSL when closing connection.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/fetch/dist/libfetch/common.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/fetch/dist/libfetch/common.c
diff -u src/external/bsd/fetch/dist/libfetch/common.c:1.3 src/external/bsd/fetch/dist/libfetch/common.c:1.4
--- src/external/bsd/fetch/dist/libfetch/common.c:1.3	Tue Jan 24 08:01:25 2023
+++ src/external/bsd/fetch/dist/libfetch/common.c	Tue Jan 24 08:02:57 2023
@@ -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 <jo...@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);

Reply via email to