|
| 1 | +From c6cc19319f39c09c4ff74b47101eb217e75d3b43 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Brian Fjeldstad <bfjelds@microsoft.com> |
| 3 | +Date: Mon, 19 Aug 2024 21:59:46 +0000 |
| 4 | +Subject: [PATCH 1/3] port patch #1 |
| 5 | + |
| 6 | +--- |
| 7 | + configure.ac | 6 ++---- |
| 8 | + lib/crypto.c | 4 ---- |
| 9 | + 2 files changed, 2 insertions(+), 8 deletions(-) |
| 10 | + |
| 11 | +diff --git a/configure.ac b/configure.ac |
| 12 | +index b6e2c9f..07e417b 100644 |
| 13 | +--- a/configure.ac |
| 14 | ++++ b/configure.ac |
| 15 | +@@ -150,12 +150,12 @@ AC_ARG_WITH([gnutls], |
| 16 | + [], |
| 17 | + [with_gnutls=check]) |
| 18 | + AS_IF([test "$with_gnutls" != "no"],[ |
| 19 | +- PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.3.0], [ |
| 20 | ++ PKG_CHECK_MODULES([GNUTLS], [gnutls >= 3.5.18], [ |
| 21 | + AC_SUBST([GNUTLS_CFLAGS]) |
| 22 | + AC_SUBST([GNUTLS_LIBS]) |
| 23 | + AC_DEFINE([HAVE_GNUTLS],[1],[gnutls found at compile time.]) |
| 24 | + ], [ |
| 25 | +- AC_MSG_WARN([gnutls not found or < 3.3.0, TLS support will be disabled.]) |
| 26 | ++ AC_MSG_WARN([gnutls not found or < 3.5.18, TLS support will be disabled.]) |
| 27 | + ]) |
| 28 | + ]) |
| 29 | + AM_CONDITIONAL([HAVE_GNUTLS], [test "x$GNUTLS_LIBS" != "x"]) |
| 30 | +@@ -174,8 +174,6 @@ AS_IF([test "$GNUTLS_LIBS" != ""],[ |
| 31 | + # Check for APIs which may not be present. |
| 32 | + old_LIBS="$LIBS" |
| 33 | + LIBS="$GNUTLS_LIBS $LIBS" |
| 34 | +- AC_CHECK_FUNCS([\ |
| 35 | +- gnutls_session_set_verify_cert]) |
| 36 | + LIBS="$old_LIBS" |
| 37 | + ]) |
| 38 | + |
| 39 | +diff --git a/lib/crypto.c b/lib/crypto.c |
| 40 | +index 340a6a0..964a871 100644 |
| 41 | +--- a/lib/crypto.c |
| 42 | ++++ b/lib/crypto.c |
| 43 | +@@ -514,12 +514,8 @@ set_up_certificate_credentials (struct nbd_handle *h, |
| 44 | + return NULL; |
| 45 | + |
| 46 | + found_certificates: |
| 47 | +-#ifdef HAVE_GNUTLS_SESSION_SET_VERIFY_CERT |
| 48 | + if (h->hostname && h->tls_verify_peer) |
| 49 | + gnutls_session_set_verify_cert (session, h->hostname, 0); |
| 50 | +-#else |
| 51 | +- debug (h, "ignoring nbd_set_tls_verify_peer, this requires GnuTLS >= 3.4.6"); |
| 52 | +-#endif |
| 53 | + |
| 54 | + err = gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, ret); |
| 55 | + if (err < 0) { |
| 56 | +-- |
| 57 | +2.34.1 |
| 58 | + |
| 59 | +From 7ece17bfb16d437975ac40d63b0f20162601d3bf Mon Sep 17 00:00:00 2001 |
| 60 | +From: Brian Fjeldstad <bfjelds@microsoft.com> |
| 61 | +Date: Mon, 19 Aug 2024 22:01:17 +0000 |
| 62 | +Subject: [PATCH 2/3] port patch #2 |
| 63 | + |
| 64 | +--- |
| 65 | + lib/crypto.c | 6 +++--- |
| 66 | + 1 file changed, 3 insertions(+), 3 deletions(-) |
| 67 | + |
| 68 | +diff --git a/lib/crypto.c b/lib/crypto.c |
| 69 | +index 964a871..97884b8 100644 |
| 70 | +--- a/lib/crypto.c |
| 71 | ++++ b/lib/crypto.c |
| 72 | +@@ -514,9 +514,6 @@ set_up_certificate_credentials (struct nbd_handle *h, |
| 73 | + return NULL; |
| 74 | + |
| 75 | + found_certificates: |
| 76 | +- if (h->hostname && h->tls_verify_peer) |
| 77 | +- gnutls_session_set_verify_cert (session, h->hostname, 0); |
| 78 | +- |
| 79 | + err = gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, ret); |
| 80 | + if (err < 0) { |
| 81 | + set_error (0, "gnutls_credentials_set: %s", gnutls_strerror (err)); |
| 82 | +@@ -626,6 +623,9 @@ nbd_internal_crypto_create_session (struct nbd_handle *h, |
| 83 | + gnutls_deinit (session); |
| 84 | + return NULL; |
| 85 | + } |
| 86 | ++ |
| 87 | ++ if (h->hostname && h->tls_verify_peer) |
| 88 | ++ gnutls_session_set_verify_cert (session, h->hostname, 0); |
| 89 | + } |
| 90 | + |
| 91 | + /* Wrap the underlying socket with GnuTLS. */ |
| 92 | +-- |
| 93 | +2.34.1 |
| 94 | + |
| 95 | +From 811a9bc9797b539dafb4423933243950b3aae3c1 Mon Sep 17 00:00:00 2001 |
| 96 | +From: Brian Fjeldstad <bfjelds@microsoft.com> |
| 97 | +Date: Mon, 19 Aug 2024 22:01:56 +0000 |
| 98 | +Subject: [PATCH 3/3] port patch #3 |
| 99 | + |
| 100 | +--- |
| 101 | + lib/crypto.c | 2 +- |
| 102 | + 1 file changed, 1 insertion(+), 1 deletion(-) |
| 103 | + |
| 104 | +diff --git a/lib/crypto.c b/lib/crypto.c |
| 105 | +index 97884b8..c6a21d2 100644 |
| 106 | +--- a/lib/crypto.c |
| 107 | ++++ b/lib/crypto.c |
| 108 | +@@ -624,7 +624,7 @@ nbd_internal_crypto_create_session (struct nbd_handle *h, |
| 109 | + return NULL; |
| 110 | + } |
| 111 | + |
| 112 | +- if (h->hostname && h->tls_verify_peer) |
| 113 | ++ if (h->tls_verify_peer) |
| 114 | + gnutls_session_set_verify_cert (session, h->hostname, 0); |
| 115 | + } |
| 116 | + |
| 117 | +-- |
| 118 | +2.34.1 |
| 119 | + |
0 commit comments