diff options
author | Vladislav Vaintroub <wlad@mariadb.com> | 2016-08-19 15:27:37 +0000 |
---|---|---|
committer | Vladislav Vaintroub <wlad@mariadb.com> | 2016-08-19 15:27:37 +0000 |
commit | 7b89b9f5108c80f4f270da922d7e6c182a663719 (patch) | |
tree | 858a3873942f07610fb26685781e8bdbd3ab2c7f | |
parent | daff133ddf9a9d120050703c0b5753979c6190e0 (diff) | |
download | mariadb-git-7b89b9f5108c80f4f270da922d7e6c182a663719.tar.gz |
MDEV-9293 Connector/C integration
61 files changed, 637 insertions, 412 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ace4084acd..89b2d6b8abf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -359,6 +359,7 @@ ADD_SUBDIRECTORY(strings) ADD_SUBDIRECTORY(vio) ADD_SUBDIRECTORY(mysys) ADD_SUBDIRECTORY(mysys_ssl) +ADD_SUBDIRECTORY(libmariadb) ADD_SUBDIRECTORY(libmysql) ADD_SUBDIRECTORY(client) ADD_SUBDIRECTORY(extra) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index e4643ad9358..50280834a68 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -26,13 +26,23 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ) +ADD_DEFINITIONS(-DHAVE_OPENSSL=1) + +INCLUDE_DIRECTORIES( +BEFORE +${CONNECTOR_C_INSTALLDIR}/include/mariadb) + ## We will need libeay32.dll and ssleay32.dll when running client executables. COPY_OPENSSL_DLLS(copy_openssl_client) + +ADD_DEFINITIONS(-DHAVE_LIBMARIADB=1) +SET(CLIENT_LIB ${CONNECTOR_C_LIBS} mysys) + ADD_DEFINITIONS(${SSL_DEFINES}) MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc ${CMAKE_SOURCE_DIR}/sql/sql_string.cc) -TARGET_LINK_LIBRARIES(mysql mysqlclient) +TARGET_LINK_LIBRARIES(mysql ${CLIENT_LIB}) IF(UNIX) TARGET_LINK_LIBRARIES(mysql ${MY_READLINE_LIBRARY}) SET_TARGET_PROPERTIES(mysql PROPERTIES ENABLE_EXPORTS TRUE) @@ -40,39 +50,40 @@ ENDIF(UNIX) MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test) SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS") -TARGET_LINK_LIBRARIES(mysqltest mysqlclient pcre pcreposix) +TARGET_LINK_LIBRARIES(mysqltest ${CLIENT_LIB} pcre pcreposix) SET_TARGET_PROPERTIES(mysqltest PROPERTIES ENABLE_EXPORTS TRUE) MYSQL_ADD_EXECUTABLE(mysqlcheck mysqlcheck.c) -TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient) +TARGET_LINK_LIBRARIES(mysqlcheck ${CLIENT_LIB}) MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c) -TARGET_LINK_LIBRARIES(mysqldump mysqlclient) +TARGET_LINK_LIBRARIES(mysqldump ${CLIENT_LIB}) + MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c) SET_SOURCE_FILES_PROPERTIES(mysqlimport.c PROPERTIES COMPILE_FLAGS "-DTHREADS") -TARGET_LINK_LIBRARIES(mysqlimport mysqlclient) +TARGET_LINK_LIBRARIES(mysqlimport ${CLIENT_LIB}) MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c COMPONENT Server) -TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient) +TARGET_LINK_LIBRARIES(mysql_upgrade ${CLIENT_LIB}) ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs) MYSQL_ADD_EXECUTABLE(mysqlshow mysqlshow.c) -TARGET_LINK_LIBRARIES(mysqlshow mysqlclient) +TARGET_LINK_LIBRARIES(mysqlshow ${CLIENT_LIB}) MYSQL_ADD_EXECUTABLE(mysql_plugin mysql_plugin.c) -TARGET_LINK_LIBRARIES(mysql_plugin mysqlclient) +TARGET_LINK_LIBRARIES(mysql_plugin ${CLIENT_LIB}) MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc) -TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient) +TARGET_LINK_LIBRARIES(mysqlbinlog ${CLIENT_LIB}) -MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc) -TARGET_LINK_LIBRARIES(mysqladmin mysqlclient) +MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc ../sql/password.c) +TARGET_LINK_LIBRARIES(mysqladmin ${CLIENT_LIB}) MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c) SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS") -TARGET_LINK_LIBRARIES(mysqlslap mysqlclient) +TARGET_LINK_LIBRARIES(mysqlslap ${CLIENT_LIB}) # "WIN32" also covers 64 bit. "echo" is used in some files below "mysql-test/". IF(WIN32) @@ -81,10 +92,16 @@ ENDIF(WIN32) # async_example is just a code example, do not install it. ADD_EXECUTABLE(async_example async_example.c) -TARGET_LINK_LIBRARIES(async_example mysqlclient) +TARGET_LINK_LIBRARIES(async_example ${CLIENT_LIB}) SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap mysql_plugin async_example PROPERTIES HAS_CXX TRUE) + +FOREACH(t mysql mysqltest mysqltest mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysql_plugin mysqlbinlog + mysqladmin mysqlslap async_example) + ADD_DEPENDENCIES(${t} GenError mariadb_connector_c) +ENDFOREACH() + ADD_DEFINITIONS(-DHAVE_DLOPEN) diff --git a/client/client_priv.h b/client/client_priv.h index c0c4954cdf0..1d85791fa73 100644 --- a/client/client_priv.h +++ b/client/client_priv.h @@ -24,6 +24,7 @@ #include <mysql.h> #include <errmsg.h> #include <my_getopt.h> +#include <mysql_version.h> #ifndef WEXITSTATUS # ifdef __WIN__ diff --git a/client/mysql.cc b/client/mysql.cc index 2cc818bd6c1..181320e436e 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1143,6 +1143,9 @@ int main(int argc,char *argv[]) outfile[0]=0; // no (default) outfile strmov(pager, "stdout"); // the default, if --pager wasn't given + + mysql_init(&mysql); + { char *tmp=getenv("PAGER"); if (tmp && strlen(tmp)) @@ -1203,7 +1206,6 @@ int main(int argc,char *argv[]) glob_buffer.realloc(512); completion_hash_init(&ht, 128); init_alloc_root(&hash_mem_root, 16384, 0, MYF(0)); - bzero((char*) &mysql, sizeof(mysql)); if (sql_connect(current_host,current_db,current_user,opt_password, opt_silent)) { @@ -1365,6 +1367,8 @@ static bool do_connect(MYSQL *mysql, const char *host, const char *user, opt_ssl_capath, opt_ssl_cipher); mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); mysql_options(mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + char enforce= 1; + mysql_options(mysql, MYSQL_OPT_SSL_ENFORCE, &enforce); } mysql_options(mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, (char*)&opt_ssl_verify_server_cert); @@ -4617,6 +4621,23 @@ sql_real_connect(char *host,char *database,char *user,char *password, mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS); if (using_opt_local_infile) mysql_options(&mysql,MYSQL_OPT_LOCAL_INFILE, (char*) &opt_local_infile); +#if !defined(EMBEDDED_LIBRARY) + if (opt_use_ssl) + { + mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, + opt_ssl_capath, opt_ssl_cipher); + mysql_options(&mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); + mysql_options(&mysql, MYSQL_OPT_SSL_CRLPATH, opt_ssl_crlpath); + } + mysql_options(&mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, + (my_bool*)&opt_ssl_verify_server_cert); +#endif + if (opt_protocol) + mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); +#ifdef HAVE_SMEM + if (shared_memory_base_name) + mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); +#endif if (safe_updates) { char init_command[100]; @@ -4641,12 +4662,13 @@ sql_real_connect(char *host,char *database,char *user,char *password, } return -1; // Retryable } - - charset_info= mysql.charset; + + charset_info= get_charset_by_name(mysql.charset->name, MYF(0)); + connected=1; #ifndef EMBEDDED_LIBRARY - mysql.reconnect= debug_info_flag; // We want to know if this happens + mysql_options(&mysql, MYSQL_OPT_RECONNECT, &debug_info_flag); /* CLIENT_PROGRESS_OBSOLETE is set only if we requested it in @@ -4655,7 +4677,10 @@ sql_real_connect(char *host,char *database,char *user,char *password, if (mysql.client_flag & CLIENT_PROGRESS_OBSOLETE) mysql_options(&mysql, MYSQL_PROGRESS_CALLBACK, (void*) report_progress); #else - mysql.reconnect= 1; + { + my_bool reconnect= 1; + mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect); + } #endif #ifdef HAVE_READLINE build_completion_hash(opt_rehash, 1); diff --git a/client/mysql_plugin.c b/client/mysql_plugin.c index ebf04c9a8c3..72fa9485c6c 100644 --- a/client/mysql_plugin.c +++ b/client/mysql_plugin.c @@ -20,6 +20,7 @@ #include <mysql.h> #include <my_getopt.h> #include <my_dir.h> +#include <mysql_version.h> #define SHOW_VERSION "1.0.0" #define PRINT_VERSION do { printf("%s Ver %s Distrib %s\n", \ diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index fe9db6ea93d..fcc4e626f2f 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -23,8 +23,10 @@ #include <sys/stat.h> #include <mysql.h> #include <sql_common.h> +#include <mysql_version.h> #include <welcome_copyright_notice.h> #include <my_rnd.h> +#include <password.h> #define ADMIN_VERSION "9.1" #define MAX_MYSQL_VAR 512 @@ -440,7 +442,7 @@ int main(int argc,char *argv[]) didn't signal for us to die. Otherwise, signal failure. */ - if (mysql.net.vio == 0) + if (mysql.net.pvio == 0) { if (option_wait && !interrupted) { @@ -521,7 +523,8 @@ static my_bool sql_connect(MYSQL *mysql, uint wait) if (mysql_real_connect(mysql,host,user,opt_password,NullS,tcp_port, unix_port, CLIENT_REMEMBER_OPTIONS)) { - mysql->reconnect= 1; + my_bool reconnect= 1; + mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect); if (info) { fputs("\n",stderr); @@ -542,16 +545,16 @@ static my_bool sql_connect(MYSQL *mysql, uint wait) { fprintf(stderr, "Check that mysqld is running and that the socket: '%s' exists!\n", - unix_port ? unix_port : mysql_unix_port); + unix_port ? unix_port : MYSQL_UNIX_ADDR); } else if (mysql_errno(mysql) == CR_CONN_HOST_ERROR || mysql_errno(mysql) == CR_UNKNOWN_HOST) { fprintf(stderr,"Check that mysqld is running on %s",host); fprintf(stderr," and that the port is %d.\n", - tcp_port ? tcp_port: mysql_port); + tcp_port ? tcp_port: MYSQL_PORT); fprintf(stderr,"You can check this by doing 'telnet %s %d'\n", - host, tcp_port ? tcp_port: mysql_port); + host, tcp_port ? tcp_port: MYSQL_PORT); } } return 1; @@ -1077,9 +1080,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) } } if (old) - make_scrambled_password_323(crypted_pw, typed_password); + my_make_scrambled_password_323(crypted_pw, typed_password, sizeof(crypted_pw)); else - make_scrambled_password(crypted_pw, typed_password); + my_make_scrambled_password(crypted_pw, typed_password, sizeof(crypted_pw)); } else crypted_pw[0]=0; /* No password */ @@ -1187,7 +1190,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) break; } case ADMIN_PING: - mysql->reconnect=0; /* We want to know of reconnects */ + { + my_bool reconnect= 0; + mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect); if (!mysql_ping(mysql)) { if (option_silent < 2) @@ -1197,7 +1202,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) { if (mysql_errno(mysql) == CR_SERVER_GONE_ERROR) { - mysql->reconnect=1; + reconnect= 1; + mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect); if (!mysql_ping(mysql)) puts("connection was down, but mysqld is now alive"); } @@ -1208,8 +1214,10 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) return -1; } } - mysql->reconnect=1; /* Automatic reconnect is default */ + reconnect=1; /* Automatic reconnect is default */ + mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect); break; + } default: my_printf_error(0, "Unknown command: '%-.60s'", error_flags, argv[0]); return 1; diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index fa75c423d1b..b3c73d3ce68 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -52,14 +52,18 @@ #include <algorithm> +#ifdef LIBMARIADB +#define my_net_write ma_net_write +#define net_flush ma_net_flush +#define net_safe_read ma_net_safe_read +#define my_net_read ma_net_read +#endif + Rpl_filter *binlog_filter= 0; #define BIN_LOG_HEADER_SIZE 4 #define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+4) - -#define CLIENT_CAPABILITIES (CLIENT_LONG_PASSWORD | CLIENT_LONG_FLAG | CLIENT_LOCAL_FILES) - /* Needed for Rpl_filter */ CHARSET_INFO* system_charset_info= &my_charset_utf8_general_ci; @@ -86,6 +90,11 @@ static const char *load_groups[]= static void error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2); static void warning(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2); + +extern "C" ulong my_net_read(NET *net); +extern "C" unsigned char *mysql_net_store_length(unsigned char *packet, size_t length); +#define net_store_length mysql_net_store_length + static bool one_database=0, to_last_remote_log= 0, disable_log_bin= 0; static bool opt_hexdump= 0, opt_version= 0; const char *base64_output_mode_names[]= @@ -1764,6 +1773,7 @@ static int parse_args(int *argc, char*** argv) */ static Exit_status safe_connect() { + my_bool reconnect= 1; /* Close any old connections to MySQL */ if (mysql) mysql_close(mysql); @@ -1809,7 +1819,7 @@ static Exit_status safe_connect() error("Failed on connect: %s", mysql_error(mysql)); return ERROR_STOP; } - mysql->reconnect= 1; + mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect); return OK_CONTINUE; } @@ -2273,7 +2283,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info, for (;;) { - len= cli_safe_read(mysql); + len= net_safe_read(mysql); if (len == packet_error) { error("Got error reading packet from server: %s", mysql_error(mysql)); @@ -2843,6 +2853,8 @@ struct encryption_service_st encryption_handler= #include "my_decimal.h" #include "decimal.c" #include "my_decimal.cc" +#include "../sql-common/my_time.c" +#include "password.c" #include "log_event.cc" #include "log_event_old.cc" #include "rpl_utility.cc" diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 3e821b183bd..f0f25dbeb71 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -1086,6 +1086,7 @@ static void print_result() static int dbConnect(char *host, char *user, char *passwd) { + my_bool reconnect= 1; DBUG_ENTER("dbConnect"); if (verbose > 1) { @@ -1124,7 +1125,7 @@ static int dbConnect(char *host, char *user, char *passwd) DBerror(&mysql_connection, "when trying to connect"); DBUG_RETURN(1); } - mysql_connection.reconnect= 1; + mysql_options(&mysql_connection, MYSQL_OPT_RECONNECT, &reconnect); DBUG_RETURN(0); } /* dbConnect */ diff --git a/client/mysqldump.c b/client/mysqldump.c index 60f244bf591..acb72a12bf3 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1643,6 +1643,7 @@ static void maybe_exit(int error) static int connect_to_db(char *host, char *user,char *passwd) { char buff[20+FN_REFLEN]; + my_bool reconnect; DBUG_ENTER("connect_to_db"); verbose_msg("-- Connecting to %s...\n", host ? host : "localhost"); @@ -1697,7 +1698,8 @@ static int connect_to_db(char *host, char *user,char *passwd) As we're going to set SQL_MODE, it would be lost on reconnect, so we cannot reconnect. */ - mysql->reconnect= 0; + reconnect= 0; + mysql_options(&mysql_connection, MYSQL_OPT_RECONNECT, &reconnect); my_snprintf(buff, sizeof(buff), "/*!40100 SET @@SQL_MODE='%s' */", compatible_mode_normal_str); if (mysql_query_with_error_report(mysql, 0, buff)) diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 5b15155e039..37807a4eea5 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -419,6 +419,7 @@ static MYSQL *db_connect(char *host, char *database, char *user, char *passwd) { MYSQL *mysql; + my_bool reconnect; if (verbose) fprintf(stdout, "Connecting to %s\n", host ? host : "localhost"); if (!(mysql= mysql_init(NULL))) @@ -463,7 +464,8 @@ static MYSQL *db_connect(char *host, char *database, ignore_errors=0; /* NO RETURN FROM db_error */ db_error(mysql); } - mysql->reconnect= 0; + reconnect= 0; + mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect); if (verbose) fprintf(stdout, "Selecting database %s\n", database); if (mysql_select_db(mysql, database)) diff --git a/client/mysqlshow.c b/client/mysqlshow.c index eec4a8d3268..e3e30abc426 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -68,6 +68,7 @@ int main(int argc, char **argv) my_bool first_argument_uses_wildcards=0; char *wild; MYSQL mysql; + my_bool reconnect; static char **defaults_argv; MY_INIT(argv[0]); sf_leaking_memory=1; /* don't report memory leaks on early exits */ @@ -155,7 +156,8 @@ int main(int argc, char **argv) error= 1; goto error; } - mysql.reconnect= 1; + reconnect= 1; + mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect); switch (argc) { case 0: error=list_dbs(&mysql,wild); break; diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 4ff408bfa9d..92f602c2444 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -190,6 +190,8 @@ static char global_subst_from[200]; static char global_subst_to[200]; static char *global_subst= NULL; static MEM_ROOT require_file_root; +static const my_bool my_true= 1; +static const my_bool my_false= 0; /* Block stack */ enum block_cmd { @@ -5405,18 +5407,6 @@ static char *get_string(char **to_ptr, char **from_ptr, } -void set_reconnect(MYSQL* mysql, my_bool val) -{ - my_bool reconnect= val; - DBUG_ENTER("set_reconnect"); - DBUG_PRINT("info", ("val: %d", (int) val)); -#if MYSQL_VERSION_ID < 50000 - mysql->reconnect= reconnect; -#else - mysql_options(mysql, MYSQL_OPT_RECONNECT, (char *)&reconnect); -#endif - DBUG_VOID_RETURN; -} /** @@ -5501,11 +5491,7 @@ void do_close_connection(struct st_command *command) #ifndef EMBEDDED_LIBRARY if (command->type == Q_DIRTY_CLOSE) { - if (con->mysql->net.vio) - { - vio_delete(con->mysql->net.vio); - con->mysql->net.vio = 0; - } + mariadb_cancel(con->mysql); } #endif /*!EMBEDDED_LIBRARY*/ if (con->stmt) @@ -8229,10 +8215,18 @@ end: revert_properties(); /* Close the statement if reconnect, need new prepare */ - if (mysql->reconnect) { - mysql_stmt_close(stmt); - cn->stmt= NULL; +#ifndef EMBEDDED_LIBRARY + my_bool reconnect; + mysql_get_option(mysql, MYSQL_OPT_RECONNECT, &reconnect); + if (reconnect) +#else + if (mysql->reconnect) +#endif + { + mysql_stmt_close(stmt); + cn->stmt= NULL; + } } DBUG_VOID_RETURN; @@ -8764,7 +8758,7 @@ static void dump_backtrace(void) #endif } fputs("Attempting backtrace...\n", stderr); - my_print_stacktrace(NULL, my_thread_stack_size); + my_print_stacktrace(NULL, (ulong)my_thread_stack_size); } #else @@ -9407,10 +9401,10 @@ int main(int argc, char **argv) non_blocking_api_enabled= 1; break; case Q_DISABLE_RECONNECT: - set_reconnect(cur_con->mysql, 0); + mysql_options(cur_con->mysql, MYSQL_OPT_RECONNECT, &my_false); break; case Q_ENABLE_RECONNECT: - set_reconnect(cur_con->mysql, 1); + mysql_options(cur_con->mysql, MYSQL_OPT_RECONNECT, &my_true); /* Close any open statements - no reconnect, need new prepare */ close_statements(); break; diff --git a/cmake/iconv.cmake b/cmake/iconv.cmake new file mode 100644 index 00000000000..f6afd9d102a --- /dev/null +++ b/cmake/iconv.cmake @@ -0,0 +1,78 @@ +# +# Copyright (c) 2010 Michael Bell <michael.bell@web.de> +# 2015-2016 MariaDB Corporation AB + +if (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + # Already in cache, be silent + set(ICONV_FIND_QUIETLY TRUE) +endif (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + + +IF(CMAKE_SYSTEM_NAME MATCHES "SunOS") + # There is some libiconv.so in /usr/local that must + # be avoided, iconv routines are in libc + find_library(ICONV_LIBRARIES NAMES c) +ELSEIF(APPLE) + find_path(ICONV_INCLUDE_DIR iconv.h PATHS + /usr/include/ + /opt/local/include/ + ) + find_library(ICONV_LIBRARIES NAMES iconv libiconv PATHS + /usr/lib/ + /opt/local/lib/ + ) + SET(ICONV_EXTERNAL TRUE) +ELSE() + find_path(ICONV_INCLUDE_DIR iconv.h) + find_library(ICONV_LIBRARIES NAMES iconv libiconv libiconv-2) + IF(ICONV_LIBRARIES) + SET(ICONV_EXTERNAL TRUE) + ELSE() + find_library(ICONV_LIBRARIES NAMES c) + ENDIF() +ENDIF() + +if (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + set (ICONV_FOUND TRUE) +endif (ICONV_INCLUDE_DIR AND ICONV_LIBRARIES) + +set(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) +IF(ICONV_EXTERNAL) + set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) +ENDIF() + +if (ICONV_FOUND) + include(CheckCSourceCompiles) + CHECK_C_SOURCE_COMPILES(" + #include <iconv.h> + int main(){ + iconv_t conv = 0; + const char* in = 0; + size_t ilen = 0; + char* out = 0; + size_t olen = 0; + iconv(conv, &in, &ilen, &out, &olen); + return 0; + } +" ICONV_SECOND_ARGUMENT_IS_CONST ) +endif (ICONV_FOUND) + +set (CMAKE_REQUIRED_INCLUDES) +set (CMAKE_REQUIRED_LIBRARIES) + +if (ICONV_FOUND) + if (NOT ICONV_FIND_QUIETLY) + message (STATUS "Found Iconv: ${ICONV_LIBRARIES}") + endif (NOT ICONV_FIND_QUIETLY) +else (ICONV_FOUND) + if (Iconv_FIND_REQUIRED) + message (FATAL_ERROR "Could not find Iconv") + endif (Iconv_FIND_REQUIRED) +endif (ICONV_FOUND) + +MARK_AS_ADVANCED( + ICONV_INCLUDE_DIR + ICONV_LIBRARIES + ICONV_EXTERNAL + ICONV_SECOND_ARGUMENT_IS_CONST +) diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in index f35d16834b6..32ea5b130ad 100644 --- a/cmake/make_dist.cmake.in +++ b/cmake/make_dist.cmake.in @@ -28,6 +28,7 @@ SET(TAR_EXECUTABLE "@TAR_EXECUTABLE@") SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@") SET(CMAKE_MAKE_PROGRAM "@CMAKE_MAKE_PROGRAM@") SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@") +SET(CONNECTOR_C_GIT_TAG "@CONNECTOR_C_GIT_TAG@") SET(VERSION "@VERSION@") @@ -46,9 +47,16 @@ IF(GIT_EXECUTABLE) WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} RESULT_VARIABLE RESULT ) - + IF(RESULT EQUAL 0) + MESSAGE(STATUS "Cloning Connector/C ") + EXECUTE_PROCESS( + COMMAND "${GIT_EXECUTABLE}" clone https://github.com/MariaDB/mariadb-connector-c -b ${CONNECTOR_C_GIT_TAG} + WORKING_DIRECTORY ${PACKAGE_DIR} + RESULT_VARIABLE RESULT + ) + ENDIF() IF(NOT RESULT EQUAL 0) - SET(GIT_EXECUTABLE) + SET(GIT_EXECUTABLE) ENDIF() ENDIF() diff --git a/cmake/mariadb_connector_c.cmake b/cmake/mariadb_connector_c.cmake new file mode 100644 index 00000000000..33062c011bd --- /dev/null +++ b/cmake/mariadb_connector_c.cmake @@ -0,0 +1,27 @@ +# +# Configuration options for Connector/C +# +IF(WIN32) + # todo: libcurl for windows +ELSE() + SET(CC_LIBS ${LIBDL} ${LIBM} ${LIBPTHREAD}) + FIND_PACKAGE(OpenSSL) + #FIND_PACKAGE(GnuTLS) + IF(OPENSSL_FOUND) + SET(CC_LIBS ${CC_LIBS} ${OPENSSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES}) + SET(CC_CMAKE_OPTS "-DWITH_SSL=OPENSSL") + ELSEIF (GNUTLS_FOUND) + SET(CC_LIBS ${CC_LIBS} ${GNUTLS_LIBRARY}) + SET(CC_CMAKE_OPTS "-DWITH_SSL=GNUTLS") + ELSE() + SET(CC_CMAKE_OPTS "-DWITH_SSL=OFF") + ENDIF() + INCLUDE(${CMAKE_SOURCE_DIR}/cmake/iconv.cmake) + IF(ICONV_FOUND) + IF(ICONV_EXTERNAL) + SET(CC_LIBS ${CC_LIBS} ${ICONV_LIBRARIES}) + ENDIF() + ENDIF() +ENDIF() +MARK_AS_ADVANCED(CC_LIBS CC_CMAKE_OPTS) + diff --git a/include/my_global.h b/include/my_global.h index 1cf3f217549..a3d6ebba96e 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1250,4 +1250,13 @@ static inline double rint(double x) #endif #endif +#define FLOATING_POINT_DECIMALS 31 + +/* Keep client compatible with earlier versions */ +#ifdef MYSQL_SERVER +#define NOT_FIXED_DEC DECIMAL_NOT_SPECIFIED +#else +#define NOT_FIXED_DEC FLOATING_POINT_DECIMALS +#endif + #endif /* my_global_h */ diff --git a/include/my_sys.h b/include/my_sys.h index 7b7158573b4..25554701a8c 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -1019,6 +1019,7 @@ extern void add_compiled_collation(struct charset_info_st *cs); extern size_t escape_string_for_mysql(CHARSET_INFO *charset_info, char *to, size_t to_length, const char *from, size_t length); +extern char *get_tty_password(const char *opt_message); #ifdef __WIN__ #define BACKSLASH_MBTAIL /* File system character set */ diff --git a/include/mysql.h b/include/mysql.h index 19099b4f404..314cc40dd6c 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -351,10 +351,6 @@ typedef struct st_mysql_parameters */ #define MYSQL_WAIT_TIMEOUT 8 -#if !defined(MYSQL_SERVER) && !defined(EMBEDDED_LIBRARY) -#define max_allowed_packet (*mysql_get_parameters()->p_max_allowed_packet) -#define net_buffer_length (*mysql_get_parameters()->p_net_buffer_length) -#endif /* Set up and bring down the server; to ensure that applications will @@ -862,6 +858,7 @@ void STDCALL mysql_close(MYSQL *sock); int STDCALL mysql_close_start(MYSQL *sock); int STDCALL mysql_close_cont(MYSQL *sock, int status); my_socket STDCALL mysql_get_socket(const MYSQL *mysql); +int STDCALL mysql_cancel(MYSQL *mysql); unsigned int STDCALL mysql_get_timeout_value(const MYSQL *mysql); unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql); diff --git a/include/mysql_com.h b/include/mysql_com.h index c65c5de7f66..7003e7b6bd7 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -654,12 +654,5 @@ uchar *safe_net_store_length(uchar *pkg, size_t pkg_len, ulonglong length); decimals */ -#define FLOATING_POINT_DECIMALS 31 -/* Keep client compatible with earlier versions */ -#ifdef MYSQL_SERVER -#define NOT_FIXED_DEC DECIMAL_NOT_SPECIFIED -#else -#define NOT_FIXED_DEC FLOATING_POINT_DECIMALS -#endif #endif diff --git a/include/sql_common.h b/include/sql_common.h index 39b8ce18517..b1fc89e9104 100644 --- a/include/sql_common.h +++ b/include/sql_common.h @@ -77,9 +77,13 @@ typedef struct st_mysql_methods #endif } MYSQL_METHODS; +#ifdef LIBMARIADB +#define simple_command(mysql, command, arg, length, skip_check) ma_simple_command(mysql, command, (char *)arg, length, skip_check, NULL) +#else #define simple_command(mysql, command, arg, length, skip_check) \ (*(mysql)->methods->advanced_command)(mysql, command, 0, \ 0, arg, length, skip_check, NULL) +#endif #define stmt_command(mysql, command, arg, length, stmt) \ (*(mysql)->methods->advanced_command)(mysql, command, 0, \ 0, arg, length, 1, stmt) @@ -110,7 +114,7 @@ void set_mysql_extended_error(MYSQL *mysql, int errcode, const char *sqlstate, /* client side of the pluggable authentication */ struct st_plugin_vio_info; -void mpvio_info(Vio *vio, struct st_plugin_vio_info *info); + int run_plugin_auth(MYSQL *mysql, char *data, uint data_len, const char *data_plugin, const char *db); int mysql_client_plugin_init(); diff --git a/include/sslopt-vars.h b/include/sslopt-vars.h index 8e669760faf..5f55aaf7c5b 100644 --- a/include/sslopt-vars.h +++ b/include/sslopt-vars.h @@ -35,3 +35,4 @@ SSL_STATIC my_bool opt_ssl_verify_server_cert= 0; #endif #endif #endif /* SSLOPT_VARS_INCLUDED */ + diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt new file mode 100644 index 00000000000..1f6b299d4d8 --- /dev/null +++ b/libmariadb/CMakeLists.txt @@ -0,0 +1,127 @@ +INCLUDE(${CMAKE_SOURCE_DIR}/cmake/mariadb_connector_c.cmake) + +SET(CONNECTOR_C_INSTALLDIR "${CMAKE_CURRENT_BINARY_DIR}/mariadb-connector-c/${CMAKE_CFG_INTDIR}" CACHE STRING "") +SET(CONNECTOR_C_INSTALL_PREFIX ${CONNECTOR_C_INSTALLDIR}) + + +IF(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".") + STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${BUILD_TYPE}" CONNECTOR_C_INSTALL_PREFIX "${CONNECTOR_C_INSTALLDIR}") +ENDIF() + +SET(CONNECTOR_C_GIT_TAG "v3.0-cc-server-integ-0" CACHE STRING "Git tag or branch for connector/c") +IF(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/mariadb-connector-c) + # Building from source package + SET(CONNECTOR_C_SOURCE_DIR ${CMAKE_SOURCE_DIR}/mariadb-connector-c) + SET(GIT_PARAMS) +ELSE() + # Building from git, use git to get Connector/C + SET(GIT_PARAMS + GIT_REPOSITORY "https://github.com/MariaDB/mariadb-connector-c/" + GIT_TAG ${CONNECTOR_C_GIT_TAG} + ) + SET(CONNECTOR_C_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/mariadb-connector-c-src) +ENDIF() + +IF(TARGET zlib) + GET_PROPERTY(ZLIB_LIBRARY_LOCATION TARGET zlib PROPERTY LOCATION) +ELSE() + SET(ZLIB_LIBRARY_LOCATION ${ZLIB_LIBRARY}) +ENDIF() + + +INCLUDE(ExternalProject) +ExternalProject_Add( + mariadb_connector_c + ${GIT_PARAMS} + UPDATE_COMMAND "" + PATCH_COMMAND "" + SOURCE_DIR ${CONNECTOR_C_SOURCE_DIR} + INSTALL_DIR ${CONNECTOR_C_INSTALLDIR} + CMAKE_ARGS ${CC_CMAKE_OPTS} + -DCMAKE_INSTALL_PREFIX=${CONNECTOR_C_INSTALL_PREFIX} + -DWITH_EXTERNAL_ZLIB=1 + -DZLIB_FOUND=1 + -DZLIB_LIBRARY=${ZLIB_LIBRARY_LOCATION} + -DZLIB_INCLUDE_DIR=${ZLIB_INCLUDE_DIR} + -DSKIP_TESTS=1 + -DMARIADB_PORT=${MYSQL_TCP_PORT} + -DMARIADB_UNIX_ADDR=${MYSQL_UNIX_ADDR} + -DSHARED_LIB_MAJOR_VERSION=${SHARED_LIB_MAJOR_VERSION} + -DPLUGINDIR=${INSTALL_PLUGINDIR} + -DFOR_SERVER=1 + TEST_COMMAND "" +) + +IF(TARGET zlib) + ADD_DEPENDENCIES(mariadb_connector_c zlib) +ENDIF() + +SET(STATIC_LIB_LOCATION "${CONNECTOR_C_INSTALLDIR}/lib/mariadb/${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient${CMAKE_STATIC_LIBRARY_SUFFIX}") + +IF(WIN32) + SET(SHARED_LIB_LOCATION "${CONNECTOR_C_INSTALLDIR}/lib/mariadb/libmysql${CMAKE_SHARED_LIBRARY_SUFFIX}") +ELSE() + SET(SHARED_LIB_LOCATION "${CONNECTOR_C_INSTALLDIR}/lib/mariadb/libmysqlclient${CMAKE_SHARED_LIBRARY_SUFFIX}") +ENDIF() +IF(WIN32) + # On Windows, we need to install import library. We also install PDB for debugging + STRING(REPLACE ".dll" ".lib" IMPORT_LIB_LOCATION ${SHARED_LIB_LOCATION}) + STRING(REPLACE ".dll" ".pdb" PDB_LOCATION ${SHARED_LIB_LOCATION}) +ENDIF() + +ADD_LIBRARY(mariadbclient STATIC IMPORTED GLOBAL) +SET_TARGET_PROPERTIES(mariadbclient PROPERTIES IMPORTED_LOCATION ${STATIC_LIB_LOCATION}) +ADD_DEPENDENCIES(mariadbclient mariadb_connector_c GenError) + +ADD_LIBRARY(libmariadb SHARED IMPORTED GLOBAL) +SET_TARGET_PROPERTIES(libmariadb PROPERTIES IMPORTED_LOCATION ${SHARED_LIB_LOCATION}) +ADD_DEPENDENCIES(libmariadb mariadb_connector_c GenError) + +SET(CONNECTOR_C_LIBS ${STATIC_LIB_LOCATION} ${CC_LIBS} ${ZLIB_LIBRARY} PARENT_SCOPE) + + +# INSTALL Connector/C files + +# For multiconfig generators (Visual Studio and Xcode) +# we need to replace CMAKE_CFG_INTDIR in filepath with CMAKE_INSTALL_CONFIG_NAME +# for cpack. +FUNCTION(GET_INSTALL_LOCATION LOC VARNAME) + SET(val ${LOC}) + IF (NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".") + STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}" val ${val}) + ENDIF() + SET(${VARNAME} ${val} PARENT_SCOPE) +ENDFUNCTION() + +GET_INSTALL_LOCATION(${STATIC_LIB_LOCATION} STATIC_LIB_INSTALL_LOCATION) +INSTALL(FILES ${STATIC_LIB_INSTALL_LOCATION} DESTINATION ${INSTALL_LIBDIR} COMPONENT Development) + +IF(UNIX) + STRING(REPLACE "mysqlclient" "mysqlclient_r" + STATIC_LIB_R_INSTALL_LOCATION "${STATIC_LIB_INSTALL_LOCATION}") + INSTALL(FILES ${STATIC_LIB_R_INSTALL_LOCATION} OPTIONAL DESTINATION ${INSTALL_LIBDIR} COMPONENT Development) +ENDIF() + +# Install shared library +IF(WIN32) + # On Windows, we need to install import library. We also install PDB for debugging + SET(SHARED_LIB_FILES ${SHARED_LIB_LOCATION} ${IMPLIB_LOCATION} ${PDB_LOCATION}) +ELSE() + STRING(REPLACE "mysqlclient" "mysqlclient_r" SHARED_LIB_R_LOCATION ${SHARED_LIB_LOCATION}) + STRING(REPLACE "mysqlclient.so" "mysqlclient.so.${SHARED_LIB_MAJOR_VERSION}" + SHARED_LIB_LINK1_LOCATION ${SHARED_LIB_LOCATION}) + STRING(REPLACE "mysqlclient.so" "mysqlclient.so.${SHARED_LIB_MAJOR_VERSION}.0.0" + SHARED_LIB_LINK2_LOCATION ${SHARED_LIB_LOCATION}) + + SET(SHARED_LIB_FILES ${SHARED_LIB_LOCATION} ${SHARED_LIB_R_LOCATION} + ${SHARED_LIB_LINK1_LOCATION} ${SHARED_LIB_LINK2_LOCATION}) + LIST(REMOVE_DUPLICATES SHARED_LIB_FILES) +ENDIF() + +FOREACH(file ${SHARED_LIB_FILES}) + GET_INSTALL_LOCATION(${file} loc) + IF(loc) + INSTALL(FILES ${loc} DESTINATION ${INSTALL_LIBDIR} COMPONENT SharedLibraries OPTIONAL) + ENDIF() +ENDFOREACH() + diff --git a/libmysql/CMakeLists.txt b/libmysql/CMakeLists.txt index 5eb89c19f45..41710bf08a7 100644 --- a/libmysql/CMakeLists.txt +++ b/libmysql/CMakeLists.txt @@ -424,101 +424,4 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux") SET(VERSION_SCRIPT_LINK_FLAGS "-Wl,${CMAKE_CURRENT_BINARY_DIR}/libmysql_versions.ld") -ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") - - -SET(CLIENT_SOURCES - get_password.c - libmysql.c - errmsg.c - ../sql-common/client.c - ../sql-common/mysql_async.c - ../sql-common/my_time.c - ../sql-common/client_plugin.c - ../sql/net_serv.cc - ../sql-common/pack.c - ../sql/password.c - ${CLIENT_SOURCES_EXTRA} -) -ADD_CONVENIENCE_LIBRARY(clientlib ${CLIENT_SOURCES}) -DTRACE_INSTRUMENT(clientlib) -ADD_DEPENDENCIES(clientlib GenError) - -SET(LIBS clientlib dbug strings vio mysys mysys_ssl ${ZLIB_LIBRARY} ${SSL_LIBRARIES} ${LIBDL} ${CRC32_VPMSUM_LIBRARY}) - -# Merge several convenience libraries into one big mysqlclient -# and link them together into shared library. -MERGE_LIBRARIES(mysqlclient STATIC ${LIBS} COMPONENT Development) - -# Visual Studio users need debug static library for debug projects -IF(MSVC) - INSTALL_DEBUG_TARGET(mysqlclient DESTINATION ${INSTALL_LIBDIR}/debug) - INSTALL_DEBUG_TARGET(clientlib DESTINATION ${INSTALL_LIBDIR}/debug) -ENDIF() - -IF(UNIX) - MACRO(GET_VERSIONED_LIBNAME LIBNAME EXTENSION VERSION OUTNAME) - SET(DOT_VERSION ".${VERSION}") - IF(DOT_VERSION STREQUAL ".") - SET(DOT_VERSION "") - ENDIF() - IF(APPLE) - SET(${OUTNAME} ${LIBNAME}${DOT_VERSION}${EXTENSION}) - ELSE() - SET(${OUTNAME} ${LIBNAME}${EXTENSION}${DOT_VERSION}) - ENDIF() - ENDMACRO() - INSTALL_SYMLINK(${CMAKE_STATIC_LIBRARY_PREFIX}mysqlclient_r.a mysqlclient ${INSTALL_LIBDIR} Development) -ENDIF() - -IF(NOT DISABLE_SHARED) - MERGE_LIBRARIES(libmysql SHARED ${LIBS} - EXPORTS ${CLIENT_API_FUNCTIONS} ${CLIENT_API_5_1_EXTRA} ${CLIENT_API_5_5_EXTRA} - COMPONENT SharedLibraries) - IF(UNIX) - # libtool compatability - IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD" OR APPLE) - SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}") - ELSEIF(CMAKE_SYSTEM_NAME MATCHES "HP-UX") - SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}.0") - ELSE() - SET(OS_SHARED_LIB_VERSION "${SHARED_LIB_MAJOR_VERSION}.0.0") - ENDIF() - # Name of shared library is mysqlclient on Unix - SET_TARGET_PROPERTIES(libmysql PROPERTIES - OUTPUT_NAME mysqlclient - VERSION "${OS_SHARED_LIB_VERSION}" - SOVERSION "${SHARED_LIB_MAJOR_VERSION}") - IF(LINK_FLAG_NO_UNDEFINED OR VERSION_SCRIPT_LINK_FLAGS) - GET_TARGET_PROPERTY(libmysql_link_flags libmysql LINK_FLAGS) - IF(NOT libmysql_link_flags) - # Avoid libmysql_link_flags-NOTFOUND - SET(libmysql_link_flags) - ENDIF() - SET_TARGET_PROPERTIES(libmysql PROPERTIES LINK_FLAGS - "${libmysql_link_flags} ${LINK_FLAG_NO_UNDEFINED} ${VERSION_SCRIPT_LINK_FLAGS}") - ENDIF() - # clean direct output needs to be set several targets have the same name - #(mysqlclient in this case) - SET_TARGET_PROPERTIES(mysqlclient PROPERTIES CLEAN_DIRECT_OUTPUT 1) - SET_TARGET_PROPERTIES(libmysql PROPERTIES CLEAN_DIRECT_OUTPUT 1) - - # Install links to libmysqlclient.so (client_r) - GET_VERSIONED_LIBNAME( - "${CMAKE_SHARED_LIBRARY_PREFIX}mysqlclient_r" - "${CMAKE_SHARED_LIBRARY_SUFFIX}" - "" - linkname) - INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries) - SET(OS_SHARED_LIB_SYMLINKS "${SHARED_LIB_MAJOR_VERSION}" "${OS_SHARED_LIB_VERSION}") - LIST(REMOVE_DUPLICATES OS_SHARED_LIB_SYMLINKS) - FOREACH(ver ${OS_SHARED_LIB_SYMLINKS}) - GET_VERSIONED_LIBNAME( - "${CMAKE_SHARED_LIBRARY_PREFIX}mysqlclient_r" - "${CMAKE_SHARED_LIBRARY_SUFFIX}" - "${ver}" - linkname) - INSTALL_SYMLINK(${linkname} libmysql ${INSTALL_LIBDIR} SharedLibraries) - ENDFOREACH() - ENDIF() ENDIF() diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 368f30f8317..688522a6cd6 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -37,8 +37,8 @@ ${CMAKE_BINARY_DIR}/sql/lex_hash.h SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES} PROPERTIES GENERATED TRUE) SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc - ../libmysql/libmysql.c ../libmysql/errmsg.c ../client/get_password.c - ../sql-common/client.c ../sql-common/my_time.c + ../libmysql/libmysql.c ../libmysql/errmsg.c ../mysys/get_password.c + ../sql-common/client.c ../sql-common/my_user.c ../sql-common/pack.c ../sql-common/client_plugin.c ../sql-common/mysql_async.c ../sql/password.c ../sql/discover.cc ../sql/derror.cc diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 4a84e63f222..311dc0a5b9a 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -647,7 +647,7 @@ void end_embedded_server() void init_embedded_mysql(MYSQL *mysql, int client_flag) { THD *thd = (THD *)mysql->thd; - thd->mysql= mysql; + thd->emb_mysql= mysql; mysql->server_version= server_version; mysql->client_flag= client_flag; init_alloc_root(&mysql->field_alloc, 8192, 0, MYF(0)); @@ -929,7 +929,7 @@ static bool write_eof_packet(THD *thd, uint server_status, uint statement_warn_count) { - if (!thd->mysql) // bootstrap file handling + if (!thd->emb_mysql) // bootstrap file handling return FALSE; /* The following test should never be true, but it's better to do it @@ -1013,7 +1013,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags) MYSQL_DATA *data; DBUG_ENTER("send_result_set_metadata"); - if (!thd->mysql) // bootstrap file handling + if (!thd->emb_mysql) // bootstrap file handling DBUG_RETURN(0); if (begin_dataset()) @@ -1118,7 +1118,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags) bool Protocol::write() { - if (!thd->mysql) // bootstrap file handling + if (!thd->emb_mysql) // bootstrap file handling return false; *next_field= 0; @@ -1176,7 +1176,7 @@ net_send_ok(THD *thd, { DBUG_ENTER("emb_net_send_ok"); MYSQL_DATA *data; - MYSQL *mysql= thd->mysql; + MYSQL *mysql= thd->emb_mysql; if (!mysql) // bootstrap file handling DBUG_RETURN(FALSE); @@ -1220,7 +1220,7 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err, MYSQL_DATA *data= thd->cur_data; struct embedded_query_result *ei; - if (!thd->mysql) // bootstrap file handling + if (!thd->emb_mysql) // bootstrap file handling { fprintf(stderr, "ERROR: %d %s\n", sql_errno, err); return TRUE; @@ -1250,7 +1250,7 @@ void Protocol_text::prepare_for_resend() MYSQL_DATA *data= thd->cur_data; DBUG_ENTER("send_data"); - if (!thd->mysql) // bootstrap file handling + if (!thd->emb_mysql) // bootstrap file handling DBUG_VOID_RETURN; data->rows++; @@ -1283,7 +1283,7 @@ bool Protocol_text::store_null() bool Protocol::net_store_data(const uchar *from, size_t length) { char *field_buf; - if (!thd->mysql) // bootstrap file handling + if (!thd->emb_mysql) // bootstrap file handling return FALSE; if (!(field_buf= (char*) alloc_root(alloc, length + sizeof(uint) + 1))) @@ -1306,7 +1306,7 @@ bool Protocol::net_store_data_cs(const uchar *from, size_t length, uint conv_length= to_cs->mbmaxlen * length / from_cs->mbminlen; uint dummy_error; char *field_buf; - if (!thd->mysql) // bootstrap file handling + if (!thd->emb_mysql) // bootstrap file handling return false; if (!(field_buf= (char*) alloc_root(alloc, conv_length + sizeof(uint) + 1))) diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index 12c91721381..f28c399ce74 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -4,25 +4,25 @@ drop table if exists t1; create table t1(f1 int); insert into t1 values (5); grant select on test.* to ssl_user1@localhost require SSL; -grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA"; -grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client"; -grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB"; -grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx"; +grant select on test.* to ssl_user2@localhost require cipher "AES256-SHA"; +grant select on test.* to ssl_user3@localhost require cipher "AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client"; +grant select on test.* to ssl_user4@localhost require cipher "AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB"; +grant select on test.* to ssl_user5@localhost require cipher "AES256-SHA" AND SUBJECT "xxx"; flush privileges; -connect con1,localhost,ssl_user1,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA; +connect con1,localhost,ssl_user1,,,,,SSL-CIPHER=AES256-SHA; connect(localhost,ssl_user2,,test,MASTER_PORT,MASTER_SOCKET); -connect con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-SHA; +connect con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES128-SHA; ERROR 28000: Access denied for user 'ssl_user2'@'localhost' (using password: NO) -connect con2,localhost,ssl_user2,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA; -connect con3,localhost,ssl_user3,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA; -connect con4,localhost,ssl_user4,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA; +connect con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-SHA; +connect con3,localhost,ssl_user3,,,,,SSL-CIPHER=AES256-SHA; +connect con4,localhost,ssl_user4,,,,,SSL-CIPHER=AES256-SHA; connect(localhost,ssl_user5,,test,MASTER_PORT,MASTER_SOCKET); -connect con5,localhost,ssl_user5,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA; +connect con5,localhost,ssl_user5,,,,,SSL-CIPHER=AES256-SHA; ERROR 28000: Access denied for user 'ssl_user5'@'localhost' (using password: NO) connection con1; SHOW STATUS LIKE 'Ssl_cipher'; Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +Ssl_cipher AES256-SHA select * from t1; f1 5 @@ -31,7 +31,7 @@ ERROR 42000: DELETE command denied to user 'ssl_user1'@'localhost' for table 't1 connection con2; SHOW STATUS LIKE 'Ssl_cipher'; Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +Ssl_cipher AES256-SHA select * from t1; f1 5 @@ -40,7 +40,7 @@ ERROR 42000: DELETE command denied to user 'ssl_user2'@'localhost' for table 't1 connection con3; SHOW STATUS LIKE 'Ssl_cipher'; Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +Ssl_cipher AES256-SHA select * from t1; f1 5 @@ -49,7 +49,7 @@ ERROR 42000: DELETE command denied to user 'ssl_user3'@'localhost' for table 't1 connection con4; SHOW STATUS LIKE 'Ssl_cipher'; Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +Ssl_cipher AES256-SHA select * from t1; f1 5 @@ -66,15 +66,13 @@ drop table t1; mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx -SSL error: Unable to get private key from '' -mysqltest: Could not open connection 'default': 2026 SSL connection error: Unable to get private key -SSL error: Unable to get certificate from '' -mysqltest: Could not open connection 'default': 2026 SSL connection error: Unable to get certificate +mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx +mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx SHOW STATUS LIKE 'Ssl_cipher'; Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +Ssl_cipher AES256-SHA +have_ssl +1 End of 5.0 tests DROP TABLE IF EXISTS thread_status; DROP EVENT IF EXISTS event_status; @@ -102,8 +100,7 @@ Ssl_cipher AES128-SHA SHOW STATUS LIKE 'Ssl_cipher'; Variable_name Value Ssl_cipher AES128-SHA -mysqltest: Could not open connection 'default': 2026 SSL connection error: Failed to set ciphers to use -CREATE TABLE t1(a int); +mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxxCREATE TABLE t1(a int); INSERT INTO t1 VALUES (1), (2); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; @@ -207,22 +204,21 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -SSL error: Unable to get private key from 'MYSQL_TEST_DIR/std_data/client-cert.pem' -mysqldump: Got error: 2026: "SSL connection error: Unable to get private key" when trying to connect +mysqldump: Got error: 2026: SSL connection error: xxxx DROP TABLE t1; Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +Ssl_cipher AES256-SHA Variable_name Value -Ssl_cipher EDH-RSA-DES-CBC3-SHA +Ssl_cipher DES-CBC3-SHA select 'is still running; no cipher request crashed the server' as result from dual; result is still running; no cipher request crashed the server GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509; FLUSH PRIVILEGES; connect con1,localhost,bug42158,,,,,SSL; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 disconnect con1; connection default; DROP USER bug42158@localhost; diff --git a/mysql-test/r/openssl_6975,tlsv10.result b/mysql-test/r/openssl_6975,tlsv10.result index 6285faa0143..a65167ff427 100644 --- a/mysql-test/r/openssl_6975,tlsv10.result +++ b/mysql-test/r/openssl_6975,tlsv10.result @@ -3,14 +3,14 @@ grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA"; create user ssl_tls12@localhost; grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256"; TLS1.2 ciphers: user is ok with any cipher -ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure -ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure TLS1.2 ciphers: user requires SSLv3 cipher RC4-SHA -ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure -ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256 -ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure -ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure SSLv3 ciphers: user is ok with any cipher Variable_name Value Ssl_cipher RC4-SHA diff --git a/mysql-test/r/openssl_6975,tlsv12.result b/mysql-test/r/openssl_6975,tlsv12.result index 31d2658c829..8758daa7011 100644 --- a/mysql-test/r/openssl_6975,tlsv12.result +++ b/mysql-test/r/openssl_6975,tlsv12.result @@ -15,13 +15,13 @@ Variable_name Value Ssl_cipher AES128-SHA256 ERROR 1045 (28000): Access denied for user 'ssl_tls12'@'localhost' (using password: NO) SSLv3 ciphers: user is ok with any cipher -ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure -ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure SSLv3 ciphers: user requires SSLv3 cipher RC4-SHA -ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure -ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256 -ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure -ERROR 2026 (HY000): SSL connection error: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure +ERROR 2026 (HY000): SSL connection error: sslv3 alert handshake failure drop user ssl_sslv3@localhost; drop user ssl_tls12@localhost; diff --git a/mysql-test/r/ssl.result b/mysql-test/r/ssl.result index 7cd18fbf539..41af96621b2 100644 --- a/mysql-test/r/ssl.result +++ b/mysql-test/r/ssl.result @@ -1,7 +1,7 @@ connect ssl_con,localhost,root,,,,,SSL; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 SHOW STATUS LIKE 'Ssl_server_not_before'; Variable_name Value Ssl_server_not_before Apr 25 14:55:05 2015 GMT @@ -2164,9 +2164,9 @@ Privat (Private Nutzung) Mobilfunk Warnings: Warning 1052 Column 'kundentyp' in group statement is ambiguous drop table t1; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 select aes_decrypt('MySQL','adf'); aes_decrypt('MySQL','adf') NULL @@ -2176,7 +2176,7 @@ still connected? connection default; disconnect ssl_con; create user mysqltest_1@localhost; -grant usage on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA"; +grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA"; Variable_name Value -Ssl_cipher EDH-RSA-DES-CBC3-SHA +Ssl_cipher AES256-SHA drop user mysqltest_1@localhost; diff --git a/mysql-test/r/ssl_8k_key.result b/mysql-test/r/ssl_8k_key.result index b33a1d2854f..ff9d0cce9dc 100644 --- a/mysql-test/r/ssl_8k_key.result +++ b/mysql-test/r/ssl_8k_key.result @@ -1,2 +1,2 @@ -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +have_ssl +1 diff --git a/mysql-test/r/ssl_ca.result b/mysql-test/r/ssl_ca.result index ffc5671f85f..8ea3e30eb06 100644 --- a/mysql-test/r/ssl_ca.result +++ b/mysql-test/r/ssl_ca.result @@ -2,23 +2,23 @@ # Bug#21920657: SSL-CA FAILS SILENTLY IF THE PATH CANNOT BE FOUND # # try to connect with wrong '--ssl-ca' path : should fail -ERROR 2026 (HY000): SSL connection error: SSL_CTX_set_default_verify_paths failed +ERROR 2026 (HY000): SSL connection error: xxxx # try to connect with correct '--ssl-ca' path : should connect -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +have_ssl +1 # # Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY # PATH SUBSTITUTION # # try to connect with '--ssl-ca' option using tilde home directoy # path substitution : should connect -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +have_ssl +1 # try to connect with '--ssl-key' option using tilde home directoy # path substitution : should connect -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +have_ssl +1 # try to connect with '--ssl-cert' option using tilde home directoy # path substitution : should connect -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +have_ssl +1 diff --git a/mysql-test/r/ssl_compress.result b/mysql-test/r/ssl_compress.result index 8260fde5c4e..09c682e3851 100644 --- a/mysql-test/r/ssl_compress.result +++ b/mysql-test/r/ssl_compress.result @@ -1,7 +1,7 @@ connect ssl_compress_con,localhost,root,,,,,SSL COMPRESS; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 SHOW STATUS LIKE 'Compression'; Variable_name Value Compression ON @@ -2161,9 +2161,9 @@ Privat (Private Nutzung) Mobilfunk Warnings: Warning 1052 Column 'kundentyp' in group statement is ambiguous drop table t1; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 SHOW STATUS LIKE 'Compression'; Variable_name Value Compression ON diff --git a/mysql-test/r/ssl_timeout.result b/mysql-test/r/ssl_timeout.result index 27dce524685..3c94a9927da 100644 --- a/mysql-test/r/ssl_timeout.result +++ b/mysql-test/r/ssl_timeout.result @@ -1,9 +1,9 @@ # connect with read timeout so SLEEP() should timeout connect ssl_con,localhost,root,,,,,SSL read_timeout=5; # Check ssl turned on -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 SELECT SLEEP(600); ERROR HY000: Lost connection to MySQL server during query connection default; diff --git a/mysql-test/r/userstat.result b/mysql-test/r/userstat.result index a56ff5771f6..c6b780fce40 100644 --- a/mysql-test/r/userstat.result +++ b/mysql-test/r/userstat.result @@ -81,9 +81,9 @@ select * from t1 where a=999; a b drop table t1; connect ssl_con,localhost,root,,,,,SSL; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 connection default; create table t1 (a int, primary key (a), b int default 0) engine=innodb; begin; @@ -149,11 +149,11 @@ TOTAL_CONNECTIONS 2 TOTAL_SSL_CONNECTIONS 1 CONCURRENT_CONNECTIONS 0 ROWS_READ 6 -ROWS_SENT 2 +ROWS_SENT 3 ROWS_DELETED 1 ROWS_INSERTED 7 ROWS_UPDATED 5 -SELECT_COMMANDS 3 +SELECT_COMMANDS 4 UPDATE_COMMANDS 11 OTHER_COMMANDS 7 COMMIT_TRANSACTIONS 19 @@ -167,11 +167,11 @@ TOTAL_CONNECTIONS 2 TOTAL_SSL_CONNECTIONS 1 CONCURRENT_CONNECTIONS 0 ROWS_READ 6 -ROWS_SENT 2 +ROWS_SENT 3 ROWS_DELETED 1 ROWS_INSERTED 7 ROWS_UPDATED 5 -SELECT_COMMANDS 3 +SELECT_COMMANDS 4 UPDATE_COMMANDS 11 OTHER_COMMANDS 7 COMMIT_TRANSACTIONS 19 diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 837206e2717..8e2d9133359 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -16,22 +16,22 @@ create table t1(f1 int); insert into t1 values (5); grant select on test.* to ssl_user1@localhost require SSL; -grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA"; -grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client"; -grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB"; -grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx"; +grant select on test.* to ssl_user2@localhost require cipher "AES256-SHA"; +grant select on test.* to ssl_user3@localhost require cipher "AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client"; +grant select on test.* to ssl_user4@localhost require cipher "AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB"; +grant select on test.* to ssl_user5@localhost require cipher "AES256-SHA" AND SUBJECT "xxx"; flush privileges; -connect (con1,localhost,ssl_user1,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); +connect (con1,localhost,ssl_user1,,,,,SSL-CIPHER=AES256-SHA); --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR +connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES128-SHA); connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-SHA); -connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); -connect (con3,localhost,ssl_user3,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); -connect (con4,localhost,ssl_user4,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); +connect (con3,localhost,ssl_user3,,,,,SSL-CIPHER=AES256-SHA); +connect (con4,localhost,ssl_user4,,,,,SSL-CIPHER=AES256-SHA); --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR -connect (con5,localhost,ssl_user5,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA); +connect (con5,localhost,ssl_user5,,,,,SSL-CIPHER=AES256-SHA); connection con1; # Check ssl turned on @@ -79,7 +79,6 @@ drop table t1; # --exec echo "this query should not execute;" > $MYSQLTEST_VARDIR/tmp/test.sql # Handle that openssl gives different error messages from YaSSL. -#--replace_regex /error:00000001:lib\(0\):func\(0\):reason\(1\)/ASN: bad other signature confirmation/ --replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/ --error 1 --exec $MYSQL_TEST --ssl-ca=$MYSQL_TEST_DIR/std_data/untrusted-cacert.pem --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 @@ -89,7 +88,6 @@ drop table t1; # Test that we can't open connection to server if we are using # a blank ca # -#--replace_regex /error:00000001:lib\(0\):func\(0\):reason\(1\)/ASN: bad other signature confirmation/ --replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/ --error 1 --exec $MYSQL_TEST --ssl-ca= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 @@ -99,7 +97,6 @@ drop table t1; # Test that we can't open connection to server if we are using # a nonexistent ca file # -#--replace_regex /error:00000001:lib\(0\):func\(0\):reason\(1\)/ASN: bad other signature confirmation/ --replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/ --error 1 --exec $MYSQL_TEST --ssl-ca=nonexisting_file.pem --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 @@ -109,23 +106,27 @@ drop table t1; # Test that we can't open connection to server if we are using # a blank client-key # +--replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/ --error 1 --exec $MYSQL_TEST --ssl-key= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 +--echo # # Test that we can't open connection to server if we are using # a blank client-cert # +--replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/ --error 1 --exec $MYSQL_TEST --ssl-cert= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 +--echo # # Bug#21611 Slave can't connect when master-ssl-cipher specified # - Apparently selecting a cipher doesn't work at all -# - Usa a cipher that both yaSSL and OpenSSL supports +# - Use a cipher that both yaSSL and OpenSSL supports # --exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql ---exec $MYSQL_TEST --ssl-cipher=DHE-RSA-AES256-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 +--exec $MYSQL_TEST --ssl-cipher=AES256-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 # # Bug#25309 SSL connections without CA certificate broken since MySQL 5.0.23 @@ -134,8 +135,7 @@ drop table t1; # verification of servers certificate by setting both ca certificate # and ca path to NULL # ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA ---exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1 +--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" 2>&1 --echo End of 5.0 tests # @@ -191,6 +191,7 @@ SET GLOBAL event_scheduler=0; # Test to connect using an unknown cipher # --exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit" > $MYSQLTEST_VARDIR/tmp/test.sql +--replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/ --error 1 --exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 @@ -210,9 +211,10 @@ INSERT INTO t1 VALUES (1), (2); # With wrong parameters --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR mysqldump.exe mysqldump +--replace_regex /\"SSL connection error.*/SSL connection error: xxxx/ --error 2 --exec $MYSQL_DUMP --skip-create-options --skip-comments --ssl --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test 2>&1 - +--echo DROP TABLE t1; --remove_file $MYSQLTEST_VARDIR/tmp/test.sql @@ -222,8 +224,8 @@ DROP TABLE t1; # # Common ciphers to openssl and yassl ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=DHE-RSA-AES256-SHA ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC3-SHA +--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES256-SHA +--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=DES-CBC3-SHA --disable_query_log --disable_result_log @@ -232,20 +234,7 @@ DROP TABLE t1; --exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=NOT----EXIST # These probably exist but the server's keys can't be used to accept these kinds of connections. --error 1,0 ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=DHE-DSS-AES128-RMD ---error 1,0 ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=DHE-DSS-AES128-SHA ---error 1,0 ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=DHE-DSS-AES256-RMD ---error 1,0 ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=DHE-DSS-AES256-SHA ---error 1,0 ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=DHE-DSS-DES-CBC3-RMD ---error 1,0 ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=EDH-DSS-DES-CBC3-SHA ---error 1,0 ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=EDH-DSS-DES-CBC-SHA -# End of crashers. ########################## +--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=AES128-RMD # If this gives a result, then the bug is fixed. --enable_result_log @@ -259,8 +248,7 @@ select 'is still running; no cipher request crashed the server' as result from d GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509; FLUSH PRIVILEGES; connect(con1,localhost,bug42158,,,,,SSL); ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; disconnect con1; connection default; DROP USER bug42158@localhost; diff --git a/mysql-test/t/ssl.test b/mysql-test/t/ssl.test index 88766e7cf39..f2ac288db7a 100644 --- a/mysql-test/t/ssl.test +++ b/mysql-test/t/ssl.test @@ -11,8 +11,7 @@ connect (ssl_con,localhost,root,,,,,SSL); # Check ssl turned on ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; # Check ssl expiration SHOW STATUS LIKE 'Ssl_server_not_before'; @@ -22,8 +21,7 @@ SHOW STATUS LIKE 'Ssl_server_not_after'; -- source include/common-tests.inc # Check ssl turned on ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; # # MDEV-7697 Client reports ERROR 2006 (MySQL server has gone away) or ERROR 2013 (Lost connection to MySQL server during query) while executing AES* functions under SSL @@ -35,8 +33,8 @@ connection default; disconnect ssl_con; create user mysqltest_1@localhost; -grant usage on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA"; ---exec $MYSQL -umysqltest_1 --ssl-cipher=EDH-RSA-DES-CBC3-SHA -e "show status like 'ssl_cipher'" 2>&1 +grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA"; +--exec $MYSQL -umysqltest_1 --ssl-cipher=AES256-SHA -e "show status like 'ssl_cipher'" 2>&1 drop user mysqltest_1@localhost; # Wait till all disconnects are completed diff --git a/mysql-test/t/ssl_7937.test b/mysql-test/t/ssl_7937.test index d593b9d936d..8e9d1901907 100644 --- a/mysql-test/t/ssl_7937.test +++ b/mysql-test/t/ssl_7937.test @@ -26,10 +26,10 @@ create procedure have_ssl() # we fake the test result for yassl let yassl=`select variable_value='Unknown' from information_schema.session_status where variable_name='Ssl_session_cache_mode'`; if (!$yassl) { + --replace_result "self signed certificate in certificate chain" "Failed to verify the server certificate" --exec $MYSQL --ssl --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1 } if ($yassl) { --echo ERROR 2026 (HY000): SSL connection error: Failed to verify the server certificate } - drop procedure have_ssl; diff --git a/mysql-test/t/ssl_8k_key-master.opt b/mysql-test/t/ssl_8k_key-master.opt index 531c0abc9f1..856b33e95ee 100644 --- a/mysql-test/t/ssl_8k_key-master.opt +++ b/mysql-test/t/ssl_8k_key-master.opt @@ -1,3 +1,2 @@ --loose-ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem --loose-ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem ---loose-ssl-cipher=DHE-RSA-AES256-SHA diff --git a/mysql-test/t/ssl_8k_key.test b/mysql-test/t/ssl_8k_key.test index 27cffdce1f2..23267a3c611 100644 --- a/mysql-test/t/ssl_8k_key.test +++ b/mysql-test/t/ssl_8k_key.test @@ -5,7 +5,7 @@ # # Bug#29784 YaSSL assertion failure when reading 8k key. # ---exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1 +--exec $MYSQL --connect-timeout=180 --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SELECT (VARIABLE_VALUE <> '') as have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" 2>&1 ## This test file is for testing encrypted communication only, not other ## encryption routines that the SSL library happens to provide! diff --git a/mysql-test/t/ssl_ca.test b/mysql-test/t/ssl_ca.test index 8e81f44e61c..5870d9598fc 100644 --- a/mysql-test/t/ssl_ca.test +++ b/mysql-test/t/ssl_ca.test @@ -6,12 +6,14 @@ --echo # --echo # try to connect with wrong '--ssl-ca' path : should fail + +--replace_regex /SSL connection error.*/SSL connection error: xxxx/ --error 1 ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/wrong-cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1 +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/wrong-cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';" 2>&1 +--echo --echo # try to connect with correct '--ssl-ca' path : should connect ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';" --echo # --echo # Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY @@ -22,15 +24,12 @@ --echo # try to connect with '--ssl-ca' option using tilde home directoy --echo # path substitution : should connect ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA ---exec $MYSQL --ssl-ca$mysql_test_dir_path/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" +--exec $MYSQL --ssl-ca$mysql_test_dir_path/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';" --echo # try to connect with '--ssl-key' option using tilde home directoy --echo # path substitution : should connect ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key$mysql_test_dir_path/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key$mysql_test_dir_path/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';" --echo # try to connect with '--ssl-cert' option using tilde home directoy --echo # path substitution : should connect ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert$mysql_test_dir_path/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert$mysql_test_dir_path/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher';" diff --git a/mysql-test/t/ssl_compress.test b/mysql-test/t/ssl_compress.test index 28f3453c23e..588d4555db8 100644 --- a/mysql-test/t/ssl_compress.test +++ b/mysql-test/t/ssl_compress.test @@ -11,8 +11,7 @@ connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS); # Check ssl turned on ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; # Check compression turned on SHOW STATUS LIKE 'Compression'; @@ -21,8 +20,7 @@ SHOW STATUS LIKE 'Compression'; -- source include/common-tests.inc # Check ssl turned on ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; # Check compression turned on SHOW STATUS LIKE 'Compression'; diff --git a/mysql-test/t/ssl_timeout.test b/mysql-test/t/ssl_timeout.test index 806b928aca0..430fe7130de 100644 --- a/mysql-test/t/ssl_timeout.test +++ b/mysql-test/t/ssl_timeout.test @@ -7,8 +7,7 @@ connect (ssl_con,localhost,root,,,,,SSL read_timeout=5); --echo # Check ssl turned on ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; # --error CR_SERVER_LOST --error 2013 diff --git a/mysql-test/t/userstat.test b/mysql-test/t/userstat.test index cb1250a13ea..9ce3a32c442 100644 --- a/mysql-test/t/userstat.test +++ b/mysql-test/t/userstat.test @@ -35,8 +35,7 @@ drop table t1; # test SSL connections --connect (ssl_con,localhost,root,,,,,SSL) ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; --connection default # diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 5f4e9156fd2..892928ca69b 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -16,6 +16,7 @@ INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mysys) SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c my_default.c + get_password.c errors.c hash.c list.c mf_cache.c mf_dirname.c mf_fn_ext.c mf_format.c mf_getdate.c mf_iocache.c mf_iocache2.c mf_keycache.c @@ -39,7 +40,7 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c my_default.c lf_alloc-pin.c lf_dynarray.c lf_hash.c safemalloc.c my_new.cc my_atomic.c my_getncpus.c my_safehash.c my_chmod.c my_rnd.c - my_uuid.c wqueue.c waiting_threads.c ma_dyncol.c + my_uuid.c wqueue.c waiting_threads.c ma_dyncol.c ../sql-common/my_time.c my_rdtsc.c my_context.c psi_noop.c file_logger.c) diff --git a/client/get_password.c b/mysys/get_password.c index 8a507d94e9b..8a507d94e9b 100644 --- a/client/get_password.c +++ b/mysys/get_password.c diff --git a/mysys/typelib.c b/mysys/typelib.c index 75744a65ec8..bb4499020df 100644 --- a/mysys/typelib.c +++ b/mysys/typelib.c @@ -409,3 +409,10 @@ my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name, return res; } +/* Typelib by all clients */ +const char *sql_protocol_names_lib[] = +{ "TCP", "SOCKET", "PIPE", "MEMORY", NullS }; + +TYPELIB sql_protocol_typelib ={ array_elements(sql_protocol_names_lib) - 1, "", +sql_protocol_names_lib, NULL }; + diff --git a/sql-common/client.c b/sql-common/client.c index fdb17a63ba5..77db558d271 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1005,11 +1005,6 @@ enum option_id { static TYPELIB option_types={array_elements(default_options)-1, "options",default_options, NULL}; -const char *sql_protocol_names_lib[] = -{ "TCP", "SOCKET", "PIPE", "MEMORY", NullS }; -TYPELIB sql_protocol_typelib = {array_elements(sql_protocol_names_lib)-1,"", - sql_protocol_names_lib, NULL}; - static int add_init_command(struct st_mysql_options *options, const char *cmd) { char *tmp; @@ -4774,3 +4769,11 @@ mysql_get_socket(const MYSQL *mysql) return vio_fd(mysql->net.vio); return INVALID_SOCKET; } + + +int STDCALL mysql_cancel(MYSQL *mysql) +{ + if (mysql->net.vio) + return vio_shutdown(mysql->net.vio, SHUT_RDWR); + return -1; +} diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 28757a2c96c..5fcb07e45c0 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -20,7 +20,7 @@ #include <m_ctype.h> /* Windows version of localtime_r() is declared in my_ptrhead.h */ #include <my_pthread.h> -#include <mysqld_error.h> + ulonglong log_10_int[20]= { @@ -777,6 +777,9 @@ long calc_daynr(uint year,uint month,uint day) DBUG_RETURN(delsum+(int) y/4-temp); } /* calc_daynr */ +/* Can't include mysqld_error.h, it needs mysys to build, thus hardcode 2 error values here. */ +#define ER_WARN_DATA_OUT_OF_RANGE 1264 +#define ER_WARN_INVALID_TIMESTAMP 1299 /* Convert time in MYSQL_TIME representation in system time zone to its diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 089d793b2b0..40bd024b356 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -90,7 +90,7 @@ SET (SQL_SOURCE key.cc log.cc lock.cc log_event.cc rpl_record.cc rpl_reporting.cc log_event_old.cc rpl_record_old.cc - message.h mf_iocache.cc my_decimal.cc ../sql-common/my_time.c + message.h mf_iocache.cc my_decimal.cc mysqld.cc net_serv.cc keycaches.cc ../sql-common/client_plugin.c opt_range.cc opt_range.h opt_sum.cc diff --git a/sql/log_event.cc b/sql/log_event.cc index b1cf6a9024a..49c8e2e6162 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -1354,7 +1354,7 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet, ulong data_len; char buf[LOG_EVENT_MINIMAL_HEADER_LEN]; uchar ev_offset= packet->length(); -#ifndef max_allowed_packet +#if !defined(MYSQL_CLIENT) THD *thd=current_thd; ulong max_allowed_packet= thd ? thd->slave_thread ? slave_max_allowed_packet : thd->variables.max_allowed_packet diff --git a/sql/mysqld.cc b/sql/mysqld.cc index fa8f143335d..ee0d6fbe721 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6324,7 +6324,7 @@ static void bootstrap(MYSQL_FILE *file) mysql_cond_wait(&COND_thread_count, &LOCK_thread_count); mysql_mutex_unlock(&LOCK_thread_count); #else - thd->mysql= 0; + thd->emb_mysql= 0; do_handle_bootstrap(thd); #endif diff --git a/sql/slave.cc b/sql/slave.cc index 81597212c62..78f3ec90ff6 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3853,9 +3853,7 @@ static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi, { mi->slave_running= MYSQL_SLAVE_RUN_NOT_CONNECT; thd->proc_info= messages[SLAVE_RECON_MSG_WAIT]; -#ifdef SIGNAL_WITH_VIO_CLOSE - thd->clear_active_vio(); -#endif + thd->clear_active_mysql(); end_server(mysql); if ((*retry_count)++) { @@ -4267,16 +4265,14 @@ err: if (mysql) { /* - Here we need to clear the active VIO before closing the + Here we need to clear the active mysql before closing the connection with the master. The reason is that THD::awake() might be called from terminate_slave_thread() because somebody - issued a STOP SLAVE. If that happends, the close_active_vio() + issued a STOP SLAVE. If that happends, the close_active_mysql() can be called in the middle of closing the VIO associated with the 'mysql' object, causing a crash. */ -#ifdef SIGNAL_WITH_VIO_CLOSE - thd->clear_active_vio(); -#endif + thd->clear_active_mysql(); mysql_close(mysql); mi->mysql=0; } @@ -6152,11 +6148,9 @@ void end_relay_log_info(Relay_log_info* rli) extern "C" void slave_io_thread_detach_vio() { -#ifdef SIGNAL_WITH_VIO_CLOSE THD *thd= current_thd; if (thd && thd->slave_thread) - thd->clear_active_vio(); -#endif + thd->clear_active_mysql(); } @@ -6315,9 +6309,7 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, general_log_print(thd, COM_CONNECT_OUT, "%s@%s:%d", mi->user, mi->host, mi->port); } -#ifdef SIGNAL_WITH_VIO_CLOSE - thd->set_active_vio(mysql->net.vio); -#endif + thd->set_active_mysql(mysql); } mysql->reconnect= 1; DBUG_PRINT("exit",("slave_was_killed: %d", slave_was_killed)); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 37e6e769a89..c11cb8be5cb 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -12287,6 +12287,10 @@ err: fills MYSQL_PLUGIN_VIO_INFO structure with the information about the connection */ + +extern "C" void mpvio_info(Vio *vio, + MYSQL_PLUGIN_VIO_INFO *info); + static void server_mpvio_info(MYSQL_PLUGIN_VIO *vio, MYSQL_PLUGIN_VIO_INFO *info) { diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 9710ea8bbe3..4b2dee86bf3 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -984,8 +984,8 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) &variables.wt_timeout_short, &variables.wt_deadlock_search_depth_long, &variables.wt_timeout_long); -#ifdef SIGNAL_WITH_VIO_CLOSE - active_vio = 0; +#ifndef EMBEDDED_LIBRARY + active_mysql= 0; #endif mysql_mutex_init(key_LOCK_thd_data, &LOCK_thd_data, MY_MUTEX_INIT_FAST); mysql_mutex_init(key_LOCK_wakeup_ready, &LOCK_wakeup_ready, MY_MUTEX_INIT_FAST); @@ -1687,8 +1687,8 @@ void THD::reset_for_reuse() free_connection_done= 0; m_command= COM_CONNECT; profiling.reset(); -#ifdef SIGNAL_WITH_VIO_CLOSE - active_vio = 0; +#ifndef EMBEDDED_LIBRARY + active_mysql = 0; #endif } @@ -1905,13 +1905,17 @@ void THD::awake(killed_state state_to_set) if (state_to_set >= KILL_CONNECTION || state_to_set == NOT_KILLED) { -#ifdef SIGNAL_WITH_VIO_CLOSE if (this != current_thd) { - if(active_vio) - vio_shutdown(active_vio, SHUT_RDWR); - } +#ifndef EMBEDDED_LIBRARY + if (active_mysql) + mysql_cancel(active_mysql); + else #endif + if(net.vio) + vio_shutdown(net.vio, SHUT_RDWR); + + } /* Mark the target thread's alarm request expired, and signal alarm. */ thr_alarm_kill(thread_id); @@ -2006,15 +2010,13 @@ void THD::disconnect() killed= KILL_CONNECTION; -#ifdef SIGNAL_WITH_VIO_CLOSE /* Since a active vio might might have not been set yet, in any case save a reference to avoid closing a inexistent one or closing the vio twice if there is a active one. */ - vio= active_vio; - close_active_vio(); -#endif + close_active_mysql(); + /* Disconnect even if a active vio is not associated. */ if (net.vio != vio) @@ -2677,21 +2679,19 @@ void THD::make_explain_field_list(List<Item> &field_list, uint8 explain_flags, } -#ifdef SIGNAL_WITH_VIO_CLOSE -void THD::close_active_vio() +void THD::close_active_mysql() { - DBUG_ENTER("close_active_vio"); + DBUG_ENTER("close_active_mysql"); mysql_mutex_assert_owner(&LOCK_thd_data); #ifndef EMBEDDED_LIBRARY - if (active_vio) + if (active_mysql) { - vio_close(active_vio); - active_vio = 0; + mysql_close(active_mysql); + active_mysql= 0; } #endif DBUG_VOID_RETURN; } -#endif struct Item_change_record: public ilink diff --git a/sql/sql_class.h b/sql/sql_class.h index 55c0948d46e..a9c1514fe26 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -45,6 +45,7 @@ #include <mysql/psi/mysql_idle.h> #include <mysql/psi/mysql_table.h> #include <mysql_com_server.h> +#include <mysql.h> extern "C" void set_thd_stage_info(void *thd, @@ -2013,7 +2014,7 @@ public: static const char * const DEFAULT_WHERE; #ifdef EMBEDDED_LIBRARY - struct st_mysql *mysql; + MYSQL *emb_mysql; unsigned long client_stmt_id; unsigned long client_param_count; struct st_mysql_bind *client_params; @@ -2425,9 +2426,11 @@ public: #ifndef __WIN__ sigset_t signals; #endif -#ifdef SIGNAL_WITH_VIO_CLOSE - Vio* active_vio; + +#ifndef EMBEDDED_LIBRARY + MYSQL *active_mysql; #endif + /* This is to track items changed during execution of a prepared statement/stored procedure. It's created by @@ -3025,21 +3028,25 @@ public: void reset_for_reuse(); bool store_globals(); void reset_globals(); -#ifdef SIGNAL_WITH_VIO_CLOSE - inline void set_active_vio(Vio* vio) + + inline void set_active_mysql(MYSQL *active_mysql) { +#ifndef EMBEDDED_LIBRARY mysql_mutex_lock(&LOCK_thd_data); - active_vio = vio; + this->active_mysql= active_mysql; mysql_mutex_unlock(&LOCK_thd_data); +#endif } - inline void clear_active_vio() + inline void clear_active_mysql() { +#ifndef EMBEDDED_LIBRARY mysql_mutex_lock(&LOCK_thd_data); - active_vio = 0; + active_mysql= 0; mysql_mutex_unlock(&LOCK_thd_data); - } - void close_active_vio(); #endif + } + void close_active_mysql(); + void awake(killed_state state_to_set); /** Disconnect the associated communication endpoint. */ diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc index fe6a101f999..2495173bb28 100644 --- a/sql/sql_connect.cc +++ b/sql/sql_connect.cc @@ -857,9 +857,7 @@ static int check_connection(THD *thd) DBUG_PRINT("info", ("New connection received on %s", vio_description(net->vio))); -#ifdef SIGNAL_WITH_VIO_CLOSE - thd->set_active_vio(net->vio); -#endif + if (!thd->main_security_ctx.host) // If TCP/IP connection { diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f32e0270ce4..703efd56d55 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -15,16 +15,21 @@ ADD_DEFINITIONS("-DMYSQL_CLIENT") -INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include) + +INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/client) +INCLUDE_DIRECTORIES(BEFORE ${CONNECTOR_C_INSTALLDIR}/include/mariadb) ADD_EXECUTABLE(mysql_client_test mysql_client_test.c) -TARGET_LINK_LIBRARIES(mysql_client_test mysqlclient) -SET_TARGET_PROPERTIES(mysql_client_test PROPERTIES LINKER_LANGUAGE CXX) +SET(CLIENT_LIB ${CONNECTOR_C_LIBS} mysys) + +TARGET_LINK_LIBRARIES(mysql_client_test ${CLIENT_LIB}) +ADD_DEPENDENCIES(mysql_client_test GenError mariadb_connector_c) IF(WITH_UNIT_TESTS) ADD_EXECUTABLE(bug25714 bug25714.c) - TARGET_LINK_LIBRARIES(bug25714 mysqlclient) - SET_TARGET_PROPERTIES(bug25714 PROPERTIES LINKER_LANGUAGE CXX) + TARGET_LINK_LIBRARIES(bug25714 ${CLIENT_LIB}) + ADD_DEPENDENCIES(bug25714 GenError mariadb_connector_c) ENDIF() INSTALL(TARGETS mysql_client_test DESTINATION ${INSTALL_BINDIR} COMPONENT Test) @@ -34,7 +39,6 @@ FIND_LIBRARY(EVENT_LIBRARY event) MARK_AS_ADVANCED(EVENT_LIBRARY) IF(HAVE_EVENT_H AND EVENT_LIBRARY) ADD_EXECUTABLE(async_queries async_queries.c) - TARGET_LINK_LIBRARIES(async_queries mysqlclient ${EVENT_LIBRARY}) - SET_TARGET_PROPERTIES(async_queries PROPERTIES LINKER_LANGUAGE CXX) - + TARGET_LINK_LIBRARIES(async_queries ${CLIENT_LIB} ${EVENT_LIBRARY}) + ADD_DEPENDENCIES(async_queries GenError mariadb_connector_c) ENDIF() diff --git a/tests/mysql_client_fw.c b/tests/mysql_client_fw.c index b7211989f1f..50ecf6c0860 100644 --- a/tests/mysql_client_fw.c +++ b/tests/mysql_client_fw.c @@ -21,6 +21,7 @@ #include <my_getopt.h> #include <m_string.h> #include <mysqld_error.h> +#include <mysql_version.h> #include <sql_common.h> #include <mysql/client_plugin.h> @@ -363,7 +364,7 @@ static MYSQL* client_connect(ulong flag, uint protocol, my_bool auto_reconnect) fprintf(stdout, "\n Check the connection options using --help or -?\n"); exit(1); } - mysql->reconnect= auto_reconnect; + mysql_options(mysql, MYSQL_OPT_RECONNECT, &auto_reconnect); if (!opt_silent) fprintf(stdout, "OK"); @@ -1145,7 +1146,7 @@ static my_bool thread_query(const char *query) { MYSQL *l_mysql; my_bool error; - + my_bool reconnect= 1; error= 0; if (!opt_silent) fprintf(stdout, "\n in thread_query(%s)", query); @@ -1162,7 +1163,7 @@ static my_bool thread_query(const char *query) error= 1; goto end; } - l_mysql->reconnect= 1; + mysql_options(l_mysql, MYSQL_OPT_RECONNECT, &reconnect); if (mysql_query(l_mysql, query)) { fprintf(stderr, "Query failed (%s)\n", mysql_error(l_mysql)); diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 806924e8e0e..76db1f62f85 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -34,8 +34,22 @@ #include "mysql_client_fw.c" +static const my_bool my_true= 1; + + /* Query processing */ +static my_bool get_reconnect(MYSQL *mysql) +{ +#ifdef EMBEDDED_LIBRARY + return mysql->reconnect; +#else + my_bool reconnect; + mysql_get_option(mysql, MYSQL_OPT_RECONNECT, &reconnect); + return reconnect; +#endif +} + static void client_query() { int rc; @@ -3123,7 +3137,7 @@ static void test_long_data_str1() int rc, i; char data[255]; long length; - ulong max_blob_length, blob_length, length1; + ulong max_blob_length, blob_length= 0, length1; my_bool true_value; MYSQL_RES *result; MYSQL_BIND my_bind[2]; @@ -4812,7 +4826,7 @@ static void test_stmt_close() myerror("connection failed"); exit(1); } - lmysql->reconnect= 1; + mysql_options(lmysql, MYSQL_OPT_RECONNECT, &my_true); if (!opt_silent) fprintf(stdout, "OK"); @@ -5496,7 +5510,7 @@ DROP TABLE IF EXISTS test_multi_tab"; fprintf(stdout, "\n connection failed(%s)", mysql_error(mysql_local)); exit(1); } - mysql_local->reconnect= 1; + mysql_options(mysql_local, MYSQL_OPT_RECONNECT, &my_true); rc= mysql_query(mysql_local, query); myquery(rc); @@ -5620,7 +5634,7 @@ static void test_prepare_multi_statements() fprintf(stderr, "\n connection failed(%s)", mysql_error(mysql_local)); exit(1); } - mysql_local->reconnect= 1; + mysql_options(mysql_local, MYSQL_OPT_RECONNECT, &my_true); strmov(query, "select 1; select 'another value'"); stmt= mysql_simple_prepare(mysql_local, query); check_stmt_r(stmt); @@ -6336,6 +6350,8 @@ static void test_pure_coverage() rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); +#if 0 + /* MariaDB C/C converts geometry to string */ my_bind[0].buffer_type= MYSQL_TYPE_GEOMETRY; rc= mysql_stmt_bind_result(stmt, my_bind); check_execute_r(stmt, rc); /* unsupported buffer type */ @@ -6346,6 +6362,7 @@ static void test_pure_coverage() rc= mysql_stmt_store_result(stmt); DIE_UNLESS(rc); /* Old error must be reset first */ +#endif mysql_stmt_close(stmt); mysql_query(mysql, "DROP TABLE test_pure"); @@ -7225,7 +7242,7 @@ static void test_prepare_grant() mysql_close(lmysql); exit(1); } - lmysql->reconnect= 1; + mysql_options(lmysql, MYSQL_OPT_RECONNECT, &my_true); if (!opt_silent) fprintf(stdout, "OK"); @@ -7687,7 +7704,7 @@ static void test_drop_temp() mysql_close(lmysql); exit(1); } - lmysql->reconnect= 1; + mysql_options(lmysql, MYSQL_OPT_RECONNECT, &my_true); if (!opt_silent) fprintf(stdout, "OK"); @@ -13402,10 +13419,7 @@ static void test_bug9478() /* Fill in the fetch packet */ int4store(buff, stmt->stmt_id); buff[4]= 1; /* prefetch rows */ - rc= ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH, - (uchar*) buff, - sizeof(buff), 0,0,1,NULL) || - (*mysql->methods->read_query_result)(mysql)); + rc= mysql_stmt_fetch(stmt); DIE_UNLESS(rc); if (!opt_silent && i == 0) printf("Got error (as expected): %s\n", mysql_error(mysql)); @@ -14992,7 +15006,7 @@ static void test_bug15510() static void test_opt_reconnect() { MYSQL *lmysql; - my_bool my_true= TRUE; + myheader("test_opt_reconnect"); @@ -15003,8 +15017,8 @@ static void test_opt_reconnect() } if (!opt_silent) - fprintf(stdout, "reconnect before mysql_options: %d\n", lmysql->reconnect); - DIE_UNLESS(lmysql->reconnect == 0); + fprintf(stdout, "reconnect before mysql_options: %d\n", get_reconnect(lmysql)); + DIE_UNLESS(get_reconnect(lmysql) == 0); if (mysql_options(lmysql, MYSQL_OPT_RECONNECT, &my_true)) { @@ -15014,8 +15028,8 @@ static void test_opt_reconnect() /* reconnect should be 1 */ if (!opt_silent) - fprintf(stdout, "reconnect after mysql_options: %d\n", lmysql->reconnect); - DIE_UNLESS(lmysql->reconnect == 1); + fprintf(stdout, "reconnect after mysql_options: %d\n", get_reconnect(lmysql)); + DIE_UNLESS(get_reconnect(lmysql) == 1); if (!(mysql_real_connect(lmysql, opt_host, opt_user, opt_password, current_db, opt_port, @@ -15028,8 +15042,8 @@ static void test_opt_reconnect() /* reconnect should still be 1 */ if (!opt_silent) fprintf(stdout, "reconnect after mysql_real_connect: %d\n", - lmysql->reconnect); - DIE_UNLESS(lmysql->reconnect == 1); + get_reconnect(lmysql)); + DIE_UNLESS(get_reconnect(lmysql) == 1); mysql_close(lmysql); @@ -15040,8 +15054,8 @@ static void test_opt_reconnect() } if (!opt_silent) - fprintf(stdout, "reconnect before mysql_real_connect: %d\n", lmysql->reconnect); - DIE_UNLESS(lmysql->reconnect == 0); + fprintf(stdout, "reconnect before mysql_real_connect: %d\n", get_reconnect(lmysql)); + DIE_UNLESS(get_reconnect(lmysql) == 0); if (!(mysql_real_connect(lmysql, opt_host, opt_user, opt_password, current_db, opt_port, @@ -15054,8 +15068,8 @@ static void test_opt_reconnect() /* reconnect should still be 0 */ if (!opt_silent) fprintf(stdout, "reconnect after mysql_real_connect: %d\n", - lmysql->reconnect); - DIE_UNLESS(lmysql->reconnect == 0); + get_reconnect(lmysql)); + DIE_UNLESS(get_reconnect(lmysql) == 0); mysql_close(lmysql); } @@ -17985,7 +17999,8 @@ static void test_bug43560(void) strncpy(buffer, values[2], BUFSIZE); length= strlen(buffer); rc= mysql_stmt_execute(stmt); - DIE_UNLESS(rc && mysql_stmt_errno(stmt) == CR_SERVER_LOST); + DIE_UNLESS(rc && (mysql_stmt_errno(stmt) == CR_SERVER_LOST || + mysql_stmt_errno(stmt) == CR_SERVER_GONE_ERROR)); opt_drop_db= 0; client_disconnect(conn); diff --git a/tests/nonblock-wrappers.h b/tests/nonblock-wrappers.h index d6f42511f3a..fd50e4e4ee6 100644 --- a/tests/nonblock-wrappers.h +++ b/tests/nonblock-wrappers.h @@ -321,6 +321,7 @@ MK_WRAPPER( mysql, mysql) +#ifdef HAVE_DEPRECATED_ASYNC_API MK_WRAPPER( MYSQL_RES *, mysql_list_dbs, @@ -356,6 +357,7 @@ MK_WRAPPER( (mysql, table, wild), mysql, mysql) +#endif /* HAVE_DEPRECATED_ASYNC_API */ MK_WRAPPER( my_bool, @@ -500,7 +502,6 @@ MK_WRAPPER( #define mysql_list_dbs wrap_mysql_list_dbs #define mysql_list_tables wrap_mysql_list_tables #define mysql_list_processes wrap_mysql_list_processes -#define mysql_list_fields wrap_mysql_list_fields #define mysql_read_query_result wrap_mysql_read_query_result #define mysql_stmt_prepare wrap_mysql_stmt_prepare #define mysql_stmt_execute wrap_mysql_stmt_execute diff --git a/unittest/mysys/CMakeLists.txt b/unittest/mysys/CMakeLists.txt index ad5195a843e..0c61ff09af2 100644 --- a/unittest/mysys/CMakeLists.txt +++ b/unittest/mysys/CMakeLists.txt @@ -20,8 +20,7 @@ MY_ADD_TESTS(my_vsnprintf LINK_LIBRARIES strings mysys) ADD_DEFINITIONS(${SSL_DEFINES}) -MY_ADD_TESTS(ma_dyncol - LINK_LIBRARIES mysqlclient) +MY_ADD_TESTS(ma_dyncol LINK_LIBRARIES mysys) IF(WIN32) MY_ADD_TESTS(my_delete LINK_LIBRARIES mysys) |