diff --git a/src/core/properties/signed.c b/src/core/properties/signed.c index aa658c7..b0703e1 100644 --- a/src/core/properties/signed.c +++ b/src/core/properties/signed.c @@ -49,6 +49,48 @@ return (int) lib3270_get_ssl_state(hSession); } + static int lib3270_set_ssl_minimum_supported_version(H3270 *hSession, int value) + { +#ifdef HAVE_LIBSSL + FAIL_IF_ONLINE(hSession); + hSession->ssl.supported_version.minimum = value; + return 0; +#else + return ENOTSUP; +#endif // HAVE_LIBSSL + } + + static int lib3270_set_ssl_maximum_supported_version(H3270 *hSession, int value) + { +#ifdef HAVE_LIBSSL + FAIL_IF_ONLINE(hSession); + hSession->ssl.supported_version.maximum = value; + return 0; +#else + return ENOTSUP; +#endif // HAVE_LIBSSL + } + + static int lib3270_get_ssl_minimum_supported_version(const H3270 *hSession) + { +#ifdef HAVE_LIBSSL + return hSession->ssl.supported_version.minimum; +#else + errno = ENOTSUP; + return 0; +#endif // HAVE_LIBSSL + } + + static int lib3270_get_ssl_maximum_supported_version(const H3270 *hSession) + { +#ifdef HAVE_LIBSSL + return hSession->ssl.supported_version.maximum; +#else + errno = ENOTSUP; + return 0; +#endif // HAVE_LIBSSL + } + const LIB3270_INT_PROPERTY * lib3270_get_int_properties_list(void) { @@ -75,6 +117,22 @@ .set = NULL // Set value. }, + { + .name = "ssl_minimum_version", // Property name. + .description = N_( "ID of the minimum supported SSL version" ), // Property description. + .default_value = 0, + .get = lib3270_get_ssl_minimum_supported_version, // Get value. + .set = lib3270_set_ssl_minimum_supported_version // Set value. + }, + + { + .name = "ssl_maximum_version", // Property name. + .description = N_( "ID of the maximum supported SSL version" ), // Property description. + .default_value = 0, + .get = lib3270_get_ssl_maximum_supported_version, // Get value. + .set = lib3270_set_ssl_maximum_supported_version // Set value. + }, + { .name = NULL, .description = NULL, diff --git a/src/core/session.c b/src/core/session.c index 66c1db3..f00dda4 100644 --- a/src/core/session.c +++ b/src/core/session.c @@ -410,6 +410,11 @@ H3270 * lib3270_session_new(const char *model) hSession = lib3270_malloc(sizeof(H3270)); hSession->id = 0; +#ifdef HAVE_LIBSSL + hSession->ssl.supported_version.minimum = 0; + hSession->ssl.supported_version.maximum = 0; +#endif // HAVE_LIBSSL + #ifdef SSL_ENABLE_CRL_CHECK hSession->ssl.crl.download = 1; #endif // SSL_ENABLE_CRL_CHECK diff --git a/src/include/internals.h b/src/include/internals.h index d43e332..a8a7106 100644 --- a/src/include/internals.h +++ b/src/include/internals.h @@ -662,6 +662,13 @@ struct _h3270 char host; LIB3270_SSL_STATE state; unsigned long error; + + struct + { + int minimum; ///< @brief The minimum supported protocol version. + int maximum; ///< @brief The maximum supported protocol version. + } supported_version; + #ifdef SSL_ENABLE_CRL_CHECK struct { -- libgit2 0.21.2