From d07d22508e7b2ed628e3dce125c09f71f0ad0efc Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 14 Jul 2008 13:56:39 -0700 Subject: [PATCH] vconn: New function vconn_ssl_is_configured(). The secure channel, in discovery mode, wants to enable TCP connections by default only if SSL has not been configured. This function allows it to do that. --- include/vconn-ssl.h | 7 +++++++ lib/vconn-ssl.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/include/vconn-ssl.h b/include/vconn-ssl.h index 1d4a923d4..fb80068e4 100644 --- a/include/vconn-ssl.h +++ b/include/vconn-ssl.h @@ -33,7 +33,10 @@ #ifndef VCONN_SSL_H #define VCONN_SSL_H 1 +#include + #ifdef HAVE_OPENSSL +bool vconn_ssl_is_configured(void); void vconn_ssl_set_private_key_file(const char *file_name); void vconn_ssl_set_certificate_file(const char *file_name); void vconn_ssl_set_ca_cert_file(const char *file_name); @@ -56,6 +59,10 @@ void vconn_ssl_set_ca_cert_file(const char *file_name); vconn_ssl_set_ca_cert_file(optarg); \ break; #else /* !HAVE_OPENSSL */ +static inline bool vconn_ssl_is_configured(void) +{ + return false; +} #define VCONN_SSL_LONG_OPTIONS #define VCONN_SSL_OPTION_HANDLERS #endif /* !HAVE_OPENSSL */ diff --git a/lib/vconn-ssl.c b/lib/vconn-ssl.c index 607d9b9e7..0da4c578d 100644 --- a/lib/vconn-ssl.c +++ b/lib/vconn-ssl.c @@ -867,6 +867,13 @@ tmp_dh_callback(SSL *ssl, int is_export UNUSED, int keylength) return NULL; } +/* Returns true if SSL is at least partially configured. */ +bool +vconn_ssl_is_configured(void) +{ + return has_private_key || has_certificate || has_ca_cert; +} + void vconn_ssl_set_private_key_file(const char *file_name) { -- 2.43.0