From 2daa7b289a929bfcde999b9bd7f0bbe0fc2a47c0 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 28 May 2024 00:39:04 +0200 Subject: [PATCH 1/2] Windows, OpenSSL - HAVE_OPENSSL_APPLINK_C is not set, when compiling with /WX CHECK_INCLUDE_FILES failed during configuration phase, as applink.c compiles with "warning C4996: 'fopen' was declared deprecated", hence warning == error makes compile time check fail. This happens at least when using OpenSSL 3.2, but not with older versions. The consequence is that in some cases(e.g using SSL with client certificates), client would exit with "Applink not found" at runtime. Fix by defining HAVE_OPENSSL_APPLINK_C, if ${OPENSSL_INCLUDE_DIR}/include/openssl/applink.c merely exists, without attempting to compile. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4d76b97d..9f851aa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -307,8 +307,8 @@ IF(NOT WITH_SSL STREQUAL "OFF") ADD_DEFINITIONS(-DHAVE_OPENSSL -DHAVE_TLS) SET(SSL_SOURCES "${CC_SOURCE_DIR}/libmariadb/secure/openssl.c") SET(SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY}) - IF(WIN32) - CHECK_INCLUDE_FILES (${OPENSSL_INCLUDE_DIR}/openssl/applink.c HAVE_OPENSSL_APPLINK_C) + IF(WIN32 AND EXISTS ${OPENSSL_INCLUDE_DIR}/openssl/applink.c) + SET(HAVE_OPENSSL_APPLINK_C 1) ENDIF() INCLUDE_DIRECTORIES(BEFORE ${OPENSSL_INCLUDE_DIR}) From 486ce75d6426c20c4e9f8e7fe4df8ddec193d7e2 Mon Sep 17 00:00:00 2001 From: Georg Richter Date: Tue, 11 Jun 2024 16:00:22 +0200 Subject: [PATCH 2/2] CONPY-704: parse_connection_string ignores empty string in last parameter 1) Fix check if end was reached (<= instead of <), so last parameter will not be ignored in case it is an empty string. 2) Empty strings will be passed as NULL`in _mariadb_set_conf_option. --- libmariadb/mariadb_lib.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libmariadb/mariadb_lib.c b/libmariadb/mariadb_lib.c index c9cd4a5d..6f5ec07e 100644 --- a/libmariadb/mariadb_lib.c +++ b/libmariadb/mariadb_lib.c @@ -811,7 +811,10 @@ my_bool _mariadb_set_conf_option(MYSQL *mysql, const char *config_option, const option_val= &val_sizet; break; case MARIADB_OPTION_STR: - option_val= (void*)config_value; + if (config_value && !config_value[0]) + option_val= NULL; + else + option_val= (void*)config_value; break; case MARIADB_OPTION_NONE: break; @@ -907,7 +910,7 @@ static int parse_connection_string(MYSQL *mysql, const char *unused __attribute_ if (!key) goto error; *pos++= 0; - if (pos < end) + if (pos <= end) val= pos; continue; break;