1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into  neptunus.(none):/home/msvensson/mysql/mysql-5.0
This commit is contained in:
msvensson@neptunus.(none)
2005-10-28 19:10:05 +02:00
37 changed files with 8821 additions and 152 deletions

View File

@ -22,8 +22,10 @@ else
yassl_dummy_link_fix= yassl_dummy_link_fix=
endif endif
#AUTOMAKE_OPTIONS = nostdinc #AUTOMAKE_OPTIONS = nostdinc
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ INCLUDES = -I$(top_builddir)/include \
-I$(top_srcdir)/regex $(openssl_includes) -I$(top_srcdir)/include \
-I$(top_srcdir)/regex \
$(openssl_includes) $(yassl_includes)
LIBS = @CLIENT_LIBS@ LIBS = @CLIENT_LIBS@
LDADD= @CLIENT_EXTRA_LDFLAGS@ \ LDADD= @CLIENT_EXTRA_LDFLAGS@ \
$(top_builddir)/libmysql/libmysqlclient.la $(top_builddir)/libmysql/libmysqlclient.la

View File

@ -77,7 +77,6 @@
#define PAD_SIZE 128 #define PAD_SIZE 128
#define MAX_CONS 128 #define MAX_CONS 128
#define MAX_INCLUDE_DEPTH 16 #define MAX_INCLUDE_DEPTH 16
#define LAZY_GUESS_BUF_SIZE 8192
#define INIT_Q_LINES 1024 #define INIT_Q_LINES 1024
#define MIN_VAR_ALLOC 32 #define MIN_VAR_ALLOC 32
#define BLOCK_STACK_DEPTH 32 #define BLOCK_STACK_DEPTH 32
@ -1837,23 +1836,28 @@ void free_replace()
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
struct connection * find_connection_by_name(const char *name)
int select_connection_name(const char *name)
{ {
struct connection *con; struct connection *con;
DBUG_ENTER("select_connection2");
DBUG_PRINT("enter",("name: '%s'", name));
for (con= cons; con < next_con; con++) for (con= cons; con < next_con; con++)
{ {
if (!strcmp(con->name, name)) if (!strcmp(con->name, name))
{ {
cur_con= con; return con;
DBUG_RETURN(0);
} }
} }
return 0; /* Connection not found */
}
int select_connection_name(const char *name)
{
DBUG_ENTER("select_connection2");
DBUG_PRINT("enter",("name: '%s'", name));
if (!(cur_con= find_connection_by_name(name)))
die("connection '%s' not found in connection pool", name); die("connection '%s' not found in connection pool", name);
DBUG_RETURN(1); /* Never reached */ DBUG_RETURN(0);
} }
@ -1883,7 +1887,7 @@ int close_connection(struct st_query *q)
DBUG_PRINT("enter",("name: '%s'",p)); DBUG_PRINT("enter",("name: '%s'",p));
if (!*p) if (!*p)
die("Missing connection name in connect"); die("Missing connection name in disconnect");
name= p; name= p;
while (*p && !my_isspace(charset_info,*p)) while (*p && !my_isspace(charset_info,*p))
p++; p++;
@ -1906,6 +1910,14 @@ int close_connection(struct st_query *q)
} }
#endif #endif
mysql_close(&con->mysql); mysql_close(&con->mysql);
my_free(con->name, MYF(0));
/*
When the connection is closed set name to "closed_connection"
to make it possible to reuse the connection name.
The connection slot will not be reused
*/
if (!(con->name = my_strdup("closed_connection", MYF(MY_WME))))
die("Out of memory");
DBUG_RETURN(0); DBUG_RETURN(0);
} }
} }
@ -1919,20 +1931,35 @@ int close_connection(struct st_query *q)
future to handle quotes. For now we assume that anything that is not future to handle quotes. For now we assume that anything that is not
a comma, a space or ) belongs to the argument. space is a chopper, comma or a comma, a space or ) belongs to the argument. space is a chopper, comma or
) are delimiters/terminators ) are delimiters/terminators
SYNOPSIS
safe_get_param
str - string to get param from
arg - pointer to string where result will be stored
msg - Message to display if param is not found
if msg is 0 this param is not required and param may be empty
RETURNS
pointer to str after param
*/ */
char* safe_get_param(char *str, char** arg, const char *msg) char* safe_get_param(char *str, char** arg, const char *msg)
{ {
DBUG_ENTER("safe_get_param"); DBUG_ENTER("safe_get_param");
if(!*str)
{
if (msg)
die(msg);
*arg= str;
DBUG_RETURN(str);
}
while (*str && my_isspace(charset_info,*str)) while (*str && my_isspace(charset_info,*str))
str++; str++;
*arg= str; *arg= str;
for (; *str && *str != ',' && *str != ')' ; str++) while (*str && *str != ',' && *str != ')')
{ str++;
if (my_isspace(charset_info,*str)) if (msg && !*arg)
*str= 0;
}
if (!*str)
die(msg); die(msg);
*str++= 0; *str++= 0;
@ -2117,13 +2144,39 @@ err:
} }
/*
Open a new connection to MySQL Server with the parameters
specified
SYNOPSIS
do_connect()
q called command
DESCRIPTION
connect(<name>,<host>,<user>,<pass>,<db>,[<port>,<sock>[<opts>]]);
<name> - name of the new connection
<host> - hostname of server
<user> - user to connect as
<pass> - password used when connecting
<db> - initial db when connected
<port> - server port
<sock> - server socket
<opts> - options to use for the connection
SSL - use SSL if available
COMPRESS - use compression if available
*/
int do_connect(struct st_query *q) int do_connect(struct st_query *q)
{ {
char *con_name, *con_user,*con_pass, *con_host, *con_port_str, char *con_name, *con_user,*con_pass, *con_host, *con_port_str,
*con_db, *con_sock; *con_db, *con_sock, *con_options;
char *p= q->first_argument; char *con_buf, *p;
char buff[FN_REFLEN]; char buff[FN_REFLEN];
int con_port; int con_port;
bool con_ssl= 0;
bool con_compress= 0;
int free_con_sock= 0; int free_con_sock= 0;
int error= 0; int error= 0;
int create_conn= 1; int create_conn= 1;
@ -2131,23 +2184,25 @@ int do_connect(struct st_query *q)
DBUG_ENTER("do_connect"); DBUG_ENTER("do_connect");
DBUG_PRINT("enter",("connect: %s",p)); DBUG_PRINT("enter",("connect: %s",p));
/* Make a copy of query before parsing, safe_get_param will modify */
if (!(con_buf= my_strdup(q->first_argument, MYF(MY_WME))))
die("Could not allocate con_buf");
p= con_buf;
if (*p != '(') if (*p != '(')
die("Syntax error in connect - expected '(' found '%c'", *p); die("Syntax error in connect - expected '(' found '%c'", *p);
p++; p++;
p= safe_get_param(p, &con_name, "missing connection name"); p= safe_get_param(p, &con_name, "Missing connection name");
p= safe_get_param(p, &con_host, "missing connection host"); p= safe_get_param(p, &con_host, "Missing connection host");
p= safe_get_param(p, &con_user, "missing connection user"); p= safe_get_param(p, &con_user, "Missing connection user");
p= safe_get_param(p, &con_pass, "missing connection password"); p= safe_get_param(p, &con_pass, "Missing connection password");
p= safe_get_param(p, &con_db, "missing connection db"); p= safe_get_param(p, &con_db, "Missing connection db");
if (!*p || *p == ';') /* Default port and sock */
/* Port */
VAR* var_port;
p= safe_get_param(p, &con_port_str, 0);
if (*con_port_str)
{ {
con_port= port;
con_sock= (char*) unix_sock;
}
else
{
VAR* var_port, *var_sock;
p= safe_get_param(p, &con_port_str, "missing connection port");
if (*con_port_str == '$') if (*con_port_str == '$')
{ {
if (!(var_port= var_get(con_port_str, 0, 0, 0))) if (!(var_port= var_get(con_port_str, 0, 0, 0)))
@ -2155,8 +2210,22 @@ int do_connect(struct st_query *q)
con_port= var_port->int_val; con_port= var_port->int_val;
} }
else else
{
con_port= atoi(con_port_str); con_port= atoi(con_port_str);
p= safe_get_param(p, &con_sock, "missing connection socket"); if (con_port == 0)
die("Illegal argument for port: '%s'", con_port_str);
}
}
else
{
con_port= port;
}
/* Sock */
VAR *var_sock;
p= safe_get_param(p, &con_sock, 0);
if (*con_sock)
{
if (*con_sock == '$') if (*con_sock == '$')
{ {
if (!(var_sock= var_get(con_sock, 0, 0, 0))) if (!(var_sock= var_get(con_sock, 0, 0, 0)))
@ -2168,20 +2237,44 @@ int do_connect(struct st_query *q)
con_sock[var_sock->str_val_len]= 0; con_sock[var_sock->str_val_len]= 0;
} }
} }
else
{
con_sock= (char*) unix_sock;
}
/* Options */
p= safe_get_param(p, &con_options, 0);
while (*con_options)
{
char* str= con_options;
while (*str && !my_isspace(charset_info, *str))
str++;
*str++= 0;
if (!strcmp(con_options, "SSL"))
con_ssl= 1;
else if (!strcmp(con_options, "COMPRESS"))
con_compress= 1;
else
die("Illegal option to connect: %s", con_options);
con_options= str;
}
q->last_argument= p; q->last_argument= p;
if (next_con == cons_end) if (next_con == cons_end)
die("Connection limit exhausted - increase MAX_CONS in mysqltest.c"); die("Connection limit exhausted - increase MAX_CONS in mysqltest.c");
if (find_connection_by_name(con_name))
die("Connection %s already exists", con_name);
if (!mysql_init(&next_con->mysql)) if (!mysql_init(&next_con->mysql))
die("Failed on mysql_init()"); die("Failed on mysql_init()");
if (opt_compress) if (opt_compress || con_compress)
mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS); mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS);
mysql_options(&next_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0); mysql_options(&next_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
mysql_options(&next_con->mysql, MYSQL_SET_CHARSET_NAME, charset_name); mysql_options(&next_con->mysql, MYSQL_SET_CHARSET_NAME, charset_name);
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
if (opt_use_ssl) if (opt_use_ssl || con_ssl)
mysql_ssl_set(&next_con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, mysql_ssl_set(&next_con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
opt_ssl_capath, opt_ssl_cipher); opt_ssl_capath, opt_ssl_cipher);
#endif #endif
@ -2212,6 +2305,7 @@ int do_connect(struct st_query *q)
} }
if (free_con_sock) if (free_con_sock)
my_free(con_sock, MYF(MY_WME)); my_free(con_sock, MYF(MY_WME));
my_free(con_buf, MYF(MY_WME));
DBUG_RETURN(error); DBUG_RETURN(error);
} }

