Revert "MDEV-9293 Connector/C integration"

This reverts commit 7b89b9f5108c80f4f270da922d7e6c182a663719.
This commit is contained in:
Vladislav Vaintroub 2016-08-19 15:46:27 +00:00
parent 7b89b9f510
commit 31a8cf54c8
61 changed files with 412 additions and 637 deletions

View File

@ -359,7 +359,6 @@ ADD_SUBDIRECTORY(strings)
ADD_SUBDIRECTORY(vio) ADD_SUBDIRECTORY(vio)
ADD_SUBDIRECTORY(mysys) ADD_SUBDIRECTORY(mysys)
ADD_SUBDIRECTORY(mysys_ssl) ADD_SUBDIRECTORY(mysys_ssl)
ADD_SUBDIRECTORY(libmariadb)
ADD_SUBDIRECTORY(libmysql) ADD_SUBDIRECTORY(libmysql)
ADD_SUBDIRECTORY(client) ADD_SUBDIRECTORY(client)
ADD_SUBDIRECTORY(extra) ADD_SUBDIRECTORY(extra)

View File

@ -26,23 +26,13 @@ INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR} ${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. ## We will need libeay32.dll and ssleay32.dll when running client executables.
COPY_OPENSSL_DLLS(copy_openssl_client) COPY_OPENSSL_DLLS(copy_openssl_client)
ADD_DEFINITIONS(-DHAVE_LIBMARIADB=1)
SET(CLIENT_LIB ${CONNECTOR_C_LIBS} mysys)
ADD_DEFINITIONS(${SSL_DEFINES}) ADD_DEFINITIONS(${SSL_DEFINES})
MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc MYSQL_ADD_EXECUTABLE(mysql completion_hash.cc mysql.cc readline.cc
${CMAKE_SOURCE_DIR}/sql/sql_string.cc) ${CMAKE_SOURCE_DIR}/sql/sql_string.cc)
TARGET_LINK_LIBRARIES(mysql ${CLIENT_LIB}) TARGET_LINK_LIBRARIES(mysql mysqlclient)
IF(UNIX) IF(UNIX)
TARGET_LINK_LIBRARIES(mysql ${MY_READLINE_LIBRARY}) TARGET_LINK_LIBRARIES(mysql ${MY_READLINE_LIBRARY})
SET_TARGET_PROPERTIES(mysql PROPERTIES ENABLE_EXPORTS TRUE) SET_TARGET_PROPERTIES(mysql PROPERTIES ENABLE_EXPORTS TRUE)
@ -50,40 +40,39 @@ ENDIF(UNIX)
MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test) MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test)
SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS") SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqltest ${CLIENT_LIB} pcre pcreposix) TARGET_LINK_LIBRARIES(mysqltest mysqlclient pcre pcreposix)
SET_TARGET_PROPERTIES(mysqltest PROPERTIES ENABLE_EXPORTS TRUE) SET_TARGET_PROPERTIES(mysqltest PROPERTIES ENABLE_EXPORTS TRUE)
MYSQL_ADD_EXECUTABLE(mysqlcheck mysqlcheck.c) MYSQL_ADD_EXECUTABLE(mysqlcheck mysqlcheck.c)
TARGET_LINK_LIBRARIES(mysqlcheck ${CLIENT_LIB}) TARGET_LINK_LIBRARIES(mysqlcheck mysqlclient)
MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c) MYSQL_ADD_EXECUTABLE(mysqldump mysqldump.c ../sql-common/my_user.c)
TARGET_LINK_LIBRARIES(mysqldump ${CLIENT_LIB}) TARGET_LINK_LIBRARIES(mysqldump mysqlclient)
MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c) MYSQL_ADD_EXECUTABLE(mysqlimport mysqlimport.c)
SET_SOURCE_FILES_PROPERTIES(mysqlimport.c PROPERTIES COMPILE_FLAGS "-DTHREADS") SET_SOURCE_FILES_PROPERTIES(mysqlimport.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlimport ${CLIENT_LIB}) TARGET_LINK_LIBRARIES(mysqlimport mysqlclient)
MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c COMPONENT Server) MYSQL_ADD_EXECUTABLE(mysql_upgrade mysql_upgrade.c COMPONENT Server)
TARGET_LINK_LIBRARIES(mysql_upgrade ${CLIENT_LIB}) TARGET_LINK_LIBRARIES(mysql_upgrade mysqlclient)
ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs) ADD_DEPENDENCIES(mysql_upgrade GenFixPrivs)
MYSQL_ADD_EXECUTABLE(mysqlshow mysqlshow.c) MYSQL_ADD_EXECUTABLE(mysqlshow mysqlshow.c)
TARGET_LINK_LIBRARIES(mysqlshow ${CLIENT_LIB}) TARGET_LINK_LIBRARIES(mysqlshow mysqlclient)
MYSQL_ADD_EXECUTABLE(mysql_plugin mysql_plugin.c) MYSQL_ADD_EXECUTABLE(mysql_plugin mysql_plugin.c)
TARGET_LINK_LIBRARIES(mysql_plugin ${CLIENT_LIB}) TARGET_LINK_LIBRARIES(mysql_plugin mysqlclient)
MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc) MYSQL_ADD_EXECUTABLE(mysqlbinlog mysqlbinlog.cc)
TARGET_LINK_LIBRARIES(mysqlbinlog ${CLIENT_LIB}) TARGET_LINK_LIBRARIES(mysqlbinlog mysqlclient)
MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc ../sql/password.c) MYSQL_ADD_EXECUTABLE(mysqladmin mysqladmin.cc)
TARGET_LINK_LIBRARIES(mysqladmin ${CLIENT_LIB}) TARGET_LINK_LIBRARIES(mysqladmin mysqlclient)
MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c) MYSQL_ADD_EXECUTABLE(mysqlslap mysqlslap.c)
SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS") SET_SOURCE_FILES_PROPERTIES(mysqlslap.c PROPERTIES COMPILE_FLAGS "-DTHREADS")
TARGET_LINK_LIBRARIES(mysqlslap ${CLIENT_LIB}) TARGET_LINK_LIBRARIES(mysqlslap mysqlclient)
# "WIN32" also covers 64 bit. "echo" is used in some files below "mysql-test/". # "WIN32" also covers 64 bit. "echo" is used in some files below "mysql-test/".
IF(WIN32) IF(WIN32)
@ -92,16 +81,10 @@ ENDIF(WIN32)
# async_example is just a code example, do not install it. # async_example is just a code example, do not install it.
ADD_EXECUTABLE(async_example async_example.c) ADD_EXECUTABLE(async_example async_example.c)
TARGET_LINK_LIBRARIES(async_example ${CLIENT_LIB}) TARGET_LINK_LIBRARIES(async_example mysqlclient)
SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap mysql_plugin async_example SET_TARGET_PROPERTIES (mysqlcheck mysqldump mysqlimport mysql_upgrade mysqlshow mysqlslap mysql_plugin async_example
PROPERTIES HAS_CXX TRUE) 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) ADD_DEFINITIONS(-DHAVE_DLOPEN)

View File

@ -24,7 +24,6 @@
#include <mysql.h> #include <mysql.h>
#include <errmsg.h> #include <errmsg.h>
#include <my_getopt.h> #include <my_getopt.h>
#include <mysql_version.h>
#ifndef WEXITSTATUS #ifndef WEXITSTATUS
# ifdef __WIN__ # ifdef __WIN__

View File

