gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 02/05: Fixed compatibility with old GnuTLS versions


From: gnunet
Subject: [libmicrohttpd] 02/05: Fixed compatibility with old GnuTLS versions
Date: Sun, 12 Dec 2021 14:13:07 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit b4f1e487de8a91186b3a29ea7949473fb911c240
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Sun Dec 12 13:35:12 2021 +0300

    Fixed compatibility with old GnuTLS versions
---
 src/microhttpd/connection_https.c | 5 +++++
 src/microhttpd/daemon.c           | 3 +++
 src/microhttpd/mhd_send.c         | 5 +++++
 3 files changed, 13 insertions(+)

diff --git a/src/microhttpd/connection_https.c 
b/src/microhttpd/connection_https.c
index aaef7d98..0d691706 100644
--- a/src/microhttpd/connection_https.c
+++ b/src/microhttpd/connection_https.c
@@ -91,8 +91,13 @@ recv_tls_adapter (struct MHD_Connection *connection,
          (GNUTLS_E_CRYPTODEV_IOCTL_ERROR == res) ||
          (GNUTLS_E_CRYPTODEV_DEVICE_ERROR == res) )
       return MHD_ERR_PIPE_;
+#if defined(GNUTLS_E_PREMATURE_TERMINATION)
     if (GNUTLS_E_PREMATURE_TERMINATION == res)
       return MHD_ERR_CONNRESET_;
+#elif defined(GNUTLS_E_UNEXPECTED_PACKET_LENGTH)
+    if (GNUTLS_E_UNEXPECTED_PACKET_LENGTH == res)
+      return MHD_ERR_CONNRESET_;
+#endif /* GNUTLS_E_UNEXPECTED_PACKET_LENGTH */
     if (GNUTLS_E_MEMORY_ERROR == res)
       return MHD_ERR_NOMEM_;
     /* Treat any other error as a hard error. */
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index a96ec9ae..a75dd0c0 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -2317,8 +2317,10 @@ psk_gnutls_adapter (gnutls_session_t session,
 {
   struct MHD_Connection *connection;
   struct MHD_Daemon *daemon;
+#if GNUTLS_VERSION_MAJOR >= 3
   void *app_psk;
   size_t app_psk_size;
+#endif /* GNUTLS_VERSION_MAJOR >= 3 */
 
   connection = gnutls_session_get_ptr (session);
   if (NULL == connection)
@@ -2371,6 +2373,7 @@ psk_gnutls_adapter (gnutls_session_t session,
   free (app_psk);
   return 0;
 #else
+  (void) username; (void) key; /* Mute compiler warning */
 #ifdef HAVE_MESSAGES
   MHD_DLOG (daemon,
             _ ("PSK not supported by this server.\n"));
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index 86f76b48..b4a192a9 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -799,8 +799,13 @@ MHD_send_data_ (struct MHD_Connection *connection,
          (GNUTLS_E_CRYPTODEV_IOCTL_ERROR == ret) ||
          (GNUTLS_E_CRYPTODEV_DEVICE_ERROR == ret) )
       return MHD_ERR_PIPE_;
+#if defined(GNUTLS_E_PREMATURE_TERMINATION)
     if (GNUTLS_E_PREMATURE_TERMINATION == ret)
       return MHD_ERR_CONNRESET_;
+#elif defined(GNUTLS_E_UNEXPECTED_PACKET_LENGTH)
+    if (GNUTLS_E_UNEXPECTED_PACKET_LENGTH == ret)
+      return MHD_ERR_CONNRESET_;
+#endif /* GNUTLS_E_UNEXPECTED_PACKET_LENGTH */
     if (GNUTLS_E_MEMORY_ERROR == ret)
       return MHD_ERR_NOMEM_;
     if (ret < 0)

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]