View File

@ -15,10 +15,9 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [
fi fi
AC_MSG_RESULT([using bundled yaSSL]) AC_MSG_RESULT([using bundled yaSSL])
yassl_dir="extra/yassl" yassl_dir="extra/yassl"
openssl_libs="\ yassl_libs="-L\$(top_srcdir)/extra/yassl/src -lyassl -L\$(top_srcdir)/extra/yassl/taocrypt/src -ltaocrypt"
-L\$(top_builddir)/extra/yassl/src -lyassl\ yassl_libs_with_path="\$(top_srcdir)/extra/yassl/src/libyassl.a \$(top_srcdir)/extra/yassl/taocrypt/src/libtaocrypt.a"
-L\$(top_builddir)/extra/yassl/taocrypt/src -ltaocrypt" yassl_includes="-I\$(top_srcdir)/extra/yassl/include"
openssl_includes="-I\$(top_srcdir)/extra/yassl/include"
AC_DEFINE([HAVE_OPENSSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.]) AC_DEFINE([HAVE_OPENSSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
AC_DEFINE([HAVE_YASSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.]) AC_DEFINE([HAVE_YASSL], [1], [Defined by configure. Using yaSSL for OpenSSL emulation.])
# System specific checks # System specific checks
@ -36,8 +35,9 @@ AC_DEFUN([MYSQL_CHECK_YASSL], [
yassl_dir="" yassl_dir=""
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
fi fi
AC_SUBST(openssl_libs) AC_SUBST(yassl_libs)
AC_SUBST(openssl_includes) AC_SUBST(yassl_includes)
AC_SUBST(yassl_dir) AC_SUBST(yassl_dir)
AC_SUBST(yassl_libs_with_path)
AM_CONDITIONAL([HAVE_YASSL], [ test "with_yassl" = "yes" ]) AM_CONDITIONAL([HAVE_YASSL], [ test "with_yassl" = "yes" ])
]) ])

View File

@ -1129,7 +1129,7 @@ dnl Is this the right match for DEC OSF on alpha?
sql/Makefile.in) sql/Makefile.in)
# Use gen_lex_hash.linux instead of gen_lex_hash # Use gen_lex_hash.linux instead of gen_lex_hash
# Add library dependencies to mysqld_DEPENDENCIES # Add library dependencies to mysqld_DEPENDENCIES
lib_DEPENDENCIES="\$(bdb_libs_with_path) \$(innodb_libs) \$(ndbcluster_libs) \$(pstack_libs) \$(innodb_system_libs) \$(openssl_libs)" lib_DEPENDENCIES="\$(bdb_libs_with_path) \$(innodb_libs) \$(ndbcluster_libs) \$(pstack_libs) \$(innodb_system_libs) \$(openssl_libs) \$(yassl_libs)"
cat > $filesed << EOF cat > $filesed << EOF
s,\(^.*\$(MAKE) gen_lex_hash\)\$(EXEEXT),#\1, s,\(^.*\$(MAKE) gen_lex_hash\)\$(EXEEXT),#\1,
s,\(\./gen_lex_hash\)\$(EXEEXT),\1.linux, s,\(\./gen_lex_hash\)\$(EXEEXT),\1.linux,

View File

