diff --git a/CMakeLists.txt b/CMakeLists.txt index d600f25d..95a23c27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -280,7 +280,7 @@ IF(WITH_SSL STREQUAL "ON") IF(WIN32) SET(WITH_SSL "SCHANNEL") ELSE() - SET(WITH_SSL "OPENSSL") + SET(WITH_SSL "PENSSL") ENDIF() ENDIF() @@ -293,8 +293,12 @@ 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) + ENDIF() INCLUDE_DIRECTORIES(BEFORE ${OPENSSL_INCLUDE_DIR}) + TRY_RUN(LIBRESSL_RESULT HAVE_LIBRESSL ${CMAKE_BINARY_DIR} ${CC_SOURCE_DIR}/cmake/libressl_version.c diff --git a/include/ma_config.h.in b/include/ma_config.h.in index 8f12ee67..8d462e9e 100644 --- a/include/ma_config.h.in +++ b/include/ma_config.h.in @@ -2,6 +2,7 @@ /* * Include file constants (processed in LibmysqlIncludeFiles.txt 1 */ +#cmakedefine HAVE_OPENSSL_APPLINK_C 1 #cmakedefine HAVE_ALLOCA_H 1 #cmakedefine HAVE_BIGENDIAN 1 #cmakedefine HAVE_SETLOCALE 1 diff --git a/libmariadb/secure/openssl.c b/libmariadb/secure/openssl.c index 41d50460..ac982698 100644 --- a/libmariadb/secure/openssl.c +++ b/libmariadb/secure/openssl.c @@ -30,6 +30,10 @@ #include #include +#if defined(_WIN32) && !defined(_OPENSSL_Applink) && defined(HAVE_OPENSSL_APPLINK_C) +#include +#endif + #if OPENSSL_VERSION_NUMBER >= 0x10002000L && !defined(LIBRESSL_VERSION_NUMBER) #include #define HAVE_OPENSSL_CHECK_HOST 1 diff --git a/libmariadb/secure/openssl_crypt.c b/libmariadb/secure/openssl_crypt.c index ff885c59..01d41a90 100644 --- a/libmariadb/secure/openssl_crypt.c +++ b/libmariadb/secure/openssl_crypt.c @@ -16,6 +16,7 @@ or write to the Free Software Foundation, Inc., 51 Franklin St., Fifth Floor, Boston, MA 02110, USA */ +#include #include #include diff --git a/mariadb_config/mariadb_config.c.in b/mariadb_config/mariadb_config.c.in index 01ba2043..703c9466 100644 --- a/mariadb_config/mariadb_config.c.in +++ b/mariadb_config/mariadb_config.c.in @@ -78,7 +78,7 @@ int main(int argc, char **argv) while(1) { int option_index= 0; - c= getopt_long(argc, argv, "abcdefghij", long_options, &option_index); + c= getopt_long(argc, argv, "abcdefghijkl", long_options, &option_index); switch(c) { case 'a': diff --git a/plugins/auth/my_auth.c b/plugins/auth/my_auth.c index 04961e93..5154e6d3 100644 --- a/plugins/auth/my_auth.c +++ b/plugins/auth/my_auth.c @@ -394,7 +394,9 @@ static int client_mpvio_read_packet(struct st_plugin_vio *mpv, uchar **buf) } /* otherwise read the data */ - pkt_len= ma_net_safe_read(mysql); + if ((pkt_len= ma_net_safe_read(mysql)) == packet_error) + return (int)packet_error; + mpvio->last_read_packet_len= pkt_len; *buf= mysql->net.read_pos; @@ -591,7 +593,8 @@ retry: mysql->net.read_pos[0]= 0; res= auth_plugin->authenticate_user((struct st_plugin_vio *)&mpvio, mysql); - if (res > CR_OK && mysql->net.read_pos[0] != 254) + if ((res == CR_ERROR && !mysql->net.buff) || + (res > CR_OK && mysql->net.read_pos[0] != 254)) { /* the plugin returned an error. write it down in mysql, diff --git a/unittest/libmariadb/my_test.h b/unittest/libmariadb/my_test.h index a5cddeed..6aea37b2 100644 --- a/unittest/libmariadb/my_test.h +++ b/unittest/libmariadb/my_test.h @@ -35,6 +35,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef WIN32 #include +#else +#include #endif #ifndef OK