[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd] 02/02: new_connection_prepare_(): added check for valid
From: |
gnunet |
Subject: |
[libmicrohttpd] 02/02: new_connection_prepare_(): added check for valid TLS initialisation |
Date: |
Thu, 22 Oct 2020 16:24:37 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 13fe456581693421459100d60a7a0f93e05ce533
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Thu Oct 22 17:01:52 2020 +0300
new_connection_prepare_(): added check for valid TLS initialisation
---
src/microhttpd/daemon.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index ed4cd5ca..98b93ae5 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2535,10 +2535,26 @@ new_connection_prepare_ (struct MHD_Daemon *daemon,
#endif
connection->tls_state = MHD_TLS_CONN_INIT;
MHD_set_https_callbacks (connection);
- gnutls_init (&connection->tls_session,
- flags);
- gnutls_priority_set (connection->tls_session,
- daemon->priority_cache);
+ if ((GNUTLS_E_SUCCESS != gnutls_init (&connection->tls_session, flags)) ||
+ (GNUTLS_E_SUCCESS != gnutls_priority_set (connection->tls_session,
+ daemon->priority_cache)))
+ {
+ gnutls_deinit (connection->tls_session);
+ MHD_socket_close_chk_ (client_socket);
+ MHD_ip_limit_del (daemon,
+ addr,
+ addrlen);
+ free (connection->addr);
+ free (connection);
+#ifdef HAVE_MESSAGES
+ MHD_DLOG (connection->daemon,
+ _ ("Failed to initialise TLS session.\n"));
+#endif
+#if EPROTO
+ errno = EPROTO;
+#endif
+ return MHD_NO;
+ }
gnutls_session_set_ptr (connection->tls_session,
connection);
switch (daemon->cred_type)
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.