@ -1143,9 +1143,6 @@ int main(int argc,char *argv[])
outfile[0]=0; // no (default) outfile outfile[0]=0; // no (default) outfile
strmov(pager, "stdout"); // the default, if --pager wasn't given strmov(pager, "stdout"); // the default, if --pager wasn't given
mysql_init(&mysql);
{ {
char *tmp=getenv("PAGER"); char *tmp=getenv("PAGER");
if (tmp && strlen(tmp)) if (tmp && strlen(tmp))
@ -1206,6 +1203,7 @@ int main(int argc,char *argv[])
glob_buffer.realloc(512); glob_buffer.realloc(512);
completion_hash_init(&ht, 128); completion_hash_init(&ht, 128);
init_alloc_root(&hash_mem_root, 16384, 0, MYF(0)); 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, if (sql_connect(current_host,current_db,current_user,opt_password,
opt_silent)) opt_silent))
{ {
@ -1367,8 +1365,6 @@ static bool do_connect(MYSQL *mysql, const char *host, const char *user,
opt_ssl_capath, opt_ssl_cipher); opt_ssl_capath, opt_ssl_cipher);
mysql_options(mysql, MYSQL_OPT_SSL_CRL, opt_ssl_crl); 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_CRLPATH, opt_ssl_crlpath);
char enforce= 1;
mysql_options(mysql, MYSQL_OPT_SSL_ENFORCE, &enforce);
} }
mysql_options(mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT, mysql_options(mysql,MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
(char*)&opt_ssl_verify_server_cert); (char*)&opt_ssl_verify_server_cert);
@ -4621,23 +4617,6 @@ sql_real_connect(char *host,char *database,char *user,char *password,
mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS); mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
if (using_opt_local_infile) if (using_opt_local_infile)
mysql_options(&mysql,MYSQL_OPT_LOCAL_INFILE, (char*) &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) if (safe_updates)
{ {
char init_command[100]; char init_command[100];
@ -4662,13 +4641,12 @@ sql_real_connect(char *host,char *database,char *user,char *password,
} }
return -1; // Retryable return -1; // Retryable
} }
charset_info= get_charset_by_name(mysql.charset->name, MYF(0)); charset_info= mysql.charset;
connected=1; connected=1;
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
mysql_options(&mysql, MYSQL_OPT_RECONNECT, &debug_info_flag); mysql.reconnect= debug_info_flag; // We want to know if this happens
/* /*
CLIENT_PROGRESS_OBSOLETE is set only if we requested it in CLIENT_PROGRESS_OBSOLETE is set only if we requested it in
@ -4677,10 +4655,7 @@ sql_real_connect(char *host,char *database,char *user,char *password,
if (mysql.client_flag & CLIENT_PROGRESS_OBSOLETE) if (mysql.client_flag & CLIENT_PROGRESS_OBSOLETE)
mysql_options(&mysql, MYSQL_PROGRESS_CALLBACK, (void*) report_progress); mysql_options(&mysql, MYSQL_PROGRESS_CALLBACK, (void*) report_progress);
#else #else
{ mysql.reconnect= 1;
my_bool reconnect= 1;
mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect);
}
#endif #endif
#ifdef HAVE_READLINE #ifdef HAVE_READLINE
build_completion_hash(opt_rehash, 1); build_completion_hash(opt_rehash, 1);

View File

@ -20,7 +20,6 @@
#include <mysql.h> #include <mysql.h>
#include <my_getopt.h> #include <my_getopt.h>
#include <my_dir.h> #include <my_dir.h>
#include <mysql_version.h>
#define SHOW_VERSION "1.0.0" #define SHOW_VERSION "1.0.0"
#define PRINT_VERSION do { printf("%s Ver %s Distrib %s\n", \ #define PRINT_VERSION do { printf("%s Ver %s Distrib %s\n", \

View File

@ -23,10 +23,8 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <mysql.h> #include <mysql.h>
#include <sql_common.h> #include <sql_common.h>
#include <mysql_version.h>
#include <welcome_copyright_notice.h> #include <welcome_copyright_notice.h>
#include <my_rnd.h> #include <my_rnd.h>
#include <password.h>
#define ADMIN_VERSION "9.1" #define ADMIN_VERSION "9.1"
#define MAX_MYSQL_VAR 512 #define MAX_MYSQL_VAR 512
@ -442,7 +440,7 @@ int main(int argc,char *argv[])
didn't signal for us to die. Otherwise, signal failure. didn't signal for us to die. Otherwise, signal failure.
*/ */
if (mysql.net.pvio == 0) if (mysql.net.vio == 0)
{ {
if (option_wait && !interrupted) if (option_wait && !interrupted)
{ {
@ -523,8 +521,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
if (mysql_real_connect(mysql,host,user,opt_password,NullS,tcp_port, if (mysql_real_connect(mysql,host,user,opt_password,NullS,tcp_port,
unix_port, CLIENT_REMEMBER_OPTIONS)) unix_port, CLIENT_REMEMBER_OPTIONS))
{ {
my_bool reconnect= 1; mysql->reconnect= 1;
mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect);
if (info) if (info)
{ {
fputs("\n",stderr); fputs("\n",stderr);
@ -545,16 +542,16 @@ static my_bool sql_connect(MYSQL *mysql, uint wait)
{ {
fprintf(stderr, fprintf(stderr,
"Check that mysqld is running and that the socket: '%s' exists!\n", "Check that mysqld is running and that the socket: '%s' exists!\n",
unix_port ? unix_port : MYSQL_UNIX_ADDR); unix_port ? unix_port : mysql_unix_port);
} }
else if (mysql_errno(mysql) == CR_CONN_HOST_ERROR || else if (mysql_errno(mysql) == CR_CONN_HOST_ERROR ||
mysql_errno(mysql) == CR_UNKNOWN_HOST) mysql_errno(mysql) == CR_UNKNOWN_HOST)
{ {
fprintf(stderr,"Check that mysqld is running on %s",host); fprintf(stderr,"Check that mysqld is running on %s",host);
fprintf(stderr," and that the port is %d.\n", 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", 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; return 1;
@ -1080,9 +1077,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
} }
} }
if (old) if (old)
my_make_scrambled_password_323(crypted_pw, typed_password, sizeof(crypted_pw)); make_scrambled_password_323(crypted_pw, typed_password);
else else
my_make_scrambled_password(crypted_pw, typed_password, sizeof(crypted_pw)); make_scrambled_password(crypted_pw, typed_password);
} }
else else
crypted_pw[0]=0; /* No password */ crypted_pw[0]=0; /* No password */
@ -1190,9 +1187,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
break; break;
} }
case ADMIN_PING: 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 (!mysql_ping(mysql))
{ {
if (option_silent < 2) if (option_silent < 2)
@ -1202,8 +1197,7 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
{ {
if (mysql_errno(mysql) == CR_SERVER_GONE_ERROR) if (mysql_errno(mysql) == CR_SERVER_GONE_ERROR)
{ {
reconnect= 1; mysql->reconnect=1;
mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect);
if (!mysql_ping(mysql)) if (!mysql_ping(mysql))
puts("connection was down, but mysqld is now alive"); puts("connection was down, but mysqld is now alive");
} }
@ -1214,10 +1208,8 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
return -1; return -1;
} }
} }
reconnect=1; /* Automatic reconnect is default */ mysql->reconnect=1; /* Automatic reconnect is default */
mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect);
break; break;
}
default: default:
my_printf_error(0, "Unknown command: '%-.60s'", error_flags, argv[0]); my_printf_error(0, "Unknown command: '%-.60s'", error_flags, argv[0]);
return 1; return 1;

View File

@ -52,18 +52,14 @@
#include <algorithm> #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; Rpl_filter *binlog_filter= 0;
#define BIN_LOG_HEADER_SIZE 4 #define BIN_LOG_HEADER_SIZE 4
#define PROBE_HEADER_LEN (EVENT_LEN_OFFSET+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 */ /* Needed for Rpl_filter */
CHARSET_INFO* system_charset_info= &my_charset_utf8_general_ci; CHARSET_INFO* system_charset_info= &my_charset_utf8_general_ci;
@ -90,11 +86,6 @@ static const char *load_groups[]=
static void error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2); static void error(const char *format, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
static void warning(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 one_database=0, to_last_remote_log= 0, disable_log_bin= 0;
static bool opt_hexdump= 0, opt_version= 0; static bool opt_hexdump= 0, opt_version= 0;
const char *base64_output_mode_names[]= const char *base64_output_mode_names[]=
@ -1773,7 +1764,6 @@ static int parse_args(int *argc, char*** argv)
*/ */
static Exit_status safe_connect() static Exit_status safe_connect()
{ {
my_bool reconnect= 1;
/* Close any old connections to MySQL */ /* Close any old connections to MySQL */
if (mysql) if (mysql)
mysql_close(mysql); mysql_close(mysql);
@ -1819,7 +1809,7 @@ static Exit_status safe_connect()
error("Failed on connect: %s", mysql_error(mysql)); error("Failed on connect: %s", mysql_error(mysql));
return ERROR_STOP; return ERROR_STOP;
} }
mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect); mysql->reconnect= 1;
return OK_CONTINUE; return OK_CONTINUE;
} }
@ -2283,7 +2273,7 @@ static Exit_status dump_remote_log_entries(PRINT_EVENT_INFO *print_event_info,
for (;;) for (;;)
{ {
len= net_safe_read(mysql); len= cli_safe_read(mysql);
if (len == packet_error) if (len == packet_error)
{ {
error("Got error reading packet from server: %s", mysql_error(mysql)); error("Got error reading packet from server: %s", mysql_error(mysql));
@ -2853,8 +2843,6 @@ struct encryption_service_st encryption_handler=
#include "my_decimal.h" #include "my_decimal.h"
#include "decimal.c" #include "decimal.c"
#include "my_decimal.cc" #include "my_decimal.cc"
#include "../sql-common/my_time.c"
#include "password.c"
#include "log_event.cc" #include "log_event.cc"
#include "log_event_old.cc" #include "log_event_old.cc"
#include "rpl_utility.cc" #include "rpl_utility.cc"

View File

@ -1086,7 +1086,6 @@ static void print_result()
static int dbConnect(char *host, char *user, char *passwd) static int dbConnect(char *host, char *user, char *passwd)
{ {
my_bool reconnect= 1;
DBUG_ENTER("dbConnect"); DBUG_ENTER("dbConnect");
if (verbose > 1) if (verbose > 1)
{ {
@ -1125,7 +1124,7 @@ static int dbConnect(char *host, char *user, char *passwd)
DBerror(&mysql_connection, "when trying to connect"); DBerror(&mysql_connection, "when trying to connect");
DBUG_RETURN(1); DBUG_RETURN(1);
} }
mysql_options(&mysql_connection, MYSQL_OPT_RECONNECT, &reconnect); mysql_connection.reconnect= 1;
DBUG_RETURN(0); DBUG_RETURN(0);
} /* dbConnect */ } /* dbConnect */

View File

@ -1643,7 +1643,6 @@ static void maybe_exit(int error)
static int connect_to_db(char *host, char *user,char *passwd) static int connect_to_db(char *host, char *user,char *passwd)
{ {
char buff[20+FN_REFLEN]; char buff[20+FN_REFLEN];
my_bool reconnect;
DBUG_ENTER("connect_to_db"); DBUG_ENTER("connect_to_db");
verbose_msg("-- Connecting to %s...\n", host ? host : "localhost"); verbose_msg("-- Connecting to %s...\n", host ? host : "localhost");
@ -1698,8 +1697,7 @@ 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 As we're going to set SQL_MODE, it would be lost on reconnect, so we
cannot reconnect. cannot reconnect.
*/ */
reconnect= 0; mysql->reconnect= 0;
mysql_options(&mysql_connection, MYSQL_OPT_RECONNECT, &reconnect);
my_snprintf(buff, sizeof(buff), "/*!40100 SET @@SQL_MODE='%s' */", my_snprintf(buff, sizeof(buff), "/*!40100 SET @@SQL_MODE='%s' */",
compatible_mode_normal_str); compatible_mode_normal_str);
if (mysql_query_with_error_report(mysql, 0, buff)) if (mysql_query_with_error_report(mysql, 0, buff))

View File

@ -419,7 +419,6 @@ static MYSQL *db_connect(char *host, char *database,
char *user, char *passwd) char *user, char *passwd)
{ {
MYSQL *mysql; MYSQL *mysql;
my_bool reconnect;
if (verbose) if (verbose)
fprintf(stdout, "Connecting to %s\n", host ? host : "localhost"); fprintf(stdout, "Connecting to %s\n", host ? host : "localhost");
if (!(mysql= mysql_init(NULL))) if (!(mysql= mysql_init(NULL)))
@ -464,8 +463,7 @@ static MYSQL *db_connect(char *host, char *database,
ignore_errors=0; /* NO RETURN FROM db_error */ ignore_errors=0; /* NO RETURN FROM db_error */
db_error(mysql); db_error(mysql);
} }
reconnect= 0; mysql->reconnect= 0;
mysql_options(mysql, MYSQL_OPT_RECONNECT, &reconnect);
if (verbose) if (verbose)
fprintf(stdout, "Selecting database %s\n", database); fprintf(stdout, "Selecting database %s\n", database);
if (mysql_select_db(mysql, database)) if (mysql_select_db(mysql, database))

View File

@ -68,7 +68,6 @@ int main(int argc, char **argv)
my_bool first_argument_uses_wildcards=0; my_bool first_argument_uses_wildcards=0;
char *wild; char *wild;
MYSQL mysql; MYSQL mysql;
my_bool reconnect;
static char **defaults_argv; static char **defaults_argv;
MY_INIT(argv[0]); MY_INIT(argv[0]);
sf_leaking_memory=1; /* don't report memory leaks on early exits */ sf_leaking_memory=1; /* don't report memory leaks on early exits */
@ -156,8 +155,7 @@ int main(int argc, char **argv)
error= 1; error= 1;
goto error; goto error;
} }
reconnect= 1; mysql.reconnect= 1;
mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect);
switch (argc) { switch (argc) {
case 0: error=list_dbs(&mysql,wild); break; case 0: error=list_dbs(&mysql,wild); break;

View File

@ -190,8 +190,6 @@ static char global_subst_from[200];
static char global_subst_to[200]; static char global_subst_to[200];
static char *global_subst= NULL; static char *global_subst= NULL;
static MEM_ROOT require_file_root; static MEM_ROOT require_file_root;
static const my_bool my_true= 1;
static const my_bool my_false= 0;
/* Block stack */ /* Block stack */
enum block_cmd { enum block_cmd {
@ -5407,6 +5405,18 @@ 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;
}
/** /**
@ -5491,7 +5501,11 @@ void do_close_connection(struct st_command *command)
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
if (command->type == Q_DIRTY_CLOSE) if (command->type == Q_DIRTY_CLOSE)
{ {
mariadb_cancel(con->mysql); if (con->mysql->net.vio)
{
vio_delete(con->mysql->net.vio);
con->mysql->net.vio = 0;
}
} }
#endif /*!EMBEDDED_LIBRARY*/ #endif /*!EMBEDDED_LIBRARY*/
if (con->stmt) if (con->stmt)
@ -8215,18 +8229,10 @@ end:
revert_properties(); revert_properties();
/* Close the statement if reconnect, need new prepare */ /* Close the statement if reconnect, need new prepare */
if (mysql->reconnect)
{ {
#ifndef EMBEDDED_LIBRARY mysql_stmt_close(stmt);
my_bool reconnect; cn->stmt= NULL;
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; DBUG_VOID_RETURN;
@ -8758,7 +8764,7 @@ static void dump_backtrace(void)
#endif #endif
} }
fputs("Attempting backtrace...\n", stderr); fputs("Attempting backtrace...\n", stderr);
my_print_stacktrace(NULL, (ulong)my_thread_stack_size); my_print_stacktrace(NULL, my_thread_stack_size);
} }
#else #else
@ -9401,10 +9407,10 @@ int main(int argc, char **argv)
non_blocking_api_enabled= 1; non_blocking_api_enabled= 1;
break; break;
case Q_DISABLE_RECONNECT: case Q_DISABLE_RECONNECT:
mysql_options(cur_con->mysql, MYSQL_OPT_RECONNECT, &my_false); set_reconnect(cur_con->mysql, 0);
break; break;
case Q_ENABLE_RECONNECT: case Q_ENABLE_RECONNECT:
mysql_options(cur_con->mysql, MYSQL_OPT_RECONNECT, &my_true); set_reconnect(cur_con->mysql, 1);
/* Close any open statements - no reconnect, need new prepare */ /* Close any open statements - no reconnect, need new prepare */
close_statements(); close_statements();
break; break;

View File

@ -1,78 +0,0 @@
#
# 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
)

View File

@ -28,7 +28,6 @@ SET(TAR_EXECUTABLE "@TAR_EXECUTABLE@")
SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@") SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@")
SET(CMAKE_MAKE_PROGRAM "@CMAKE_MAKE_PROGRAM@") SET(CMAKE_MAKE_PROGRAM "@CMAKE_MAKE_PROGRAM@")
SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@") SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")
SET(CONNECTOR_C_GIT_TAG "@CONNECTOR_C_GIT_TAG@")
SET(VERSION "@VERSION@") SET(VERSION "@VERSION@")
@ -47,16 +46,9 @@ IF(GIT_EXECUTABLE)
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE RESULT 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) IF(NOT RESULT EQUAL 0)
SET(GIT_EXECUTABLE) SET(GIT_EXECUTABLE)
ENDIF() ENDIF()
ENDIF() ENDIF()

View File

@ -1,27 +0,0 @@
#
# 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)

View File

@ -1250,13 +1250,4 @@ static inline double rint(double x)
#endif #endif
#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 */ #endif /* my_global_h */

View File

@ -1019,7 +1019,6 @@ extern void add_compiled_collation(struct charset_info_st *cs);
extern size_t escape_string_for_mysql(CHARSET_INFO *charset_info, extern size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
char *to, size_t to_length, char *to, size_t to_length,
const char *from, size_t length); const char *from, size_t length);
extern char *get_tty_password(const char *opt_message);
#ifdef __WIN__ #ifdef __WIN__
#define BACKSLASH_MBTAIL #define BACKSLASH_MBTAIL
/* File system character set */ /* File system character set */