@ -1,7 +1,7 @@
INCLUDES = -I../include -I../taocrypt/include -I../mySTL INCLUDES = -I../include -I../taocrypt/include -I../mySTL
noinst_LTLIBRARIES = libyassl.la noinst_LIBRARIES = libyassl.a
libyassl_la_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \ libyassl_a_SOURCES = buffer.cpp cert_wrapper.cpp crypto_wrapper.cpp \
handshake.cpp lock.cpp log.cpp socket_wrapper.cpp ssl.cpp \ handshake.cpp lock.cpp log.cpp socket_wrapper.cpp ssl.cpp \
template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp template_instnt.cpp timer.cpp yassl_imp.cpp yassl_error.cpp yassl_int.cpp
EXTRA_DIST = ../include/*.hpp ../include/openssl/*.h EXTRA_DIST = ../include/*.hpp ../include/openssl/*.h

View File

@ -1,12 +1,15 @@
INCLUDES = -I../include -I../../mySTL INCLUDES = -I../include -I../../mySTL
noinst_LTLIBRARIES = libtaocrypt.la libtaoint.la noinst_LIBRARIES = libtaoint.a libtaocrypt.a
libtaocrypt_la_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp asn.cpp \
libtaoint_a_SOURCES = integer.cpp
libtaoint_a_CXXFLAGS = @yassl_integer_extra_cxxflags@
libtaocrypt_a_SOURCES = aes.cpp aestables.cpp algebra.cpp arc4.cpp asn.cpp \
coding.cpp dh.cpp des.cpp dsa.cpp file.cpp hash.cpp \ coding.cpp dh.cpp des.cpp dsa.cpp file.cpp hash.cpp \
md2.cpp md5.cpp misc.cpp random.cpp ripemd.cpp rsa.cpp sha.cpp \ md2.cpp md5.cpp misc.cpp random.cpp ripemd.cpp rsa.cpp sha.cpp \
template_instnt.cpp template_instnt.cpp
libtaocrypt_la_LIBADD = libtaoint.la libtaocrypt_a_LIBADD = libtaoint_a-integer.o
libtaoint_la_SOURCES = integer.cpp
libtaoint_la_CXXFLAGS = @yassl_integer_extra_cxxflags@
EXTRA_DIST = ../include/*.hpp EXTRA_DIST = ../include/*.hpp
AM_CXXFLAGS = -DYASSL_PURE_C AM_CXXFLAGS = -DYASSL_PURE_C

View File

@ -22,9 +22,9 @@
target = libmysqlclient.la target = libmysqlclient.la
target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@ target_defs = -DUNDEF_THREADS_HACK -DDONT_USE_RAID @LIB_EXTRA_CCFLAGS@
LIBS = @CLIENT_LIBS@ LIBS = @CLIENT_LIBS@ @yassl_libs@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes) @ZLIB_INCLUDES@ $(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@
include $(srcdir)/Makefile.shared include $(srcdir)/Makefile.shared

View File

@ -22,10 +22,10 @@
target = libmysqlclient_r.la target = libmysqlclient_r.la
target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@ target_defs = -DDONT_USE_RAID -DMYSQL_CLIENT @LIB_EXTRA_CCFLAGS@
LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@ LIBS = @LIBS@ @ZLIB_LIBS@ @openssl_libs@ @yassl_libs@
INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \ INCLUDES = -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes) @ZLIB_INCLUDES@ $(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@
## automake barfs if you don't use $(srcdir) or $(top_srcdir) in include ## automake barfs if you don't use $(srcdir) or $(top_srcdir) in include
include $(top_srcdir)/libmysql/Makefile.shared include $(top_srcdir)/libmysql/Makefile.shared

View File

@ -29,7 +29,7 @@ INCLUDES= @bdb_includes@ \
-I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir)/include -I$(top_srcdir)/include \
-I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples \ -I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples \
-I$(top_srcdir)/regex \ -I$(top_srcdir)/regex \
$(openssl_includes) @ZLIB_INCLUDES@ $(openssl_includes) $(yassl_includes) @ZLIB_INCLUDES@
noinst_LIBRARIES = libmysqld_int.a noinst_LIBRARIES = libmysqld_int.a
pkglib_LIBRARIES = libmysqld.a pkglib_LIBRARIES = libmysqld.a
@ -80,7 +80,9 @@ INC_LIB= $(top_builddir)/regex/libregex.a \
$(top_builddir)/mysys/libmysys.a \ $(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a \ $(top_builddir)/strings/libmystrings.a \
$(top_builddir)/dbug/libdbug.a \ $(top_builddir)/dbug/libdbug.a \
$(top_builddir)/vio/libvio.a $(top_builddir)/vio/libvio.a \
@yassl_libs_with_path@
# #
# To make it easy for the end user to use the embedded library we # To make it easy for the end user to use the embedded library we

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +0,0 @@
-- require r/have_openssl_1.require
disable_query_log;
SHOW STATUS LIKE 'Ssl_cipher';
enable_query_log;

View File

@ -187,6 +187,11 @@ our $opt_big_test= 0; # Send --big-test to mysqltest
our @opt_extra_mysqld_opt; our @opt_extra_mysqld_opt;
our $opt_compress; our $opt_compress;
our $opt_ssl;
our $opt_skip_ssl;
our $opt_ssl_supported;
our $opt_ps_protocol;
our $opt_current_test; our $opt_current_test;
our $opt_ddd; our $opt_ddd;
our $opt_debug; our $opt_debug;
@ -237,7 +242,6 @@ our $opt_skip_test;
our $opt_skip_im; our $opt_skip_im;
our $opt_sleep; our $opt_sleep;
our $opt_ps_protocol;
our $opt_sleep_time_after_restart= 1; our $opt_sleep_time_after_restart= 1;
our $opt_sleep_time_for_delete= 10; our $opt_sleep_time_for_delete= 10;
@ -278,7 +282,6 @@ our $opt_udiff;
our $opt_skip_ndbcluster; our $opt_skip_ndbcluster;
our $opt_with_ndbcluster; our $opt_with_ndbcluster;
our $opt_with_openssl;
our $exe_ndb_mgm; our $exe_ndb_mgm;
our $path_ndb_tools_dir; our $path_ndb_tools_dir;
@ -299,7 +302,8 @@ sub executable_setup ();
sub environment_setup (); sub environment_setup ();
sub kill_running_server (); sub kill_running_server ();
sub kill_and_cleanup (); sub kill_and_cleanup ();
sub ndbcluster_support (); sub check_ssl_support ();
sub check_ndbcluster_support ();
sub ndbcluster_install (); sub ndbcluster_install ();
sub ndbcluster_start (); sub ndbcluster_start ();
sub ndbcluster_stop (); sub ndbcluster_stop ();
@ -335,10 +339,8 @@ sub main () {
command_line_setup(); command_line_setup();
executable_setup(); executable_setup();
if (! $opt_skip_ndbcluster and ! $opt_with_ndbcluster) check_ndbcluster_support();
{ check_ssl_support();
$opt_with_ndbcluster= ndbcluster_support();
}
environment_setup(); environment_setup();
signal_setup(); signal_setup();
@ -488,6 +490,9 @@ sub command_line_setup () {
# Control what engine/variation to run # Control what engine/variation to run
'embedded-server' => \$opt_embedded_server, 'embedded-server' => \$opt_embedded_server,
'ps-protocol' => \$opt_ps_protocol, 'ps-protocol' => \$opt_ps_protocol,
'ssl|with-openssl' => \$opt_ssl,
'skip-ssl' => \$opt_skip_ssl,
'compress' => \$opt_compress,
'bench' => \$opt_bench, 'bench' => \$opt_bench,
'small-bench' => \$opt_small_bench, 'small-bench' => \$opt_small_bench,
'no-manager' => \$opt_no_manager, # Currently not used 'no-manager' => \$opt_no_manager, # Currently not used
@ -540,7 +545,6 @@ sub command_line_setup () {
# Misc # Misc
'big-test' => \$opt_big_test, 'big-test' => \$opt_big_test,
'compress' => \$opt_compress,
'debug' => \$opt_debug, 'debug' => \$opt_debug,
'fast' => \$opt_fast, 'fast' => \$opt_fast,
'local' => \$opt_local, 'local' => \$opt_local,
@ -565,7 +569,6 @@ sub command_line_setup () {
'testcase-timeout=i' => \$opt_testcase_timeout, 'testcase-timeout=i' => \$opt_testcase_timeout,
'suite-timeout=i' => \$opt_suite_timeout, 'suite-timeout=i' => \$opt_suite_timeout,
'warnings|log-warnings' => \$opt_warnings, 'warnings|log-warnings' => \$opt_warnings,
'with-openssl' => \$opt_with_openssl,
'help|h' => \$opt_usage, 'help|h' => \$opt_usage,
) or usage("Can't read options"); ) or usage("Can't read options");
@ -1170,13 +1173,59 @@ sub kill_and_cleanup () {
} }
sub check_ssl_support () {
if ($opt_skip_ssl)
{
mtr_report("Skipping SSL");
$opt_ssl_supported= 0;
$opt_ssl= 0;
return;
}
# check ssl support by testing using a switch
# that is only available in that case
if ( mtr_run($exe_mysqld,
["--no-defaults",
"--ssl",
"--help"],
"", "/dev/null", "/dev/null", "") != 0 )
{
if ( $opt_ssl)
{
mtr_error("Couldn't find support for SSL");
return;
}
mtr_report("Skipping SSL, mysqld not compiled with SSL");
$opt_ssl_supported= 0;
$opt_ssl= 0;
return;
}
mtr_report("Setting mysqld to support SSL connections");
$opt_ssl_supported= 1;
}
############################################################################## ##############################################################################
# #
# Start the ndb cluster # Start the ndb cluster
# #
############################################################################## ##############################################################################
sub ndbcluster_support () { sub check_ndbcluster_support () {
if ($opt_skip_ndbcluster)
{
mtr_report("Skipping ndbcluster");
$opt_with_ndbcluster= 0;
return;
}
if ($opt_with_ndbcluster)
{
mtr_report("Using ndbcluster");
return;
}
# check ndbcluster support by testing using a switch # check ndbcluster support by testing using a switch
# that is only available in that case # that is only available in that case
@ -1186,11 +1235,13 @@ sub ndbcluster_support () {
"--help"], "--help"],
"", "/dev/null", "/dev/null", "") != 0 ) "", "/dev/null", "/dev/null", "") != 0 )
{ {
mtr_report("No ndbcluster support"); mtr_report("Skipping ndbcluster, mysqld not compiled with ndbcluster");
return 0; $opt_with_ndbcluster= 0;
return;
} }
mtr_report("Has ndbcluster support"); mtr_report("Using ndbcluster, mysqld supports it");
return 1; $opt_with_ndbcluster= 1;
return;
} }
# FIXME why is there a different start below?! # FIXME why is there a different start below?!
@ -2075,7 +2126,7 @@ sub mysqld_arguments ($$$$$) {
mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix); mtr_add_arg($args, "%s--max_heap_table_size=1M", $prefix);
mtr_add_arg($args, "%s--log-bin-trust-routine-creators", $prefix); mtr_add_arg($args, "%s--log-bin-trust-routine-creators", $prefix);
if ( $opt_with_openssl ) if ( $opt_ssl_supported )
{ {
mtr_add_arg($args, "%s--ssl-ca=%s/std_data/cacert.pem", $prefix, mtr_add_arg($args, "%s--ssl-ca=%s/std_data/cacert.pem", $prefix,
$glob_mysql_test_dir); $glob_mysql_test_dir);
@ -2536,7 +2587,7 @@ sub run_mysqltest ($) {
mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir); mtr_add_arg($args, "--debug=d:t:A,%s/log/mysqltest.trace", $opt_vardir);
} }
if ( $opt_with_openssl ) if ( $opt_ssl_supported )
{ {
mtr_add_arg($args, "--ssl-ca=%s/std_data/cacert.pem", mtr_add_arg($args, "--ssl-ca=%s/std_data/cacert.pem",
$glob_mysql_test_dir); $glob_mysql_test_dir);
@ -2546,6 +2597,18 @@ sub run_mysqltest ($) {
$glob_mysql_test_dir); $glob_mysql_test_dir);
} }
# Turn on SSL for all test cases
if ( $opt_ssl )
{
mtr_add_arg($args, "--ssl",
$glob_mysql_test_dir);
}
elsif ( $opt_ssl_supported )
{
mtr_add_arg($args, "--skip-ssl",
$glob_mysql_test_dir);
}
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# If embedded server, we create server args to give mysqltest to pass on # If embedded server, we create server args to give mysqltest to pass on
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
@ -2622,6 +2685,9 @@ Options to control what engine/variation to run
embedded-server Use the embedded server, i.e. no mysqld daemons embedded-server Use the embedded server, i.e. no mysqld daemons
ps-protocol Use the binary protocol between client and server ps-protocol Use the binary protocol between client and server
compress Use the compressed protocol between client and server
ssl Use ssl protocol between client and server
skip-ssl Dont start sterver with support for ssl connections
bench Run the benchmark suite FIXME bench Run the benchmark suite FIXME
small-bench FIXME small-bench FIXME
@ -2629,6 +2695,7 @@ Options to control what test suites or cases to run
force Continue to run the suite after failure force Continue to run the suite after failure
with-ndbcluster Use cluster, and enable test cases that requres it with-ndbcluster Use cluster, and enable test cases that requres it
skip-ndb[cluster] Skip the ndb test cases, don't start cluster
do-test=PREFIX Run test cases which name are prefixed with PREFIX do-test=PREFIX Run test cases which name are prefixed with PREFIX
start-from=PREFIX Run test cases starting from test prefixed with PREFIX start-from=PREFIX Run test cases starting from test prefixed with PREFIX
suite=NAME Run the test suite named NAME. The default is "main" suite=NAME Run the test suite named NAME. The default is "main"
@ -2681,7 +2748,6 @@ Misc options
verbose Verbose output from this script verbose Verbose output from this script
script-debug Debug this script itself script-debug Debug this script itself
compress Use the compressed protocol between client and server
timer Show test case execution time timer Show test case execution time
start-and-exit Only initiate and start the "mysqld" servers, use the startup start-and-exit Only initiate and start the "mysqld" servers, use the startup
settings for the specified test case if any settings for the specified test case if any
@ -2694,6 +2760,9 @@ Misc options
testcase-timeout=MINUTES Max test case run time (default 5) testcase-timeout=MINUTES Max test case run time (default 5)
suite-timeout=MINUTES Max test suite run time (default 120) suite-timeout=MINUTES Max test suite run time (default 120)
Deprecated options
with-openssl Deprecated option for ssl
Options not yet described, or that I want to look into more Options not yet described, or that I want to look into more
@ -2710,7 +2779,6 @@ Options not yet described, or that I want to look into more
wait-timeout=SECONDS wait-timeout=SECONDS
warnings warnings
log-warnings log-warnings
with-openssl
HERE HERE
mtr_exit(1); mtr_exit(1);

2159
mysql-test/r/compress.result Normal file

File diff suppressed because it is too large Load Diff

View File

@ -20,6 +20,10 @@ time_zone_transition_type
user user
show tables; show tables;
Tables_in_test Tables_in_test
connect(localhost,root,z,test2,MASTER_PORT,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
connect(localhost,root,z,test,MASTER_PORT,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
grant ALL on *.* to test@localhost identified by "gambling"; grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling"; grant ALL on *.* to test@127.0.0.1 identified by "gambling";
show tables; show tables;
@ -43,6 +47,14 @@ time_zone_transition_type
user user
show tables; show tables;
Tables_in_test Tables_in_test
connect(localhost,test,,test2,MASTER_PORT,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,,"",MASTER_PORT,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,zorro,test2,MASTER_PORT,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
connect(localhost,test,zorro,test,MASTER_PORT,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
update mysql.user set password=old_password("gambling2") where user=_binary"test"; update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges; flush privileges;
set password=""; set password="";
@ -70,6 +82,14 @@ time_zone_transition_type
user user
show tables; show tables;
Tables_in_test Tables_in_test
connect(localhost,test,,test2,MASTER_PORT,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,,test,MASTER_PORT,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,zorro,test2,MASTER_PORT,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
connect(localhost,test,zorro,test,MASTER_PORT,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
delete from mysql.user where user=_binary"test"; delete from mysql.user where user=_binary"test";
flush privileges; flush privileges;
create table t1 (id integer not null auto_increment primary key); create table t1 (id integer not null auto_increment primary key);

View File

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

View File

@ -344,6 +344,18 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1
mysqltest: At line 1: Invalid integer argument "10!" mysqltest: At line 1: Invalid integer argument "10!"
mysqltest: At line 1: End of line junk detected: "!" mysqltest: At line 1: End of line junk detected: "!"
mysqltest: At line 1: Invalid integer argument "a" mysqltest: At line 1: Invalid integer argument "a"
mysqltest: At line 1: Syntax error in connect - expected '(' found 'mysqltest: At line 1: Missing connection host
mysqltest: At line 1: Missing connection host
mysqltest: At line 1: Missing connection user
mysqltest: At line 1: Missing connection user
mysqltest: At line 1: Missing connection password
mysqltest: At line 1: Missing connection db
mysqltest: At line 1: Could not open connection 'con2': Unknown database 'illegal_db'
mysqltest: At line 1: Illegal argument for port: 'illegal_port'
mysqltest: At line 1: Illegal option to connect: SMTP
mysqltest: In included file "./var/tmp/con.sql": At line 7: Connection limit exhausted - increase MAX_CONS in mysqltest.c
mysqltest: In included file "./var/tmp/con.sql": At line 3: connection 'test_con1' not found in connection pool
mysqltest: In included file "./var/tmp/con.sql": At line 2: Connection test_con1 already exists
Output from mysqltest-x.inc Output from mysqltest-x.inc
Output from mysqltest-x.inc Output from mysqltest-x.inc
Output from mysqltest-x.inc Output from mysqltest-x.inc

View File

@ -6,21 +6,33 @@ grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA
grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com"; grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com"; grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
flush privileges; flush privileges;
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
select * from t1; select * from t1;
f1 f1
5 5
delete from t1; delete from t1;
ERROR 42000: DELETE command denied to user 'ssl_user1'@'localhost' for table 't1' ERROR 42000: DELETE command denied to user 'ssl_user1'@'localhost' for table 't1'
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
select * from t1; select * from t1;
f1 f1
5 5
delete from t1; delete from t1;
ERROR 42000: DELETE command denied to user 'ssl_user2'@'localhost' for table 't1' ERROR 42000: DELETE command denied to user 'ssl_user2'@'localhost' for table 't1'
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
select * from t1; select * from t1;
f1 f1
5 5
delete from t1; delete from t1;
ERROR 42000: DELETE command denied to user 'ssl_user3'@'localhost' for table 't1' ERROR 42000: DELETE command denied to user 'ssl_user3'@'localhost' for table 't1'
SHOW STATUS LIKE 'Ssl_cipher';
Variable_name Value
Ssl_cipher DHE-RSA-AES256-SHA
select * from t1; select * from t1;
f1 f1
5 5

2159
mysql-test/r/ssl.result Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,15 @@
# Turn on compression between the client and server
# and run a number of tests
-- source include/have_compress.inc
connect (comp_con,localhost,root,,,,,COMPRESS);
# Check compression turned on
SHOW STATUS LIKE 'Compression';
# Source select test case
-- source include/common-tests.inc
# Check compression turned on
SHOW STATUS LIKE 'Compression';

View File

@ -1,7 +1,6 @@
# This test is to check various cases of connections # This test is to check various cases of connections
# with right and wrong password, with and without database # with right and wrong password, with and without database
# Unfortunately the check is incomplete as we can't handle errors on connect # Unfortunately the check is incomplete as we can't connect without database
# Also we can't connect without database
# This test makes no sense with the embedded server # This test makes no sense with the embedded server
--source include/not_embedded.inc --source include/not_embedded.inc
@ -10,69 +9,72 @@
drop table if exists t1,t2; drop table if exists t1,t2;
--enable_warnings --enable_warnings
#connect (con1,localhost,root,,""); #connect (con1,localhost,root,,"");
#show tables; #show tables;
connect (con1,localhost,root,,mysql); connect (con1,localhost,root,,mysql);
show tables; show tables;
connect (con1,localhost,root,,test); connect (con2,localhost,root,,test);
show tables; show tables;
# Re enable this one day if error handling on connect will take place --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_PORT
--error 1045
#connect (con1,localhost,root,z,test2); connect (fail_con,localhost,root,z,test2);
#--error 1045 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_PORT
#connect (con1,localhost,root,z,); --error 1045
#--error 1045 connect (fail_con,localhost,root,z,);
grant ALL on *.* to test@localhost identified by "gambling"; grant ALL on *.* to test@localhost identified by "gambling";
grant ALL on *.* to test@127.0.0.1 identified by "gambling"; grant ALL on *.* to test@127.0.0.1 identified by "gambling";
# Now check this user with different databases # Now check this user with different databases
#connect (con1,localhost,test,gambling,""); #connect (con1,localhost,test,gambling,"");
#show tables; #show tables;
connect (con1,localhost,test,gambling,mysql); connect (con3,localhost,test,gambling,mysql);
show tables; show tables;
connect (con1,localhost,test,gambling,test); connect (con4,localhost,test,gambling,test);
show tables; show tables;
# Re enable this one day if error handling on connect will take place --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_PORT
--error 1045
#connect (con1,localhost,test,,test2); connect (fail_con,localhost,test,,test2);
#--error 1045 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_PORT
#connect (con1,localhost,test,,""); --error 1045
#--error 1045 connect (fail_con,localhost,test,,"");
#connect (con1,localhost,test,zorro,test2); --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_PORT
#--error 1045 --error 1045
#connect (con1,localhost,test,zorro,); connect (fail_con,localhost,test,zorro,test2);
#--error 1045 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_PORT
--error 1045
connect (fail_con,localhost,test,zorro,);
# check if old password version also works # check if old password version also works
update mysql.user set password=old_password("gambling2") where user=_binary"test"; update mysql.user set password=old_password("gambling2") where user=_binary"test";
flush privileges; flush privileges;
#connect (con1,localhost,test,gambling2,""); connect (con10,localhost,test,gambling2,);
#show tables; connect (con5,localhost,test,gambling2,mysql);
connect (con1,localhost,test,gambling2,mysql);
set password=""; set password="";
--error 1372 --error 1372
set password='gambling3'; set password='gambling3';
set password=old_password('gambling3'); set password=old_password('gambling3');
show tables; show tables;
connect (con1,localhost,test,gambling3,test); connect (con6,localhost,test,gambling3,test);
show tables; show tables;
# Re enable this one day if error handling on connect will take place --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_PORT
--error 1045
#connect (con1,localhost,test,,test2); connect (fail_con,localhost,test,,test2);
#--error 1045 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_PORT
#connect (con1,localhost,test,,); --error 1045
#--error 1045 connect (fail_con,localhost,test,,);
#connect (con1,localhost,test,zorro,test2); --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_PORT
#--error 1045 --error 1045
#connect (con1,localhost,test,zorro,); connect (fail_con,localhost,test,zorro,test2);
#--error 1045 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MASTER_MYPORT MASTER_PORT
--error 1045
connect (fail_con,localhost,test,zorro,);
# remove user 'test' so that other tests which may use 'test' # remove user 'test' so that other tests which may use 'test'
@ -84,13 +86,13 @@ flush privileges;
# #
# Bug#12517: Clear user variables and replication events before # Bug#12517: Clear user variables and replication events before
# closing temp tables in thread cleanup. # closing temp tables in thread cleanup.
connect (con2,localhost,root,,test); connect (con7,localhost,root,,test);
connection con2; connection con7;
create table t1 (id integer not null auto_increment primary key); create table t1 (id integer not null auto_increment primary key);
create temporary table t2(id integer not null auto_increment primary key); create temporary table t2(id integer not null auto_increment primary key);
set @id := 1; set @id := 1;
delete from t1 where id like @id; delete from t1 where id like @id;
disconnect con2; disconnect con7;
--sleep 5 --sleep 5
connection default; connection default;
drop table t1; drop table t1;

View File

@ -499,8 +499,8 @@ drop table t1;
# #
grant select on test.* to mysqltest_4@localhost; grant select on test.* to mysqltest_4@localhost;
connect (user4,localhost,mysqltest_4,,); connect (user10261,localhost,mysqltest_4,,);
connection user4; connection user10261;
SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS
where COLUMN_NAME='TABLE_NAME'; where COLUMN_NAME='TABLE_NAME';
connection default; connection default;

View File

@ -722,6 +722,7 @@ insert into t1 values (10),(11),(12);
select * from t1; select * from t1;
check table t1; check table t1;
drop table t1; drop table t1;
disconnect con1;
# Same test with dynamic record length # Same test with dynamic record length
create table t1 (a int, b varchar(30) default "hello"); create table t1 (a int, b varchar(30) default "hello");
@ -746,8 +747,10 @@ insert into t1 (a) values (10),(11),(12);
select a from t1; select a from t1;
check table t1; check table t1;
drop table t1; drop table t1;
disconnect con1;
set global concurrent_insert=@save_concurrent_insert; set global concurrent_insert=@save_concurrent_insert;
# BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce # BUG#9622 - ANALYZE TABLE and ALTER TABLE .. ENABLE INDEX produce
# different statistics on the same table with NULL values. # different statistics on the same table with NULL values.
create table t1 (a int, key(a)); create table t1 (a int, key(a));

View File

@ -358,11 +358,11 @@ select 3 from t1 ;
# Missing delimiter # Missing delimiter
# The comment will be "sucked into" the sleep command since # The comment will be "sucked into" the sleep command since
# delimiter is missing until after "show status" # delimiter is missing until after "show status"
--system echo "sleep 4" > var/log/mysqltest.sql --system echo "sleep 4" > var/tmp/mysqltest.sql
--system echo "# A comment" >> var/log/mysqltest.sql --system echo "# A comment" >> var/tmp/mysqltest.sql
--system echo "show status;" >> var/log/mysqltest.sql --system echo "show status;" >> var/tmp/mysqltest.sql
--error 1 --error 1
--exec $MYSQL_TEST < var/log/mysqltest.sql 2>&1 --exec $MYSQL_TEST < var/tmp/mysqltest.sql 2>&1
# #
# Extra delimiter # Extra delimiter
@ -806,6 +806,66 @@ select "a" as col1, "c" as col2;
--error 1 --error 1
--exec echo "save_master_pos; sync_with_master a;" | $MYSQL_TEST 2>&1 --exec echo "save_master_pos; sync_with_master a;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
# Test connect
# ----------------------------------------------------------------------------
--error 1
--exec echo "connect;" | $MYSQL_TEST 2>&1
--error 1
--exec echo "connect ();" | $MYSQL_TEST 2>&1
--error 1
--exec echo "connect (con2);" | $MYSQL_TEST 2>&1
--error 1
--exec echo "connect (con2,);" | $MYSQL_TEST 2>&1
--error 1
--exec echo "connect (con2,localhost);" | $MYSQL_TEST 2>&1
--error 1
--exec echo "connect (con2, localhost, root);" | $MYSQL_TEST 2>&1
--error 1
--exec echo "connect (con2, localhost, root,);" | $MYSQL_TEST 2>&1
--error 1
--exec echo "connect (con2,localhost,root,,illegal_db);" | $MYSQL_TEST 2>&1
--error 1
--exec echo "connect (con1,localhost,root,,,illegal_port,);" | $MYSQL_TEST 2>&1
--error 1
--exec echo "connect (con1,localhost,root,,,,,SMTP POP);" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect
--exec echo "let \$i=100;" > var/tmp/con.sql
--exec echo "while (\$i)" >> var/tmp/con.sql
--exec echo "{" >> var/tmp/con.sql
--exec echo " connect (test_con1,localhost,root,,); " >> var/tmp/con.sql
--exec echo " disconnect test_con1; " >> var/tmp/con.sql
--exec echo " dec \$i; " >> var/tmp/con.sql
--exec echo "}" >> var/tmp/con.sql
--exec echo "source var/tmp/con.sql;" | $MYSQL_TEST 2>&1
# Repeat connect/disconnect, exceed max number of connections
--exec echo "let \$i=200;" > var/tmp/con.sql
--exec echo "while (\$i)" >> var/tmp/con.sql
--exec echo "{" >> var/tmp/con.sql
--exec echo " connect (test_con1,localhost,root,,); " >> var/tmp/con.sql
--exec echo " disconnect test_con1; " >> var/tmp/con.sql
--exec echo " dec \$i; " >> var/tmp/con.sql
--exec echo "}" >> var/tmp/con.sql
--error 1
--exec echo "source var/tmp/con.sql;" | $MYSQL_TEST 2>&1
# Select disconnected connection
--exec echo "connect (test_con1,localhost,root,,);" > var/tmp/con.sql
--exec echo "disconnect test_con1; " >> var/tmp/con.sql
--exec echo "connection test_con1;" >> var/tmp/con.sql
--error 1
--exec echo "source var/tmp/con.sql;" | $MYSQL_TEST 2>&1
# Connection name already used
--exec echo "connect (test_con1,localhost,root,,);" > var/tmp/con.sql
--exec echo "connect (test_con1,localhost,root,,);" >> var/tmp/con.sql
--error 1
--exec echo "source var/tmp/con.sql;" | $MYSQL_TEST 2>&1
# ---------------------------------------------------------------------------- # ----------------------------------------------------------------------------
# Test mysqltest arguments # Test mysqltest arguments

View File

@ -1,6 +1,6 @@
# We test openssl. Result set is optimized to be compiled with --with-openssl. # We test openssl. Result set is optimized to be compiled with --with-openssl.
# Use mysql-test-run with --with-openssl option. # Use mysql-test-run with --with-openssl option.
-- source include/have_openssl_1.inc -- source include/have_openssl.inc
--disable_warnings --disable_warnings
drop table if exists t1; drop table if exists t1;
@ -13,27 +13,36 @@ grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA
grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com"; grant select on test.* to ssl_user3@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com";
grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com"; grant select on test.* to ssl_user4@localhost require cipher "DHE-RSA-AES256-SHA" AND SUBJECT "/C=SE/L=Uppsala/O=MySQL AB/CN=MySQL Client/Email=abstract.mysql.developer@mysql.com" ISSUER "/C=SE/L=Uppsala/O=MySQL AB/CN=Abstract MySQL Developer/Email=abstract.mysql.developer@mysql.com";
flush privileges; flush privileges;
connect (con1,localhost,ssl_user1,,);
connect (con2,localhost,ssl_user2,,); connect (con1,localhost,ssl_user1,,,,,SSL);
connect (con3,localhost,ssl_user3,,); connect (con2,localhost,ssl_user2,,,,,SSL);
connect (con4,localhost,ssl_user4,,); connect (con3,localhost,ssl_user3,,,,,SSL);
connect (con4,localhost,ssl_user4,,,,,SSL);
connection con1; connection con1;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1; select * from t1;
--error 1142 --error 1142
delete from t1; delete from t1;
connection con2; connection con2;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1; select * from t1;
--error 1142 --error 1142
delete from t1; delete from t1;
connection con3; connection con3;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1; select * from t1;
--error 1142 --error 1142
delete from t1; delete from t1;
connection con4; connection con4;
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
select * from t1; select * from t1;
--error 1142 --error 1142
delete from t1; delete from t1;

View File

@ -1,4 +1,4 @@
source include/have_openssl_1.inc; source include/have_openssl.inc;
source include/master-slave.inc; source include/master-slave.inc;
# We don't test all types of ssl auth params here since it's a bit hard # We don't test all types of ssl auth params here since it's a bit hard

View File

@ -336,6 +336,7 @@ connection user1;
do 1; do 1;
use test; use test;
disconnect user1;
connection root; connection root;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost; REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
drop function bug_9503; drop function bug_9503;

17
mysql-test/t/ssl.test Normal file
View File

@ -0,0 +1,17 @@
# Turn on ssl between the client and server
# and run a number of tests
-- source include/have_openssl.inc
connect (ssl_con,localhost,root,,,,,SSL);
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
# Source select test case
-- source include/common-tests.inc
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';

View File

@ -0,0 +1,22 @@
# Turn on compression between the client and server
# and run a number of tests
-- source include/have_openssl.inc
-- source include/have_compress.inc
connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS);
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on
SHOW STATUS LIKE 'Compression';
# Source select test case
-- source include/common-tests.inc
# Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher';
# Check compression turned on
SHOW STATUS LIKE 'Compression';

View File

@ -15,7 +15,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
INCLUDES= @ZLIB_INCLUDES@ -I$(top_srcdir)/include \ INCLUDES= @ZLIB_INCLUDES@ -I$(top_srcdir)/include \
$(openssl_includes) -I$(top_builddir)/include @openssl_includes@ @yassl_includes@ -I$(top_builddir)/include
DEFS= -DMYSQL_INSTANCE_MANAGER -DMYSQL_SERVER DEFS= -DMYSQL_INSTANCE_MANAGER -DMYSQL_SERVER
@ -85,7 +85,7 @@ mysqlmanager_LDADD= liboptions.a \
$(top_builddir)/mysys/libmysys.a \ $(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a \ $(top_builddir)/strings/libmystrings.a \
$(top_builddir)/dbug/libdbug.a \ $(top_builddir)/dbug/libdbug.a \
@openssl_libs@ @ZLIB_LIBS@ @openssl_libs@ @yassl_libs@ @ZLIB_LIBS@
tags: tags:

View File

@ -1474,6 +1474,7 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
const char *capath __attribute__((unused)), const char *capath __attribute__((unused)),
const char *cipher __attribute__((unused))) const char *cipher __attribute__((unused)))
{ {
DBUG_ENTER("mysql_ssl_set");
#ifdef HAVE_OPENSSL #ifdef HAVE_OPENSSL
mysql->options.ssl_key= strdup_if_not_null(key); mysql->options.ssl_key= strdup_if_not_null(key);
mysql->options.ssl_cert= strdup_if_not_null(cert); mysql->options.ssl_cert= strdup_if_not_null(cert);
@ -1481,7 +1482,7 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
mysql->options.ssl_capath= strdup_if_not_null(capath); mysql->options.ssl_capath= strdup_if_not_null(capath);
mysql->options.ssl_cipher= strdup_if_not_null(cipher); mysql->options.ssl_cipher= strdup_if_not_null(cipher);
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */
return 0; DBUG_RETURN(0);
} }
@ -1494,6 +1495,7 @@ mysql_ssl_set(MYSQL *mysql __attribute__((unused)) ,
static void static void
mysql_ssl_free(MYSQL *mysql __attribute__((unused))) mysql_ssl_free(MYSQL *mysql __attribute__((unused)))
{ {
DBUG_ENTER("mysql_ssl_free");
my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.ssl_key, MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.ssl_cert, MYF(MY_ALLOW_ZERO_PTR));
my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR)); my_free(mysql->options.ssl_ca, MYF(MY_ALLOW_ZERO_PTR));
@ -1507,6 +1509,7 @@ mysql_ssl_free(MYSQL *mysql __attribute__((unused)))
mysql->options.ssl_cipher= 0; mysql->options.ssl_cipher= 0;
mysql->options.use_ssl = FALSE; mysql->options.use_ssl = FALSE;
mysql->connector_fd = 0; mysql->connector_fd = 0;
DBUG_VOID_RETURN;
} }
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */

