This is the same, but now we have a symbol for it.
---
docs/libnbd.pod | 6 ++++--
interop/interop.c | 2 +-
lib/connect.c | 2 +-
tests/aio-parallel-load.c | 2 +-
tests/aio-parallel.c | 2 +-
tests/connect-tls.c | 2 +-
tests/synch-parallel.c | 2 +-
7 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/docs/libnbd.pod b/docs/libnbd.pod
index b42d000..01964de 100644
--- a/docs/libnbd.pod
+++ b/docs/libnbd.pod
@@ -522,8 +522,10 @@ and servers. Libnbd defaults to TLS I<disabled> for maximum
interoperability. To enable it on a handle you must call
C<nbd_set_tls> before connecting:
- nbd_set_tls (nbd, 1); // to allow TLS, but fall back to unencrypted
- nbd_set_tls (nbd, 2); // to require TLS, and fail otherwise
+ // to allow TLS, but fall back to unencrypted
+ nbd_set_tls (nbd, LIBNBD_TLS_ALLOW);
+ // to require TLS, and fail otherwise
+ nbd_set_tls (nbd, LIBNBD_TLS_REQUIRE);
It may also be necessary to verify that the server’s identity is
correct. For some servers it may be necessary to verify to the server
diff --git a/interop/interop.c b/interop/interop.c
index a3973db..662d871 100644
--- a/interop/interop.c
+++ b/interop/interop.c
@@ -77,7 +77,7 @@ main (int argc, char *argv[])
fprintf (stderr, "skip: compiled without TLS support\n");
exit (77);
}
- if (nbd_set_tls (nbd, 2) == -1) {
+ if (nbd_set_tls (nbd, LIBNBD_TLS_REQUIRE) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
diff --git a/lib/connect.c b/lib/connect.c
index 5e760c6..f98bcdb 100644
--- a/lib/connect.c
+++ b/lib/connect.c
@@ -292,7 +292,7 @@ nbd_unlocked_aio_connect_uri (struct nbd_handle *h, const char
*raw_uri)
}
/* TLS */
- if (tls && nbd_unlocked_set_tls (h, 2) == -1)
+ if (tls && nbd_unlocked_set_tls (h, LIBNBD_TLS_REQUIRE) == -1)
goto cleanup;
/* XXX If uri->query_raw includes TLS parameters, we should call
* nbd_unlocked_set_tls_* to match...
diff --git a/tests/aio-parallel-load.c b/tests/aio-parallel-load.c
index f4ba635..614c22b 100644
--- a/tests/aio-parallel-load.c
+++ b/tests/aio-parallel-load.c
@@ -207,7 +207,7 @@ start_thread (void *arg)
/* Require TLS on the handle and fail if not available or if the
* handshake fails.
*/
- if (nbd_set_tls (nbd, 2) == -1) {
+ if (nbd_set_tls (nbd, LIBNBD_TLS_REQUIRE) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
diff --git a/tests/aio-parallel.c b/tests/aio-parallel.c
index f8d4891..b6a0682 100644
--- a/tests/aio-parallel.c
+++ b/tests/aio-parallel.c
@@ -220,7 +220,7 @@ start_thread (void *arg)
/* Require TLS on the handle and fail if not available or if the
* handshake fails.
*/
- if (nbd_set_tls (nbd, 2) == -1) {
+ if (nbd_set_tls (nbd, LIBNBD_TLS_REQUIRE) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
diff --git a/tests/connect-tls.c b/tests/connect-tls.c
index be2ef32..0666d12 100644
--- a/tests/connect-tls.c
+++ b/tests/connect-tls.c
@@ -46,7 +46,7 @@ main (int argc, char *argv[])
/* Require TLS on the handle and fail if not available or if the
* handshake fails.
*/
- if (nbd_set_tls (nbd, 2) == -1) {
+ if (nbd_set_tls (nbd, LIBNBD_TLS_REQUIRE) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
diff --git a/tests/synch-parallel.c b/tests/synch-parallel.c
index 40df85d..830d12a 100644
--- a/tests/synch-parallel.c
+++ b/tests/synch-parallel.c
@@ -188,7 +188,7 @@ start_thread (void *arg)
/* Require TLS on the handle and fail if not available or if the
* handshake fails.
*/
- if (nbd_set_tls (nbd, 2) == -1) {
+ if (nbd_set_tls (nbd, LIBNBD_TLS_REQUIRE) == -1) {
fprintf (stderr, "%s\n", nbd_get_error ());
exit (EXIT_FAILURE);
}
--
2.22.0