View File

@ -351,6 +351,10 @@ typedef struct st_mysql_parameters
*/ */
#define MYSQL_WAIT_TIMEOUT 8 #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 Set up and bring down the server; to ensure that applications will
@ -858,7 +862,6 @@ void STDCALL mysql_close(MYSQL *sock);
int STDCALL mysql_close_start(MYSQL *sock); int STDCALL mysql_close_start(MYSQL *sock);
int STDCALL mysql_close_cont(MYSQL *sock, int status); int STDCALL mysql_close_cont(MYSQL *sock, int status);
my_socket STDCALL mysql_get_socket(const MYSQL *mysql); 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(const MYSQL *mysql);
unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql); unsigned int STDCALL mysql_get_timeout_value_ms(const MYSQL *mysql);

View File

@ -654,5 +654,12 @@ uchar *safe_net_store_length(uchar *pkg, size_t pkg_len, ulonglong length);
decimals 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 #endif

View File

@ -77,13 +77,9 @@ typedef struct st_mysql_methods
#endif #endif
} MYSQL_METHODS; } 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) \ #define simple_command(mysql, command, arg, length, skip_check) \
(*(mysql)->methods->advanced_command)(mysql, command, 0, \ (*(mysql)->methods->advanced_command)(mysql, command, 0, \
0, arg, length, skip_check, NULL) 0, arg, length, skip_check, NULL)
#endif
#define stmt_command(mysql, command, arg, length, stmt) \ #define stmt_command(mysql, command, arg, length, stmt) \
(*(mysql)->methods->advanced_command)(mysql, command, 0, \ (*(mysql)->methods->advanced_command)(mysql, command, 0, \
0, arg, length, 1, stmt) 0, arg, length, 1, stmt)
@ -114,7 +110,7 @@ void set_mysql_extended_error(MYSQL *mysql, int errcode, const char *sqlstate,
/* client side of the pluggable authentication */ /* client side of the pluggable authentication */
struct st_plugin_vio_info; 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, int run_plugin_auth(MYSQL *mysql, char *data, uint data_len,
const char *data_plugin, const char *db); const char *data_plugin, const char *db);
int mysql_client_plugin_init(); int mysql_client_plugin_init();

View File

@ -35,4 +35,3 @@ SSL_STATIC my_bool opt_ssl_verify_server_cert= 0;
#endif #endif
#endif #endif
#endif /* SSLOPT_VARS_INCLUDED */ #endif /* SSLOPT_VARS_INCLUDED */

View File

@ -1,127 +0,0 @@
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()

View File

@ -424,4 +424,101 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux")
SET(VERSION_SCRIPT_LINK_FLAGS SET(VERSION_SCRIPT_LINK_FLAGS
"-Wl,${CMAKE_CURRENT_BINARY_DIR}/libmysql_versions.ld") "-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() ENDIF()

View File

@ -37,8 +37,8 @@ ${CMAKE_BINARY_DIR}/sql/lex_hash.h
SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES} PROPERTIES GENERATED TRUE) SET_SOURCE_FILES_PROPERTIES(${GEN_SOURCES} PROPERTIES GENERATED TRUE)
SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../libmysql/libmysql.c ../libmysql/errmsg.c ../mysys/get_password.c ../libmysql/libmysql.c ../libmysql/errmsg.c ../client/get_password.c
../sql-common/client.c ../sql-common/client.c ../sql-common/my_time.c
../sql-common/my_user.c ../sql-common/pack.c ../sql-common/my_user.c ../sql-common/pack.c
../sql-common/client_plugin.c ../sql-common/mysql_async.c ../sql-common/client_plugin.c ../sql-common/mysql_async.c
../sql/password.c ../sql/discover.cc ../sql/derror.cc ../sql/password.c ../sql/discover.cc ../sql/derror.cc

View File