View File

@ -22,7 +22,8 @@ MYSQLBASEdir= $(prefix)
INCLUDES = @ZLIB_INCLUDES@ \ INCLUDES = @ZLIB_INCLUDES@ \
@bdb_includes@ @innodb_includes@ @ndbcluster_includes@ \ @bdb_includes@ @innodb_includes@ @ndbcluster_includes@ \
-I$(top_builddir)/include -I$(top_srcdir)/include \ -I$(top_builddir)/include -I$(top_srcdir)/include \
-I$(top_srcdir)/regex -I$(srcdir) $(openssl_includes) -I$(top_srcdir)/regex -I$(srcdir) $(yassl_includes) \
$(openssl_includes)
WRAPLIBS= @WRAPLIBS@ WRAPLIBS= @WRAPLIBS@
SUBDIRS = share SUBDIRS = share
libexec_PROGRAMS = mysqld libexec_PROGRAMS = mysqld
@ -42,7 +43,8 @@ mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \
@bdb_libs@ @innodb_libs@ @pstack_libs@ \ @bdb_libs@ @innodb_libs@ @pstack_libs@ \
@innodb_system_libs@ \ @innodb_system_libs@ \
@ndbcluster_libs@ @ndbcluster_system_libs@ \ @ndbcluster_libs@ @ndbcluster_system_libs@ \
$(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ @openssl_libs@ $(LDADD) $(CXXLDFLAGS) $(WRAPLIBS) @LIBDL@ \
@yassl_libs@ @openssl_libs@
noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \ noinst_HEADERS = item.h item_func.h item_sum.h item_cmpfunc.h \
item_strfunc.h item_timefunc.h item_uniq.h \ item_strfunc.h item_timefunc.h item_uniq.h \
item_create.h item_subselect.h item_row.h \ item_create.h item_subselect.h item_row.h \

View File

@ -2860,7 +2860,14 @@ static void init_ssl()
opt_ssl_cipher); opt_ssl_cipher);
DBUG_PRINT("info",("ssl_acceptor_fd: 0x%lx", (long) ssl_acceptor_fd)); DBUG_PRINT("info",("ssl_acceptor_fd: 0x%lx", (long) ssl_acceptor_fd));
if (!ssl_acceptor_fd) if (!ssl_acceptor_fd)
{
opt_use_ssl = 0; opt_use_ssl = 0;
have_openssl= SHOW_OPTION_DISABLED;
}
}
else
{
have_openssl= SHOW_OPTION_DISABLED;
} }
if (des_key_file) if (des_key_file)
load_des_key_file(des_key_file); load_des_key_file(des_key_file);
@ -5952,6 +5959,7 @@ struct show_var_st status_vars[]= {
{"Com_xa_recover", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_RECOVER]),SHOW_LONG_STATUS}, {"Com_xa_recover", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_RECOVER]),SHOW_LONG_STATUS},
{"Com_xa_rollback", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_ROLLBACK]),SHOW_LONG_STATUS}, {"Com_xa_rollback", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_ROLLBACK]),SHOW_LONG_STATUS},
{"Com_xa_start", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_START]),SHOW_LONG_STATUS}, {"Com_xa_start", (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_XA_START]),SHOW_LONG_STATUS},
{"Compression", (char*) 0, SHOW_NET_COMPRESSION},
{"Connections", (char*) &thread_id, SHOW_LONG_CONST}, {"Connections", (char*) &thread_id, SHOW_LONG_CONST},
{"Created_tmp_disk_tables", (char*) offsetof(STATUS_VAR, created_tmp_disk_tables), SHOW_LONG_STATUS}, {"Created_tmp_disk_tables", (char*) offsetof(STATUS_VAR, created_tmp_disk_tables), SHOW_LONG_STATUS},
{"Created_tmp_files", (char*) &my_tmp_file_created, SHOW_LONG}, {"Created_tmp_files", (char*) &my_tmp_file_created, SHOW_LONG},