@ -647,7 +647,7 @@ void end_embedded_server()
void init_embedded_mysql(MYSQL *mysql, int client_flag) void init_embedded_mysql(MYSQL *mysql, int client_flag)
{ {
THD *thd = (THD *)mysql->thd; THD *thd = (THD *)mysql->thd;
thd->emb_mysql= mysql; thd->mysql= mysql;
mysql->server_version= server_version; mysql->server_version= server_version;
mysql->client_flag= client_flag; mysql->client_flag= client_flag;
init_alloc_root(&mysql->field_alloc, 8192, 0, MYF(0)); init_alloc_root(&mysql->field_alloc, 8192, 0, MYF(0));
@ -929,7 +929,7 @@ static
bool bool
write_eof_packet(THD *thd, uint server_status, uint statement_warn_count) write_eof_packet(THD *thd, uint server_status, uint statement_warn_count)
{ {
if (!thd->emb_mysql) // bootstrap file handling if (!thd->mysql) // bootstrap file handling
return FALSE; return FALSE;
/* /*
The following test should never be true, but it's better to do it 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; MYSQL_DATA *data;
DBUG_ENTER("send_result_set_metadata"); DBUG_ENTER("send_result_set_metadata");
if (!thd->emb_mysql) // bootstrap file handling if (!thd->mysql) // bootstrap file handling
DBUG_RETURN(0); DBUG_RETURN(0);
if (begin_dataset()) if (begin_dataset())
@ -1118,7 +1118,7 @@ bool Protocol::send_result_set_metadata(List<Item> *list, uint flags)
bool Protocol::write() bool Protocol::write()
{ {
if (!thd->emb_mysql) // bootstrap file handling if (!thd->mysql) // bootstrap file handling
return false; return false;
*next_field= 0; *next_field= 0;
@ -1176,7 +1176,7 @@ net_send_ok(THD *thd,
{ {
DBUG_ENTER("emb_net_send_ok"); DBUG_ENTER("emb_net_send_ok");
MYSQL_DATA *data; MYSQL_DATA *data;
MYSQL *mysql= thd->emb_mysql; MYSQL *mysql= thd->mysql;
if (!mysql) // bootstrap file handling if (!mysql) // bootstrap file handling
DBUG_RETURN(FALSE); 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; MYSQL_DATA *data= thd->cur_data;
struct embedded_query_result *ei; struct embedded_query_result *ei;
if (!thd->emb_mysql) // bootstrap file handling if (!thd->mysql) // bootstrap file handling
{ {
fprintf(stderr, "ERROR: %d %s\n", sql_errno, err); fprintf(stderr, "ERROR: %d %s\n", sql_errno, err);
return TRUE; return TRUE;
@ -1250,7 +1250,7 @@ void Protocol_text::prepare_for_resend()
MYSQL_DATA *data= thd->cur_data; MYSQL_DATA *data= thd->cur_data;
DBUG_ENTER("send_data"); DBUG_ENTER("send_data");
if (!thd->emb_mysql) // bootstrap file handling if (!thd->mysql) // bootstrap file handling
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
data->rows++; data->rows++;
@ -1283,7 +1283,7 @@ bool Protocol_text::store_null()
bool Protocol::net_store_data(const uchar *from, size_t length) bool Protocol::net_store_data(const uchar *from, size_t length)
{ {
char *field_buf; char *field_buf;
if (!thd->emb_mysql) // bootstrap file handling if (!thd->mysql) // bootstrap file handling
return FALSE; return FALSE;
if (!(field_buf= (char*) alloc_root(alloc, length + sizeof(uint) + 1))) 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 conv_length= to_cs->mbmaxlen * length / from_cs->mbminlen;
uint dummy_error; uint dummy_error;
char *field_buf; char *field_buf;
if (!thd->emb_mysql) // bootstrap file handling if (!thd->mysql) // bootstrap file handling
return false; return false;
if (!(field_buf= (char*) alloc_root(alloc, conv_length + sizeof(uint) + 1))) if (!(field_buf= (char*) alloc_root(alloc, conv_length + sizeof(uint) + 1)))

View File

@ -4,25 +4,25 @@ drop table if exists t1;
create table t1(f1 int); create table t1(f1 int);
insert into t1 values (5); insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL; grant select on test.* to ssl_user1@localhost require SSL;
grant select on test.* to ssl_user2@localhost require cipher "AES256-SHA"; grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-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_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 "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_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 "AES256-SHA" AND SUBJECT "xxx"; grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx";
flush privileges; flush privileges;
connect con1,localhost,ssl_user1,,,,,SSL-CIPHER=AES256-SHA; connect con1,localhost,ssl_user1,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA;
connect(localhost,ssl_user2,,test,MASTER_PORT,MASTER_SOCKET); connect(localhost,ssl_user2,,test,MASTER_PORT,MASTER_SOCKET);
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=AES256-SHA; connect con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-SHA;
connect con3,localhost,ssl_user3,,,,,SSL-CIPHER=AES256-SHA; ERROR 28000: Access denied for user 'ssl_user2'@'localhost' (using password: NO)
connect con4,localhost,ssl_user4,,,,,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(localhost,ssl_user5,,test,MASTER_PORT,MASTER_SOCKET); connect(localhost,ssl_user5,,test,MASTER_PORT,MASTER_SOCKET);
connect con5,localhost,ssl_user5,,,,,SSL-CIPHER=AES256-SHA; connect con5,localhost,ssl_user5,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA;
ERROR 28000: Access denied for user 'ssl_user5'@'localhost' (using password: NO) ERROR 28000: Access denied for user 'ssl_user5'@'localhost' (using password: NO)
connection con1; connection con1;
SHOW STATUS LIKE 'Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value Variable_name Value
Ssl_cipher AES256-SHA Ssl_cipher DHE-RSA-AES256-SHA
select * from t1; select * from t1;
f1 f1
5 5
@ -31,7 +31,7 @@ ERROR 42000: DELETE command denied to user 'ssl_user1'@'localhost' for table 't1
connection con2; connection con2;
SHOW STATUS LIKE 'Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value Variable_name Value
Ssl_cipher AES256-SHA Ssl_cipher DHE-RSA-AES256-SHA
select * from t1; select * from t1;
f1 f1
5 5
@ -40,7 +40,7 @@ ERROR 42000: DELETE command denied to user 'ssl_user2'@'localhost' for table 't1
connection con3; connection con3;
SHOW STATUS LIKE 'Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value Variable_name Value
Ssl_cipher AES256-SHA Ssl_cipher DHE-RSA-AES256-SHA
select * from t1; select * from t1;
f1 f1
5 5
@ -49,7 +49,7 @@ ERROR 42000: DELETE command denied to user 'ssl_user3'@'localhost' for table 't1
connection con4; connection con4;
SHOW STATUS LIKE 'Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value Variable_name Value
Ssl_cipher AES256-SHA Ssl_cipher DHE-RSA-AES256-SHA
select * from t1; select * from t1;
f1 f1
5 5
@ -66,13 +66,15 @@ 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 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
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: xxxx 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
SHOW STATUS LIKE 'Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value Variable_name Value
Ssl_cipher AES256-SHA Ssl_cipher DHE-RSA-AES256-SHA
have_ssl Variable_name Value
1 Ssl_cipher DHE-RSA-AES256-SHA
End of 5.0 tests End of 5.0 tests
DROP TABLE IF EXISTS thread_status; DROP TABLE IF EXISTS thread_status;
DROP EVENT IF EXISTS event_status; DROP EVENT IF EXISTS event_status;
@ -100,7 +102,8 @@ Ssl_cipher AES128-SHA
SHOW STATUS LIKE 'Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value Variable_name Value
Ssl_cipher AES128-SHA Ssl_cipher AES128-SHA
mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxxCREATE TABLE t1(a int); mysqltest: Could not open connection 'default': 2026 SSL connection error: Failed to set ciphers to use
CREATE TABLE t1(a int);
INSERT INTO t1 VALUES (1), (2); INSERT INTO t1 VALUES (1), (2);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
@ -204,21 +207,22 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
mysqldump: Got error: 2026: SSL connection error: xxxx 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
DROP TABLE t1; DROP TABLE t1;
Variable_name Value Variable_name Value
Ssl_cipher AES256-SHA Ssl_cipher DHE-RSA-AES256-SHA
Variable_name Value Variable_name Value
Ssl_cipher DES-CBC3-SHA Ssl_cipher EDH-RSA-DES-CBC3-SHA
select 'is still running; no cipher request crashed the server' as result from dual; select 'is still running; no cipher request crashed the server' as result from dual;
result result
is still running; no cipher request crashed the server is still running; no cipher request crashed the server
GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509; GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509;
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
connect con1,localhost,bug42158,,,,,SSL; connect con1,localhost,bug42158,,,,,SSL;
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
have_ssl Variable_name Value
1 Ssl_cipher DHE-RSA-AES256-SHA
disconnect con1; disconnect con1;
connection default; connection default;
DROP USER bug42158@localhost; DROP USER bug42158@localhost;

View File

@ -3,14 +3,14 @@ grant select on test.* to ssl_sslv3@localhost require cipher "RC4-SHA";
create user ssl_tls12@localhost; create user ssl_tls12@localhost;
grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256"; grant select on test.* to ssl_tls12@localhost require cipher "AES128-SHA256";
TLS1.2 ciphers: user is ok with any cipher TLS1.2 ciphers: user is ok with any cipher
ERROR 2026 (HY000): SSL connection error: 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: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
TLS1.2 ciphers: user requires SSLv3 cipher RC4-SHA TLS1.2 ciphers: user requires SSLv3 cipher RC4-SHA
ERROR 2026 (HY000): SSL connection error: 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: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256 TLS1.2 ciphers: user requires TLSv1.2 cipher AES128-SHA256
ERROR 2026 (HY000): SSL connection error: 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: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
SSLv3 ciphers: user is ok with any cipher SSLv3 ciphers: user is ok with any cipher
Variable_name Value Variable_name Value
Ssl_cipher RC4-SHA Ssl_cipher RC4-SHA

View File

@ -15,13 +15,13 @@ Variable_name Value
Ssl_cipher AES128-SHA256 Ssl_cipher AES128-SHA256
ERROR 1045 (28000): Access denied for user 'ssl_tls12'@'localhost' (using password: NO) ERROR 1045 (28000): Access denied for user 'ssl_tls12'@'localhost' (using password: NO)
SSLv3 ciphers: user is ok with any cipher SSLv3 ciphers: user is ok with any cipher
ERROR 2026 (HY000): SSL connection error: 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: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
SSLv3 ciphers: user requires SSLv3 cipher RC4-SHA SSLv3 ciphers: user requires SSLv3 cipher RC4-SHA
ERROR 2026 (HY000): SSL connection error: 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: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256 SSLv3 ciphers: user requires TLSv1.2 cipher AES128-SHA256
ERROR 2026 (HY000): SSL connection error: 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: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
drop user ssl_sslv3@localhost; drop user ssl_sslv3@localhost;
drop user ssl_tls12@localhost; drop user ssl_tls12@localhost;

View File

@ -1,7 +1,7 @@
connect ssl_con,localhost,root,,,,,SSL; connect ssl_con,localhost,root,,,,,SSL;
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
have_ssl Variable_name Value
1 Ssl_cipher DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_server_not_before'; SHOW STATUS LIKE 'Ssl_server_not_before';
Variable_name Value Variable_name Value
Ssl_server_not_before Apr 25 14:55:05 2015 GMT Ssl_server_not_before Apr 25 14:55:05 2015 GMT
@ -2164,9 +2164,9 @@ Privat (Private Nutzung) Mobilfunk
Warnings: Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous Warning 1052 Column 'kundentyp' in group statement is ambiguous
drop table t1; drop table t1;
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
have_ssl Variable_name Value
1 Ssl_cipher DHE-RSA-AES256-SHA
select aes_decrypt('MySQL','adf'); select aes_decrypt('MySQL','adf');
aes_decrypt('MySQL','adf') aes_decrypt('MySQL','adf')
NULL NULL
@ -2176,7 +2176,7 @@ still connected?
connection default; connection default;
disconnect ssl_con; disconnect ssl_con;
create user mysqltest_1@localhost; create user mysqltest_1@localhost;
grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA"; grant usage on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
Variable_name Value Variable_name Value
Ssl_cipher AES256-SHA Ssl_cipher EDH-RSA-DES-CBC3-SHA
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;

View File

@ -1,2 +1,2 @@
have_ssl Variable_name Value
1 Ssl_cipher DHE-RSA-AES256-SHA

View File

@ -2,23 +2,23 @@
# Bug#21920657: SSL-CA FAILS SILENTLY IF THE PATH CANNOT BE FOUND # Bug#21920657: SSL-CA FAILS SILENTLY IF THE PATH CANNOT BE FOUND
# #
# try to connect with wrong '--ssl-ca' path : should fail # try to connect with wrong '--ssl-ca' path : should fail
ERROR 2026 (HY000): SSL connection error: xxxx ERROR 2026 (HY000): SSL connection error: SSL_CTX_set_default_verify_paths failed
# try to connect with correct '--ssl-ca' path : should connect # try to connect with correct '--ssl-ca' path : should connect
have_ssl Variable_name Value
1 Ssl_cipher DHE-RSA-AES256-SHA
# #
# Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY # Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY
# PATH SUBSTITUTION # PATH SUBSTITUTION
# #
# try to connect with '--ssl-ca' option using tilde home directoy # try to connect with '--ssl-ca' option using tilde home directoy
# path substitution : should connect # path substitution : should connect
have_ssl Variable_name Value
1 Ssl_cipher DHE-RSA-AES256-SHA
# try to connect with '--ssl-key' option using tilde home directoy # try to connect with '--ssl-key' option using tilde home directoy
# path substitution : should connect # path substitution : should connect
have_ssl Variable_name Value
1 Ssl_cipher DHE-RSA-AES256-SHA
# try to connect with '--ssl-cert' option using tilde home directoy # try to connect with '--ssl-cert' option using tilde home directoy
# path substitution : should connect # path substitution : should connect
have_ssl Variable_name Value
1 Ssl_cipher DHE-RSA-AES256-SHA

View File

@ -1,7 +1,7 @@
connect ssl_compress_con,localhost,root,,,,,SSL COMPRESS; connect ssl_compress_con,localhost,root,,,,,SSL COMPRESS;
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
have_ssl Variable_name Value
1 Ssl_cipher DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Compression'; SHOW STATUS LIKE 'Compression';
Variable_name Value Variable_name Value
Compression ON Compression ON
@ -2161,9 +2161,9 @@ Privat (Private Nutzung) Mobilfunk
Warnings: Warnings:
Warning 1052 Column 'kundentyp' in group statement is ambiguous Warning 1052 Column 'kundentyp' in group statement is ambiguous
drop table t1; drop table t1;
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
have_ssl Variable_name Value
1 Ssl_cipher DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Compression'; SHOW STATUS LIKE 'Compression';
Variable_name Value Variable_name Value
Compression ON Compression ON

View File

@ -1,9 +1,9 @@
# connect with read timeout so SLEEP() should timeout # connect with read timeout so SLEEP() should timeout
connect ssl_con,localhost,root,,,,,SSL read_timeout=5; connect ssl_con,localhost,root,,,,,SSL read_timeout=5;
# Check ssl turned on # Check ssl turned on
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
have_ssl Variable_name Value
1 Ssl_cipher DHE-RSA-AES256-SHA
SELECT SLEEP(600); SELECT SLEEP(600);
ERROR HY000: Lost connection to MySQL server during query ERROR HY000: Lost connection to MySQL server during query
connection default; connection default;

View File

@ -81,9 +81,9 @@ select * from t1 where a=999;
a b a b
drop table t1; drop table t1;
connect ssl_con,localhost,root,,,,,SSL; connect ssl_con,localhost,root,,,,,SSL;
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
have_ssl Variable_name Value
1 Ssl_cipher DHE-RSA-AES256-SHA
connection default; connection default;
create table t1 (a int, primary key (a), b int default 0) engine=innodb; create table t1 (a int, primary key (a), b int default 0) engine=innodb;
begin; begin;
@ -149,11 +149,11 @@ TOTAL_CONNECTIONS 2
TOTAL_SSL_CONNECTIONS 1 TOTAL_SSL_CONNECTIONS 1
CONCURRENT_CONNECTIONS 0 CONCURRENT_CONNECTIONS 0
ROWS_READ 6 ROWS_READ 6
ROWS_SENT 3 ROWS_SENT 2
ROWS_DELETED 1 ROWS_DELETED 1
ROWS_INSERTED 7 ROWS_INSERTED 7
ROWS_UPDATED 5 ROWS_UPDATED 5
SELECT_COMMANDS 4 SELECT_COMMANDS 3
UPDATE_COMMANDS 11 UPDATE_COMMANDS 11
OTHER_COMMANDS 7 OTHER_COMMANDS 7
COMMIT_TRANSACTIONS 19 COMMIT_TRANSACTIONS 19
@ -167,11 +167,11 @@ TOTAL_CONNECTIONS 2
TOTAL_SSL_CONNECTIONS 1 TOTAL_SSL_CONNECTIONS 1
CONCURRENT_CONNECTIONS 0 CONCURRENT_CONNECTIONS 0
ROWS_READ 6 ROWS_READ 6
ROWS_SENT 3 ROWS_SENT 2
ROWS_DELETED 1 ROWS_DELETED 1
ROWS_INSERTED 7 ROWS_INSERTED 7
ROWS_UPDATED 5 ROWS_UPDATED 5
SELECT_COMMANDS 4 SELECT_COMMANDS 3
UPDATE_COMMANDS 11 UPDATE_COMMANDS 11
OTHER_COMMANDS 7 OTHER_COMMANDS 7
COMMIT_TRANSACTIONS 19 COMMIT_TRANSACTIONS 19

View File

@ -16,22 +16,22 @@ create table t1(f1 int);
insert into t1 values (5); insert into t1 values (5);
grant select on test.* to ssl_user1@localhost require SSL; grant select on test.* to ssl_user1@localhost require SSL;
grant select on test.* to ssl_user2@localhost require cipher "AES256-SHA"; grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-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_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 "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_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 "AES256-SHA" AND SUBJECT "xxx"; grant select on test.* to ssl_user5@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "xxx";
flush privileges; flush privileges;
connect (con1,localhost,ssl_user1,,,,,SSL-CIPHER=AES256-SHA); connect (con1,localhost,ssl_user1,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error ER_ACCESS_DENIED_ERROR --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=AES256-SHA);
connect (con3,localhost,ssl_user3,,,,,SSL-CIPHER=AES256-SHA); connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA);
connect (con4,localhost,ssl_user4,,,,,SSL-CIPHER=AES256-SHA); connect (con3,localhost,ssl_user3,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA);
connect (con4,localhost,ssl_user4,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
connect (con5,localhost,ssl_user5,,,,,SSL-CIPHER=AES256-SHA); connect (con5,localhost,ssl_user5,,,,,SSL-CIPHER=DHE-RSA-AES256-SHA);
connection con1; connection con1;
# Check ssl turned on # Check ssl turned on
@ -79,6 +79,7 @@ drop table t1;
# #
--exec echo "this query should not execute;" > $MYSQLTEST_VARDIR/tmp/test.sql --exec echo "this query should not execute;" > $MYSQLTEST_VARDIR/tmp/test.sql
# Handle that openssl gives different error messages from YaSSL. # 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/ --replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
--error 1 --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 --exec $MYSQL_TEST --ssl-ca=$MYSQL_TEST_DIR/std_data/untrusted-cacert.pem --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
@ -88,6 +89,7 @@ drop table t1;
# Test that we can't open connection to server if we are using # Test that we can't open connection to server if we are using
# a blank ca # 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/ --replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
--error 1 --error 1
--exec $MYSQL_TEST --ssl-ca= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 --exec $MYSQL_TEST --ssl-ca= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
@ -97,6 +99,7 @@ drop table t1;
# Test that we can't open connection to server if we are using # Test that we can't open connection to server if we are using
# a nonexistent ca file # 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/ --replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
--error 1 --error 1
--exec $MYSQL_TEST --ssl-ca=nonexisting_file.pem --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 --exec $MYSQL_TEST --ssl-ca=nonexisting_file.pem --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
@ -106,27 +109,23 @@ drop table t1;
# Test that we can't open connection to server if we are using # Test that we can't open connection to server if we are using
# a blank client-key # a blank client-key
# #
--replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
--error 1 --error 1
--exec $MYSQL_TEST --ssl-key= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&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 # Test that we can't open connection to server if we are using
# a blank client-cert # a blank client-cert
# #
--replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/
--error 1 --error 1
--exec $MYSQL_TEST --ssl-cert= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&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 # Bug#21611 Slave can't connect when master-ssl-cipher specified
# - Apparently selecting a cipher doesn't work at all # - Apparently selecting a cipher doesn't work at all
# - Use a cipher that both yaSSL and OpenSSL supports # - Usa a cipher that both yaSSL and OpenSSL supports
# #
--exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql --exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql
--exec $MYSQL_TEST --ssl-cipher=AES256-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 --exec $MYSQL_TEST --ssl-cipher=DHE-RSA-AES256-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
# #
# Bug#25309 SSL connections without CA certificate broken since MySQL 5.0.23 # Bug#25309 SSL connections without CA certificate broken since MySQL 5.0.23
@ -135,7 +134,8 @@ drop table t1;
# verification of servers certificate by setting both ca certificate # verification of servers certificate by setting both ca certificate
# and ca path to NULL # and ca path to NULL
# #
--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 --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
--echo End of 5.0 tests --echo End of 5.0 tests
# #
@ -191,7 +191,6 @@ SET GLOBAL event_scheduler=0;
# Test to connect using an unknown cipher # Test to connect using an unknown cipher
# #
--exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit" > $MYSQLTEST_VARDIR/tmp/test.sql --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 --error 1
--exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 --exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1
@ -211,10 +210,9 @@ INSERT INTO t1 VALUES (1), (2);
# With wrong parameters # With wrong parameters
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR mysqldump.exe mysqldump --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR mysqldump.exe mysqldump
--replace_regex /\"SSL connection error.*/SSL connection error: xxxx/
--error 2 --error 2
--exec $MYSQL_DUMP --skip-create-options --skip-comments --ssl --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test 2>&1 --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; DROP TABLE t1;
--remove_file $MYSQLTEST_VARDIR/tmp/test.sql --remove_file $MYSQLTEST_VARDIR/tmp/test.sql
@ -224,8 +222,8 @@ DROP TABLE t1;
# #
# Common ciphers to openssl and yassl # Common ciphers to openssl and yassl
--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=DHE-RSA-AES256-SHA
--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=DES-CBC3-SHA --exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=EDH-RSA-DES-CBC3-SHA
--disable_query_log --disable_query_log
--disable_result_log --disable_result_log
@ -234,7 +232,20 @@ DROP TABLE t1;
--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=NOT----EXIST --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. # These probably exist but the server's keys can't be used to accept these kinds of connections.
--error 1,0 --error 1,0
--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=AES128-RMD --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. ##########################
# If this gives a result, then the bug is fixed. # If this gives a result, then the bug is fixed.
--enable_result_log --enable_result_log
@ -248,7 +259,8 @@ select 'is still running; no cipher request crashed the server' as result from d
GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509; GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509;
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
connect(con1,localhost,bug42158,,,,,SSL); connect(con1,localhost,bug42158,,,,,SSL);
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; --replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
disconnect con1; disconnect con1;
connection default; connection default;
DROP USER bug42158@localhost; DROP USER bug42158@localhost;

View File

@ -11,7 +11,8 @@
connect (ssl_con,localhost,root,,,,,SSL); connect (ssl_con,localhost,root,,,,,SSL);
# Check ssl turned on # Check ssl turned on
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; --replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
# Check ssl expiration # Check ssl expiration
SHOW STATUS LIKE 'Ssl_server_not_before'; SHOW STATUS LIKE 'Ssl_server_not_before';
@ -21,7 +22,8 @@ SHOW STATUS LIKE 'Ssl_server_not_after';
-- source include/common-tests.inc -- source include/common-tests.inc
# Check ssl turned on # Check ssl turned on
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; --replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA
SHOW STATUS LIKE '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 # 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
@ -33,8 +35,8 @@ connection default;
disconnect ssl_con; disconnect ssl_con;
create user mysqltest_1@localhost; create user mysqltest_1@localhost;
grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA"; grant usage on mysqltest.* to mysqltest_1@localhost require cipher "EDH-RSA-DES-CBC3-SHA";
--exec $MYSQL -umysqltest_1 --ssl-cipher=AES256-SHA -e "show status like 'ssl_cipher'" 2>&1 --exec $MYSQL -umysqltest_1 --ssl-cipher=EDH-RSA-DES-CBC3-SHA -e "show status like 'ssl_cipher'" 2>&1
drop user mysqltest_1@localhost; drop user mysqltest_1@localhost;
# Wait till all disconnects are completed # Wait till all disconnects are completed

View File

@ -26,10 +26,10 @@ create procedure have_ssl()
# we fake the test result for yassl # 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'`; let yassl=`select variable_value='Unknown' from information_schema.session_status where variable_name='Ssl_session_cache_mode'`;
if (!$yassl) { 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 --exec $MYSQL --ssl --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
} }
if ($yassl) { if ($yassl) {
--echo ERROR 2026 (HY000): SSL connection error: Failed to verify the server certificate --echo ERROR 2026 (HY000): SSL connection error: Failed to verify the server certificate
} }
drop procedure have_ssl; drop procedure have_ssl;

View File

@ -1,2 +1,3 @@
--loose-ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem --loose-ssl-key=$MYSQL_TEST_DIR/std_data/server8k-key.pem
--loose-ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem --loose-ssl-cert=$MYSQL_TEST_DIR/std_data/server8k-cert.pem
--loose-ssl-cipher=DHE-RSA-AES256-SHA

View File

@ -5,7 +5,7 @@
# #
# Bug#29784 YaSSL assertion failure when reading 8k key. # Bug#29784 YaSSL assertion failure when reading 8k key.
# #
--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 --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
## This test file is for testing encrypted communication only, not other ## This test file is for testing encrypted communication only, not other
## encryption routines that the SSL library happens to provide! ## encryption routines that the SSL library happens to provide!

View File

@ -6,14 +6,12 @@
--echo # --echo #
--echo # try to connect with wrong '--ssl-ca' path : should fail --echo # try to connect with wrong '--ssl-ca' path : should fail
--replace_regex /SSL connection error.*/SSL connection error: xxxx/
--error 1 --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 "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='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 "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1
--echo
--echo # try to connect with correct '--ssl-ca' path : should connect --echo # try to connect with correct '--ssl-ca' path : should connect
--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';" --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'"
--echo # --echo #
--echo # Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY --echo # Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY
@ -24,12 +22,15 @@
--echo # try to connect with '--ssl-ca' option using tilde home directoy --echo # try to connect with '--ssl-ca' option using tilde home directoy
--echo # path substitution : should connect --echo # path substitution : should connect
--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';" --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'"
--echo # try to connect with '--ssl-key' option using tilde home directoy --echo # try to connect with '--ssl-key' option using tilde home directoy
--echo # path substitution : should connect --echo # path substitution : should connect
--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';" --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'"
--echo # try to connect with '--ssl-cert' option using tilde home directoy --echo # try to connect with '--ssl-cert' option using tilde home directoy
--echo # path substitution : should connect --echo # path substitution : should connect
--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';" --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'"

View File

@ -11,7 +11,8 @@
connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS); connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS);
# Check ssl turned on # Check ssl turned on
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; --replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on # Check compression turned on
SHOW STATUS LIKE 'Compression'; SHOW STATUS LIKE 'Compression';
@ -20,7 +21,8 @@ SHOW STATUS LIKE 'Compression';
-- source include/common-tests.inc -- source include/common-tests.inc
# Check ssl turned on # Check ssl turned on
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; --replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on # Check compression turned on
SHOW STATUS LIKE 'Compression'; SHOW STATUS LIKE 'Compression';

View File

@ -7,7 +7,8 @@
connect (ssl_con,localhost,root,,,,,SSL read_timeout=5); connect (ssl_con,localhost,root,,,,,SSL read_timeout=5);
--echo # Check ssl turned on --echo # Check ssl turned on
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; --replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
# --error CR_SERVER_LOST # --error CR_SERVER_LOST
--error 2013 --error 2013

View File

@ -35,7 +35,8 @@ drop table t1;
# test SSL connections # test SSL connections
--connect (ssl_con,localhost,root,,,,,SSL) --connect (ssl_con,localhost,root,,,,,SSL)
SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; --replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA
SHOW STATUS LIKE 'Ssl_cipher';
--connection default --connection default
# #

View File

@ -16,7 +16,6 @@
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/mysys) 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 SET(MYSYS_SOURCES array.c charset-def.c charset.c checksum.c my_default.c
get_password.c
errors.c hash.c list.c errors.c hash.c list.c
mf_cache.c mf_dirname.c mf_fn_ext.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 mf_format.c mf_getdate.c mf_iocache.c mf_iocache2.c mf_keycache.c
@ -40,7 +39,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 lf_alloc-pin.c lf_dynarray.c lf_hash.c
safemalloc.c my_new.cc safemalloc.c my_new.cc
my_atomic.c my_getncpus.c my_safehash.c my_chmod.c my_rnd.c 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 ../sql-common/my_time.c my_uuid.c wqueue.c waiting_threads.c ma_dyncol.c
my_rdtsc.c my_context.c psi_noop.c my_rdtsc.c my_context.c psi_noop.c
file_logger.c) file_logger.c)