View File

@ -2172,8 +2172,9 @@ static void reset_stmt_params(Prepared_statement *stmt)
client, otherwise an error message is set in THD. client, otherwise an error message is set in THD.
*/ */
void mysql_stmt_execute(THD *thd, char *packet, uint packet_length) void mysql_stmt_execute(THD *thd, char *packet_arg, uint packet_length)
{ {
uchar *packet= (uchar*)packet_arg; // GCC 4.0.1 workaround
ulong stmt_id= uint4korr(packet); ulong stmt_id= uint4korr(packet);
ulong flags= (ulong) ((uchar) packet[4]); ulong flags= (ulong) ((uchar) packet[4]);
/* Query text for binary, general or slow log, if any of them is open */ /* Query text for binary, general or slow log, if any of them is open */

View File

@ -1642,6 +1642,9 @@ static bool show_status_array(THD *thd, const char *wild,
value= (value-(char*) &dflt_key_cache_var)+ (char*) dflt_key_cache; value= (value-(char*) &dflt_key_cache_var)+ (char*) dflt_key_cache;
end= longlong10_to_str(*(longlong*) value, buff, 10); end= longlong10_to_str(*(longlong*) value, buff, 10);
break; break;
case SHOW_NET_COMPRESSION:
end= strmov(buff, thd->net.compress ? "ON" : "OFF");
break;
case SHOW_UNDEF: // Show never happen case SHOW_UNDEF: // Show never happen
case SHOW_SYS: case SHOW_SYS:
break; // Return empty string break; // Return empty string

View File

@ -185,6 +185,7 @@ enum SHOW_TYPE
SHOW_SSL_CTX_SESS_TIMEOUTS, SHOW_SSL_CTX_SESS_CACHE_FULL, SHOW_SSL_CTX_SESS_TIMEOUTS, SHOW_SSL_CTX_SESS_CACHE_FULL,
SHOW_SSL_GET_CIPHER_LIST, SHOW_SSL_GET_CIPHER_LIST,
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */
SHOW_NET_COMPRESSION,
SHOW_RPL_STATUS, SHOW_SLAVE_RUNNING, SHOW_SLAVE_RETRIED_TRANS, SHOW_RPL_STATUS, SHOW_SLAVE_RUNNING, SHOW_SLAVE_RETRIED_TRANS,
SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_CONST_LONG, SHOW_KEY_CACHE_LONGLONG, SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_CONST_LONG, SHOW_KEY_CACHE_LONGLONG,
SHOW_LONG_STATUS, SHOW_LONG_CONST_STATUS, SHOW_SLAVE_SKIP_ERRORS SHOW_LONG_STATUS, SHOW_LONG_CONST_STATUS, SHOW_SLAVE_SKIP_ERRORS

View File

@ -20,23 +20,23 @@ else
yassl_dummy_link_fix= yassl_dummy_link_fix=
endif endif
INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \ INCLUDES= -I$(top_builddir)/include -I$(top_srcdir)/include \
$(openssl_includes) $(openssl_includes) $(yassl_includes)
LDADD= @CLIENT_EXTRA_LDFLAGS@ $(openssl_libs) LDADD= @CLIENT_EXTRA_LDFLAGS@ $(openssl_libs) $(yassl_libs)
pkglib_LIBRARIES= libvio.a pkglib_LIBRARIES= libvio.a
noinst_PROGRAMS = test-ssl test-sslserver test-sslclient noinst_PROGRAMS = test-ssl test-sslserver test-sslclient
noinst_HEADERS= vio_priv.h noinst_HEADERS= vio_priv.h
test_ssl_SOURCES= test-ssl.c $(yassl_dummy_link_fix) test_ssl_SOURCES= test-ssl.c $(yassl_dummy_link_fix)
test_ssl_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \ test_ssl_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \
../mysys/libmysys.a ../strings/libmystrings.a \ ../mysys/libmysys.a ../strings/libmystrings.a \
$(openssl_libs) $(openssl_libs) $(yassl_libs)
test_sslserver_SOURCES= test-sslserver.c $(yassl_dummy_link_fix) test_sslserver_SOURCES= test-sslserver.c $(yassl_dummy_link_fix)
test_sslserver_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \ test_sslserver_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \
../mysys/libmysys.a ../strings/libmystrings.a \ ../mysys/libmysys.a ../strings/libmystrings.a \
$(openssl_libs) $(openssl_libs) $(yassl_libs)
test_sslclient_SOURCES= test-sslclient.c $(yassl_dummy_link_fix) test_sslclient_SOURCES= test-sslclient.c $(yassl_dummy_link_fix)
test_sslclient_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \ test_sslclient_LDADD= @CLIENT_EXTRA_LDFLAGS@ ../dbug/libdbug.a libvio.a \
../mysys/libmysys.a ../strings/libmystrings.a \ ../mysys/libmysys.a ../strings/libmystrings.a \
$(openssl_libs) $(openssl_libs) $(yassl_libs)
libvio_a_SOURCES= vio.c viosocket.c viossl.c viosslfactories.c libvio_a_SOURCES= vio.c viosocket.c viossl.c viosslfactories.c
# Don't update the files from bitkeeper # Don't update the files from bitkeeper