View File

@ -409,10 +409,3 @@ my_ulonglong find_set_from_flags(const TYPELIB *lib, uint default_name,
return res; 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 };

View File

@ -1005,6 +1005,11 @@ enum option_id {
static TYPELIB option_types={array_elements(default_options)-1, static TYPELIB option_types={array_elements(default_options)-1,
"options",default_options, NULL}; "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) static int add_init_command(struct st_mysql_options *options, const char *cmd)
{ {
char *tmp; char *tmp;
@ -4769,11 +4774,3 @@ mysql_get_socket(const MYSQL *mysql)
return vio_fd(mysql->net.vio); return vio_fd(mysql->net.vio);
return INVALID_SOCKET; return INVALID_SOCKET;
} }
int STDCALL mysql_cancel(MYSQL *mysql)
{
if (mysql->net.vio)
return vio_shutdown(mysql->net.vio, SHUT_RDWR);
return -1;
}

View File

@ -20,7 +20,7 @@
#include <m_ctype.h> #include <m_ctype.h>
/* Windows version of localtime_r() is declared in my_ptrhead.h */ /* Windows version of localtime_r() is declared in my_ptrhead.h */
#include <my_pthread.h> #include <my_pthread.h>
#include <mysqld_error.h>
ulonglong log_10_int[20]= ulonglong log_10_int[20]=
{ {
@ -777,9 +777,6 @@ long calc_daynr(uint year,uint month,uint day)
DBUG_RETURN(delsum+(int) y/4-temp); DBUG_RETURN(delsum+(int) y/4-temp);
} /* calc_daynr */ } /* 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 Convert time in MYSQL_TIME representation in system time zone to its

View File

@ -90,7 +90,7 @@ SET (SQL_SOURCE
key.cc log.cc lock.cc key.cc log.cc lock.cc
log_event.cc rpl_record.cc rpl_reporting.cc log_event.cc rpl_record.cc rpl_reporting.cc
log_event_old.cc rpl_record_old.cc log_event_old.cc rpl_record_old.cc
message.h mf_iocache.cc my_decimal.cc message.h mf_iocache.cc my_decimal.cc ../sql-common/my_time.c
mysqld.cc net_serv.cc keycaches.cc mysqld.cc net_serv.cc keycaches.cc
../sql-common/client_plugin.c ../sql-common/client_plugin.c
opt_range.cc opt_range.h opt_sum.cc opt_range.cc opt_range.h opt_sum.cc

View File

@ -1354,7 +1354,7 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet,
ulong data_len; ulong data_len;
char buf[LOG_EVENT_MINIMAL_HEADER_LEN]; char buf[LOG_EVENT_MINIMAL_HEADER_LEN];
uchar ev_offset= packet->length(); uchar ev_offset= packet->length();
#if !defined(MYSQL_CLIENT) #ifndef max_allowed_packet
THD *thd=current_thd; THD *thd=current_thd;
ulong max_allowed_packet= thd ? thd->slave_thread ? slave_max_allowed_packet ulong max_allowed_packet= thd ? thd->slave_thread ? slave_max_allowed_packet
: thd->variables.max_allowed_packet : thd->variables.max_allowed_packet

View File

@ -6324,7 +6324,7 @@ static void bootstrap(MYSQL_FILE *file)
mysql_cond_wait(&COND_thread_count, &LOCK_thread_count); mysql_cond_wait(&COND_thread_count, &LOCK_thread_count);
mysql_mutex_unlock(&LOCK_thread_count); mysql_mutex_unlock(&LOCK_thread_count);
#else #else
thd->emb_mysql= 0; thd->mysql= 0;
do_handle_bootstrap(thd); do_handle_bootstrap(thd);
#endif #endif

View File

@ -3853,7 +3853,9 @@ static int try_to_reconnect(THD *thd, MYSQL *mysql, Master_info *mi,
{ {
mi->slave_running= MYSQL_SLAVE_RUN_NOT_CONNECT; mi->slave_running= MYSQL_SLAVE_RUN_NOT_CONNECT;
thd->proc_info= messages[SLAVE_RECON_MSG_WAIT]; thd->proc_info= messages[SLAVE_RECON_MSG_WAIT];
thd->clear_active_mysql(); #ifdef SIGNAL_WITH_VIO_CLOSE
thd->clear_active_vio();
#endif
end_server(mysql); end_server(mysql);
if ((*retry_count)++) if ((*retry_count)++)
{ {
@ -4265,14 +4267,16 @@ err:
if (mysql) if (mysql)
{ {
/* /*
Here we need to clear the active mysql before closing the Here we need to clear the active VIO before closing the
connection with the master. The reason is that THD::awake() connection with the master. The reason is that THD::awake()
might be called from terminate_slave_thread() because somebody might be called from terminate_slave_thread() because somebody
issued a STOP SLAVE. If that happends, the close_active_mysql() issued a STOP SLAVE. If that happends, the close_active_vio()
can be called in the middle of closing the VIO associated with can be called in the middle of closing the VIO associated with
the 'mysql' object, causing a crash. the 'mysql' object, causing a crash.
*/ */
thd->clear_active_mysql(); #ifdef SIGNAL_WITH_VIO_CLOSE
thd->clear_active_vio();
#endif
mysql_close(mysql); mysql_close(mysql);
mi->mysql=0; mi->mysql=0;
} }
@ -6148,9 +6152,11 @@ void end_relay_log_info(Relay_log_info* rli)
extern "C" void slave_io_thread_detach_vio() extern "C" void slave_io_thread_detach_vio()
{ {
#ifdef SIGNAL_WITH_VIO_CLOSE
THD *thd= current_thd; THD *thd= current_thd;
if (thd && thd->slave_thread) if (thd && thd->slave_thread)
thd->clear_active_mysql(); thd->clear_active_vio();
#endif
} }
@ -6309,7 +6315,9 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi,
general_log_print(thd, COM_CONNECT_OUT, "%s@%s:%d", general_log_print(thd, COM_CONNECT_OUT, "%s@%s:%d",
mi->user, mi->host, mi->port); mi->user, mi->host, mi->port);
} }
thd->set_active_mysql(mysql); #ifdef SIGNAL_WITH_VIO_CLOSE
thd->set_active_vio(mysql->net.vio);
#endif
} }
mysql->reconnect= 1; mysql->reconnect= 1;
DBUG_PRINT("exit",("slave_was_killed: %d", slave_was_killed)); DBUG_PRINT("exit",("slave_was_killed: %d", slave_was_killed));

View File

@ -12287,10 +12287,6 @@ err:
fills MYSQL_PLUGIN_VIO_INFO structure with the information about the fills MYSQL_PLUGIN_VIO_INFO structure with the information about the
connection connection
*/ */
extern "C" void mpvio_info(Vio *vio,
MYSQL_PLUGIN_VIO_INFO *info);
static void server_mpvio_info(MYSQL_PLUGIN_VIO *vio, static void server_mpvio_info(MYSQL_PLUGIN_VIO *vio,
MYSQL_PLUGIN_VIO_INFO *info) MYSQL_PLUGIN_VIO_INFO *info)
{ {

View File

@ -984,8 +984,8 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
&variables.wt_timeout_short, &variables.wt_timeout_short,
&variables.wt_deadlock_search_depth_long, &variables.wt_deadlock_search_depth_long,
&variables.wt_timeout_long); &variables.wt_timeout_long);
#ifndef EMBEDDED_LIBRARY #ifdef SIGNAL_WITH_VIO_CLOSE
active_mysql= 0; active_vio = 0;
#endif #endif
mysql_mutex_init(key_LOCK_thd_data, &LOCK_thd_data, MY_MUTEX_INIT_FAST); 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); 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; free_connection_done= 0;
m_command= COM_CONNECT; m_command= COM_CONNECT;
profiling.reset(); profiling.reset();
#ifndef EMBEDDED_LIBRARY #ifdef SIGNAL_WITH_VIO_CLOSE
active_mysql = 0; active_vio = 0;
#endif #endif
} }
@ -1905,17 +1905,13 @@ void THD::awake(killed_state state_to_set)
if (state_to_set >= KILL_CONNECTION || state_to_set == NOT_KILLED) if (state_to_set >= KILL_CONNECTION || state_to_set == NOT_KILLED)
{ {
#ifdef SIGNAL_WITH_VIO_CLOSE
if (this != current_thd) if (this != current_thd)
{ {
#ifndef EMBEDDED_LIBRARY if(active_vio)
if (active_mysql) vio_shutdown(active_vio, SHUT_RDWR);
mysql_cancel(active_mysql);
else
#endif
if(net.vio)
vio_shutdown(net.vio, SHUT_RDWR);
} }
#endif
/* Mark the target thread's alarm request expired, and signal alarm. */ /* Mark the target thread's alarm request expired, and signal alarm. */
thr_alarm_kill(thread_id); thr_alarm_kill(thread_id);
@ -2010,13 +2006,15 @@ void THD::disconnect()
killed= KILL_CONNECTION; killed= KILL_CONNECTION;
#ifdef SIGNAL_WITH_VIO_CLOSE
/* /*
Since a active vio might might have not been set yet, in Since a active vio might might have not been set yet, in
any case save a reference to avoid closing a inexistent any case save a reference to avoid closing a inexistent
one or closing the vio twice if there is a active one. one or closing the vio twice if there is a active one.
*/ */
close_active_mysql(); vio= active_vio;
close_active_vio();
#endif
/* Disconnect even if a active vio is not associated. */ /* Disconnect even if a active vio is not associated. */
if (net.vio != vio) if (net.vio != vio)
@ -2679,19 +2677,21 @@ void THD::make_explain_field_list(List<Item> &field_list, uint8 explain_flags,
} }
void THD::close_active_mysql() #ifdef SIGNAL_WITH_VIO_CLOSE
void THD::close_active_vio()
{ {
DBUG_ENTER("close_active_mysql"); DBUG_ENTER("close_active_vio");
mysql_mutex_assert_owner(&LOCK_thd_data); mysql_mutex_assert_owner(&LOCK_thd_data);
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
if (active_mysql) if (active_vio)
{ {
mysql_close(active_mysql); vio_close(active_vio);
active_mysql= 0; active_vio = 0;
} }
#endif #endif
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
#endif
struct Item_change_record: public ilink struct Item_change_record: public ilink

View File

@ -45,7 +45,6 @@
#include <mysql/psi/mysql_idle.h> #include <mysql/psi/mysql_idle.h>
#include <mysql/psi/mysql_table.h> #include <mysql/psi/mysql_table.h>
#include <mysql_com_server.h> #include <mysql_com_server.h>
#include <mysql.h>
extern "C" extern "C"
void set_thd_stage_info(void *thd, void set_thd_stage_info(void *thd,
@ -2014,7 +2013,7 @@ public:
static const char * const DEFAULT_WHERE; static const char * const DEFAULT_WHERE;
#ifdef EMBEDDED_LIBRARY #ifdef EMBEDDED_LIBRARY
MYSQL *emb_mysql; struct st_mysql *mysql;
unsigned long client_stmt_id; unsigned long client_stmt_id;
unsigned long client_param_count; unsigned long client_param_count;
struct st_mysql_bind *client_params; struct st_mysql_bind *client_params;
@ -2426,11 +2425,9 @@ public:
#ifndef __WIN__ #ifndef __WIN__
sigset_t signals; sigset_t signals;
#endif #endif
#ifdef SIGNAL_WITH_VIO_CLOSE
#ifndef EMBEDDED_LIBRARY Vio* active_vio;
MYSQL *active_mysql;
#endif #endif
/* /*
This is to track items changed during execution of a prepared This is to track items changed during execution of a prepared
statement/stored procedure. It's created by statement/stored procedure. It's created by
@ -3028,25 +3025,21 @@ public:
void reset_for_reuse(); void reset_for_reuse();
bool store_globals(); bool store_globals();
void reset_globals(); void reset_globals();
#ifdef SIGNAL_WITH_VIO_CLOSE
inline void set_active_mysql(MYSQL *active_mysql) inline void set_active_vio(Vio* vio)
{ {
#ifndef EMBEDDED_LIBRARY
mysql_mutex_lock(&LOCK_thd_data); mysql_mutex_lock(&LOCK_thd_data);
this->active_mysql= active_mysql; active_vio = vio;
mysql_mutex_unlock(&LOCK_thd_data); mysql_mutex_unlock(&LOCK_thd_data);
#endif
} }
inline void clear_active_mysql() inline void clear_active_vio()
{ {
#ifndef EMBEDDED_LIBRARY
mysql_mutex_lock(&LOCK_thd_data); mysql_mutex_lock(&LOCK_thd_data);
active_mysql= 0; active_vio = 0;
mysql_mutex_unlock(&LOCK_thd_data); mysql_mutex_unlock(&LOCK_thd_data);
#endif
} }
void close_active_mysql(); void close_active_vio();
#endif
void awake(killed_state state_to_set); void awake(killed_state state_to_set);
/** Disconnect the associated communication endpoint. */ /** Disconnect the associated communication endpoint. */

View File

@ -857,7 +857,9 @@ static int check_connection(THD *thd)
DBUG_PRINT("info", DBUG_PRINT("info",
("New connection received on %s", vio_description(net->vio))); ("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 if (!thd->main_security_ctx.host) // If TCP/IP connection
{ {

View File

@ -15,21 +15,16 @@
ADD_DEFINITIONS("-DMYSQL_CLIENT") 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) ADD_EXECUTABLE(mysql_client_test mysql_client_test.c)
SET(CLIENT_LIB ${CONNECTOR_C_LIBS} mysys) TARGET_LINK_LIBRARIES(mysql_client_test mysqlclient)
SET_TARGET_PROPERTIES(mysql_client_test PROPERTIES LINKER_LANGUAGE CXX)
TARGET_LINK_LIBRARIES(mysql_client_test ${CLIENT_LIB})
ADD_DEPENDENCIES(mysql_client_test GenError mariadb_connector_c)
IF(WITH_UNIT_TESTS) IF(WITH_UNIT_TESTS)
ADD_EXECUTABLE(bug25714 bug25714.c) ADD_EXECUTABLE(bug25714 bug25714.c)
TARGET_LINK_LIBRARIES(bug25714 ${CLIENT_LIB}) TARGET_LINK_LIBRARIES(bug25714 mysqlclient)
ADD_DEPENDENCIES(bug25714 GenError mariadb_connector_c) SET_TARGET_PROPERTIES(bug25714 PROPERTIES LINKER_LANGUAGE CXX)
ENDIF() ENDIF()
INSTALL(TARGETS mysql_client_test DESTINATION ${INSTALL_BINDIR} COMPONENT Test) INSTALL(TARGETS mysql_client_test DESTINATION ${INSTALL_BINDIR} COMPONENT Test)
@ -39,6 +34,7 @@ FIND_LIBRARY(EVENT_LIBRARY event)
MARK_AS_ADVANCED(EVENT_LIBRARY) MARK_AS_ADVANCED(EVENT_LIBRARY)
IF(HAVE_EVENT_H AND EVENT_LIBRARY) IF(HAVE_EVENT_H AND EVENT_LIBRARY)
ADD_EXECUTABLE(async_queries async_queries.c) ADD_EXECUTABLE(async_queries async_queries.c)
TARGET_LINK_LIBRARIES(async_queries ${CLIENT_LIB} ${EVENT_LIBRARY}) TARGET_LINK_LIBRARIES(async_queries mysqlclient ${EVENT_LIBRARY})
ADD_DEPENDENCIES(async_queries GenError mariadb_connector_c) SET_TARGET_PROPERTIES(async_queries PROPERTIES LINKER_LANGUAGE CXX)
ENDIF() ENDIF()

View File

@ -21,7 +21,6 @@
#include <my_getopt.h> #include <my_getopt.h>
#include <m_string.h> #include <m_string.h>
#include <mysqld_error.h> #include <mysqld_error.h>
#include <mysql_version.h>
#include <sql_common.h> #include <sql_common.h>
#include <mysql/client_plugin.h> #include <mysql/client_plugin.h>
@ -364,7 +363,7 @@ static MYSQL* client_connect(ulong flag, uint protocol, my_bool auto_reconnect)
fprintf(stdout, "\n Check the connection options using --help or -?\n"); fprintf(stdout, "\n Check the connection options using --help or -?\n");
exit(1); exit(1);
} }
mysql_options(mysql, MYSQL_OPT_RECONNECT, &auto_reconnect); mysql->reconnect= auto_reconnect;
if (!opt_silent) if (!opt_silent)
fprintf(stdout, "OK"); fprintf(stdout, "OK");
@ -1146,7 +1145,7 @@ static my_bool thread_query(const char *query)
{ {
MYSQL *l_mysql; MYSQL *l_mysql;
my_bool error; my_bool error;
my_bool reconnect= 1;
error= 0; error= 0;
if (!opt_silent) if (!opt_silent)
fprintf(stdout, "\n in thread_query(%s)", query); fprintf(stdout, "\n in thread_query(%s)", query);
@ -1163,7 +1162,7 @@ static my_bool thread_query(const char *query)
error= 1; error= 1;
goto end; goto end;
} }
mysql_options(l_mysql, MYSQL_OPT_RECONNECT, &reconnect); l_mysql->reconnect= 1;
if (mysql_query(l_mysql, query)) if (mysql_query(l_mysql, query))
{ {
fprintf(stderr, "Query failed (%s)\n", mysql_error(l_mysql)); fprintf(stderr, "Query failed (%s)\n", mysql_error(l_mysql));

View File

@ -34,22 +34,8 @@
#include "mysql_client_fw.c" #include "mysql_client_fw.c"
static const my_bool my_true= 1;
/* Query processing */ /* 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() static void client_query()
{ {
int rc; int rc;
@ -3137,7 +3123,7 @@ static void test_long_data_str1()
int rc, i; int rc, i;
char data[255]; char data[255];
long length; long length;
ulong max_blob_length, blob_length= 0, length1; ulong max_blob_length, blob_length, length1;
my_bool true_value; my_bool true_value;
MYSQL_RES *result; MYSQL_RES *result;
MYSQL_BIND my_bind[2]; MYSQL_BIND my_bind[2];
@ -4826,7 +4812,7 @@ static void test_stmt_close()
myerror("connection failed"); myerror("connection failed");
exit(1); exit(1);
} }
mysql_options(lmysql, MYSQL_OPT_RECONNECT, &my_true); lmysql->reconnect= 1;
if (!opt_silent) if (!opt_silent)
fprintf(stdout, "OK"); fprintf(stdout, "OK");
@ -5510,7 +5496,7 @@ DROP TABLE IF EXISTS test_multi_tab";
fprintf(stdout, "\n connection failed(%s)", mysql_error(mysql_local)); fprintf(stdout, "\n connection failed(%s)", mysql_error(mysql_local));
exit(1); exit(1);
} }
mysql_options(mysql_local, MYSQL_OPT_RECONNECT, &my_true); mysql_local->reconnect= 1;
rc= mysql_query(mysql_local, query); rc= mysql_query(mysql_local, query);
myquery(rc); myquery(rc);
@ -5634,7 +5620,7 @@ static void test_prepare_multi_statements()
fprintf(stderr, "\n connection failed(%s)", mysql_error(mysql_local)); fprintf(stderr, "\n connection failed(%s)", mysql_error(mysql_local));
exit(1); exit(1);
} }
mysql_options(mysql_local, MYSQL_OPT_RECONNECT, &my_true); mysql_local->reconnect= 1;
strmov(query, "select 1; select 'another value'"); strmov(query, "select 1; select 'another value'");
stmt= mysql_simple_prepare(mysql_local, query); stmt= mysql_simple_prepare(mysql_local, query);
check_stmt_r(stmt); check_stmt_r(stmt);
@ -6350,8 +6336,6 @@ static void test_pure_coverage()
rc= mysql_stmt_execute(stmt); rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc); check_execute(stmt, rc);
#if 0
/* MariaDB C/C converts geometry to string */
my_bind[0].buffer_type= MYSQL_TYPE_GEOMETRY; my_bind[0].buffer_type= MYSQL_TYPE_GEOMETRY;
rc= mysql_stmt_bind_result(stmt, my_bind); rc= mysql_stmt_bind_result(stmt, my_bind);
check_execute_r(stmt, rc); /* unsupported buffer type */ check_execute_r(stmt, rc); /* unsupported buffer type */
@ -6362,7 +6346,6 @@ static void test_pure_coverage()
rc= mysql_stmt_store_result(stmt); rc= mysql_stmt_store_result(stmt);
DIE_UNLESS(rc); /* Old error must be reset first */ DIE_UNLESS(rc); /* Old error must be reset first */
#endif
mysql_stmt_close(stmt); mysql_stmt_close(stmt);
mysql_query(mysql, "DROP TABLE test_pure"); mysql_query(mysql, "DROP TABLE test_pure");
@ -7242,7 +7225,7 @@ static void test_prepare_grant()
mysql_close(lmysql); mysql_close(lmysql);
exit(1); exit(1);
} }
mysql_options(lmysql, MYSQL_OPT_RECONNECT, &my_true); lmysql->reconnect= 1;
if (!opt_silent) if (!opt_silent)
fprintf(stdout, "OK"); fprintf(stdout, "OK");
@ -7704,7 +7687,7 @@ static void test_drop_temp()
mysql_close(lmysql); mysql_close(lmysql);
exit(1); exit(1);
} }
mysql_options(lmysql, MYSQL_OPT_RECONNECT, &my_true); lmysql->reconnect= 1;
if (!opt_silent) if (!opt_silent)
fprintf(stdout, "OK"); fprintf(stdout, "OK");
@ -13419,7 +13402,10 @@ static void test_bug9478()
/* Fill in the fetch packet */ /* Fill in the fetch packet */
int4store(buff, stmt->stmt_id); int4store(buff, stmt->stmt_id);
buff[4]= 1; /* prefetch rows */ buff[4]= 1; /* prefetch rows */
rc= mysql_stmt_fetch(stmt); rc= ((*mysql->methods->advanced_command)(mysql, COM_STMT_FETCH,
(uchar*) buff,
sizeof(buff), 0,0,1,NULL) ||
(*mysql->methods->read_query_result)(mysql));
DIE_UNLESS(rc); DIE_UNLESS(rc);
if (!opt_silent && i == 0) if (!opt_silent && i == 0)
printf("Got error (as expected): %s\n", mysql_error(mysql)); printf("Got error (as expected): %s\n", mysql_error(mysql));
@ -15006,7 +14992,7 @@ static void test_bug15510()
static void test_opt_reconnect() static void test_opt_reconnect()
{ {
MYSQL *lmysql; MYSQL *lmysql;
my_bool my_true= TRUE;
myheader("test_opt_reconnect"); myheader("test_opt_reconnect");
@ -15017,8 +15003,8 @@ static void test_opt_reconnect()
} }
if (!opt_silent) if (!opt_silent)
fprintf(stdout, "reconnect before mysql_options: %d\n", get_reconnect(lmysql)); fprintf(stdout, "reconnect before mysql_options: %d\n", lmysql->reconnect);
DIE_UNLESS(get_reconnect(lmysql) == 0); DIE_UNLESS(lmysql->reconnect == 0);
if (mysql_options(lmysql, MYSQL_OPT_RECONNECT, &my_true)) if (mysql_options(lmysql, MYSQL_OPT_RECONNECT, &my_true))
{ {
@ -15028,8 +15014,8 @@ static void test_opt_reconnect()
/* reconnect should be 1 */ /* reconnect should be 1 */
if (!opt_silent) if (!opt_silent)
fprintf(stdout, "reconnect after mysql_options: %d\n", get_reconnect(lmysql)); fprintf(stdout, "reconnect after mysql_options: %d\n", lmysql->reconnect);
DIE_UNLESS(get_reconnect(lmysql) == 1); DIE_UNLESS(lmysql->reconnect == 1);
if (!(mysql_real_connect(lmysql, opt_host, opt_user, if (!(mysql_real_connect(lmysql, opt_host, opt_user,
opt_password, current_db, opt_port, opt_password, current_db, opt_port,
@ -15042,8 +15028,8 @@ static void test_opt_reconnect()
/* reconnect should still be 1 */ /* reconnect should still be 1 */
if (!opt_silent) if (!opt_silent)
fprintf(stdout, "reconnect after mysql_real_connect: %d\n", fprintf(stdout, "reconnect after mysql_real_connect: %d\n",
get_reconnect(lmysql)); lmysql->reconnect);
DIE_UNLESS(get_reconnect(lmysql) == 1); DIE_UNLESS(lmysql->reconnect == 1);
mysql_close(lmysql); mysql_close(lmysql);
@ -15054,8 +15040,8 @@ static void test_opt_reconnect()
} }
if (!opt_silent) if (!opt_silent)
fprintf(stdout, "reconnect before mysql_real_connect: %d\n", get_reconnect(lmysql)); fprintf(stdout, "reconnect before mysql_real_connect: %d\n", lmysql->reconnect);
DIE_UNLESS(get_reconnect(lmysql) == 0); DIE_UNLESS(lmysql->reconnect == 0);
if (!(mysql_real_connect(lmysql, opt_host, opt_user, if (!(mysql_real_connect(lmysql, opt_host, opt_user,
opt_password, current_db, opt_port, opt_password, current_db, opt_port,
@ -15068,8 +15054,8 @@ static void test_opt_reconnect()
/* reconnect should still be 0 */ /* reconnect should still be 0 */
if (!opt_silent) if (!opt_silent)
fprintf(stdout, "reconnect after mysql_real_connect: %d\n", fprintf(stdout, "reconnect after mysql_real_connect: %d\n",
get_reconnect(lmysql)); lmysql->reconnect);
DIE_UNLESS(get_reconnect(lmysql) == 0); DIE_UNLESS(lmysql->reconnect == 0);
mysql_close(lmysql); mysql_close(lmysql);
} }
@ -17999,8 +17985,7 @@ static void test_bug43560(void)
strncpy(buffer, values[2], BUFSIZE); strncpy(buffer, values[2], BUFSIZE);
length= strlen(buffer); length= strlen(buffer);
rc= mysql_stmt_execute(stmt); 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; opt_drop_db= 0;
client_disconnect(conn); client_disconnect(conn);

View File

@ -321,7 +321,6 @@ MK_WRAPPER(
mysql, mysql,
mysql) mysql)
#ifdef HAVE_DEPRECATED_ASYNC_API
MK_WRAPPER( MK_WRAPPER(
MYSQL_RES *, MYSQL_RES *,
mysql_list_dbs, mysql_list_dbs,
@ -357,7 +356,6 @@ MK_WRAPPER(
(mysql, table, wild), (mysql, table, wild),
mysql, mysql,
mysql) mysql)
#endif /* HAVE_DEPRECATED_ASYNC_API */
MK_WRAPPER( MK_WRAPPER(
my_bool, my_bool,
@ -502,6 +500,7 @@ MK_WRAPPER(
#define mysql_list_dbs wrap_mysql_list_dbs #define mysql_list_dbs wrap_mysql_list_dbs
#define mysql_list_tables wrap_mysql_list_tables #define mysql_list_tables wrap_mysql_list_tables
#define mysql_list_processes wrap_mysql_list_processes #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_read_query_result wrap_mysql_read_query_result
#define mysql_stmt_prepare wrap_mysql_stmt_prepare #define mysql_stmt_prepare wrap_mysql_stmt_prepare
#define mysql_stmt_execute wrap_mysql_stmt_execute #define mysql_stmt_execute wrap_mysql_stmt_execute

View File

@ -20,7 +20,8 @@ MY_ADD_TESTS(my_vsnprintf LINK_LIBRARIES strings mysys)
ADD_DEFINITIONS(${SSL_DEFINES}) ADD_DEFINITIONS(${SSL_DEFINES})
MY_ADD_TESTS(ma_dyncol LINK_LIBRARIES mysys) MY_ADD_TESTS(ma_dyncol
LINK_LIBRARIES mysqlclient)
IF(WIN32) IF(WIN32)
MY_ADD_TESTS(my_delete LINK_LIBRARIES mysys) MY_ADD_TESTS(my_delete LINK_LIBRARIES mysys)