Always test ssl and compress

 - Updated after review
parent cb96f195
...@@ -73,7 +73,6 @@ ...@@ -73,7 +73,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
...@@ -309,8 +308,6 @@ Q_ENABLE_INFO, Q_DISABLE_INFO, ...@@ -309,8 +308,6 @@ Q_ENABLE_INFO, Q_DISABLE_INFO,
Q_ENABLE_METADATA, Q_DISABLE_METADATA, Q_ENABLE_METADATA, Q_DISABLE_METADATA,
Q_EXEC, Q_DELIMITER, Q_EXEC, Q_DELIMITER,
Q_DISABLE_ABORT_ON_ERROR, Q_ENABLE_ABORT_ON_ERROR, Q_DISABLE_ABORT_ON_ERROR, Q_ENABLE_ABORT_ON_ERROR,
Q_DISABLE_SSL, Q_ENABLE_SSL,
Q_DISABLE_COMPRESS, Q_ENABLE_COMPRESS,
Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORIZONTAL_RESULTS, Q_DISPLAY_VERTICAL_RESULTS, Q_DISPLAY_HORIZONTAL_RESULTS,
Q_QUERY_VERTICAL, Q_QUERY_HORIZONTAL, Q_QUERY_VERTICAL, Q_QUERY_HORIZONTAL,
Q_START_TIMER, Q_END_TIMER, Q_START_TIMER, Q_END_TIMER,
...@@ -397,10 +394,6 @@ const char *command_names[]= ...@@ -397,10 +394,6 @@ const char *command_names[]=
"delimiter", "delimiter",
"disable_abort_on_error", "disable_abort_on_error",
"enable_abort_on_error", "enable_abort_on_error",
"disable_ssl",
"enable_ssl",
"disable_compress",
"enable_compress",
"vertical_results", "vertical_results",
"horizontal_results", "horizontal_results",
"query_vertical", "query_vertical",
...@@ -1839,23 +1832,29 @@ void free_replace() ...@@ -1839,23 +1832,29 @@ 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);
} }
} }
die("connection '%s' not found in connection pool", name); return 0; /* Connection not found */
DBUG_RETURN(1); /* Never reached */ }
int select_connection_name(const char *name)
{
struct connection *con;
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);
DBUG_RETURN(0);
} }
...@@ -1885,7 +1884,7 @@ int close_connection(struct st_query *q) ...@@ -1885,7 +1884,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++;
...@@ -1908,6 +1907,14 @@ int close_connection(struct st_query *q) ...@@ -1908,6 +1907,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);
} }
} }
...@@ -1923,18 +1930,22 @@ int close_connection(struct st_query *q) ...@@ -1923,18 +1930,22 @@ int close_connection(struct st_query *q)
) are delimiters/terminators ) are delimiters/terminators
*/ */
char* safe_get_param(char *str, char** arg, const char *msg) char* safe_get_param(char *str, char** arg, const char *msg, bool required)
{ {
DBUG_ENTER("safe_get_param"); DBUG_ENTER("safe_get_param");
if(!*str)
{
if (required)
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 (required && !*arg)
*str= 0;
}
if (!*str)
die(msg); die(msg);
*str++= 0; *str++= 0;
...@@ -2119,13 +2130,39 @@ int connect_n_handle_errors(struct st_query *q, MYSQL* con, const char* host, ...@@ -2119,13 +2130,39 @@ int connect_n_handle_errors(struct st_query *q, MYSQL* con, const char* host,
} }
/*
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;
...@@ -2133,57 +2170,97 @@ int do_connect(struct st_query *q) ...@@ -2133,57 +2170,97 @@ 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", 1);
p= safe_get_param(p, &con_host, "missing connection host"); p= safe_get_param(p, &con_host, "Missing connection host", 1);
p= safe_get_param(p, &con_user, "missing connection user"); p= safe_get_param(p, &con_user, "Missing connection user", 1);
p= safe_get_param(p, &con_pass, "missing connection password"); p= safe_get_param(p, &con_pass, "Missing connection password", 1);
p= safe_get_param(p, &con_db, "missing connection db"); p= safe_get_param(p, &con_db, "Missing connection db", 1);
if (!*p || *p == ';') /* Default port and sock */
{ /* Port */
con_port= port; VAR* var_port;
con_sock= (char*) unix_sock; p= safe_get_param(p, &con_port_str, "Missing connection port", 0);
} if (*con_port_str)
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)))
die("Unknown variable '%s'", con_port_str+1); die("Unknown variable '%s'", con_port_str+1);
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, "Missing connection socket", 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)))
die("Unknown variable '%s'", con_sock+1); die("Unknown variable '%s'", con_sock+1);
if (!(con_sock= (char*)my_malloc(var_sock->str_val_len+1, MYF(0)))) if (!(con_sock= (char*)my_malloc(var_sock->str_val_len+1, MYF(0))))
die("Out of memory"); die("Out of memory");
free_con_sock= 1; free_con_sock= 1;
memcpy(con_sock, var_sock->str_val, var_sock->str_val_len); memcpy(con_sock, var_sock->str_val, var_sock->str_val_len);
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, "Missing 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
...@@ -2214,6 +2291,7 @@ int do_connect(struct st_query *q) ...@@ -2214,6 +2291,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);
} }
...@@ -4053,12 +4131,6 @@ int main(int argc, char **argv) ...@@ -4053,12 +4131,6 @@ int main(int argc, char **argv)
case Q_DISABLE_QUERY_LOG: disable_query_log=1; break; case Q_DISABLE_QUERY_LOG: disable_query_log=1; break;
case Q_ENABLE_ABORT_ON_ERROR: abort_on_error=1; break; case Q_ENABLE_ABORT_ON_ERROR: abort_on_error=1; break;
case Q_DISABLE_ABORT_ON_ERROR: abort_on_error=0; break; case Q_DISABLE_ABORT_ON_ERROR: abort_on_error=0; break;
#ifdef HAVE_OPENSSL
case Q_ENABLE_SSL: opt_use_ssl=1; break;
case Q_DISABLE_SSL: opt_use_ssl=0; break;
#endif
case Q_ENABLE_COMPRESS: opt_compress=1; break;
case Q_DISABLE_COMPRESS: opt_compress=0; break;
case Q_ENABLE_RESULT_LOG: disable_result_log=0; break; case Q_ENABLE_RESULT_LOG: disable_result_log=0; break;
case Q_DISABLE_RESULT_LOG: disable_result_log=1; break; case Q_DISABLE_RESULT_LOG: disable_result_log=1; break;
case Q_ENABLE_WARNINGS: disable_warnings=0; break; case Q_ENABLE_WARNINGS: disable_warnings=0; break;
......
...@@ -191,7 +191,6 @@ our $opt_compress; ...@@ -191,7 +191,6 @@ our $opt_compress;
our $opt_ssl; our $opt_ssl;
our $opt_skip_ssl; our $opt_skip_ssl;
our $opt_ssl_supported; our $opt_ssl_supported;
our $opt_with_openssl; # Deprecated flag
our $opt_ps_protocol; our $opt_ps_protocol;
our $opt_current_test; our $opt_current_test;
...@@ -480,8 +479,7 @@ sub command_line_setup () { ...@@ -480,8 +479,7 @@ 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,
'with-openssl' => \$opt_with_openssl, 'ssl|with-openssl' => \$opt_ssl,
'ssl' => \$opt_ssl,
'skip-ssl' => \$opt_skip_ssl, 'skip-ssl' => \$opt_skip_ssl,
'compress' => \$opt_compress, 'compress' => \$opt_compress,
'bench' => \$opt_bench, 'bench' => \$opt_bench,
...@@ -1101,13 +1099,6 @@ sub kill_and_cleanup () { ...@@ -1101,13 +1099,6 @@ sub kill_and_cleanup () {
sub check_ssl_support () { sub check_ssl_support () {
# Convert deprecated --with-openssl to --ssl
if ( $opt_with_openssl )
{
$opt_ssl= 1;
}
if ($opt_skip_ssl) if ($opt_skip_ssl)
{ {
mtr_report("Skipping SSL"); mtr_report("Skipping SSL");
...@@ -2597,7 +2588,7 @@ Options to control what test suites or cases to run ...@@ -2597,7 +2588,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] 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"
......
...@@ -20,6 +20,10 @@ time_zone_transition_type ...@@ -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,9306,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES)
connect(localhost,root,z,test,9306,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 ...@@ -43,6 +47,14 @@ time_zone_transition_type
user user
show tables; show tables;
Tables_in_test Tables_in_test
connect(localhost,test,,test2,9306,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,,"",9306,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,zorro,test2,9306,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
connect(localhost,test,zorro,test,9306,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 ...@@ -70,6 +82,14 @@ time_zone_transition_type
user user
show tables; show tables;
Tables_in_test Tables_in_test
connect(localhost,test,,test2,9306,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,,test,9306,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: NO)
connect(localhost,test,zorro,test2,9306,MYSQL_TEST_DIR/var/tmp/master.sock);
ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
connect(localhost,test,zorro,test,9306,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);
......
...@@ -344,6 +344,18 @@ mysqltest: At line 1: Wrong column number to replace_column in 'replace_column 1 ...@@ -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
failing_statement; failing_statement;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'failing_statement' at line 1
failing_statement; failing_statement;
......
...@@ -3,12 +3,11 @@ ...@@ -3,12 +3,11 @@
-- source include/have_compress.inc -- source include/have_compress.inc
enable_compress;
# Reconnect to turn compress on for # Reconnect to turn compress on for
# default connection # default connection
disconnect default; disconnect default;
connect (default,localhost,root,,); connect (default,localhost,root,,,,,COMPRESS);
# Check compression turned on # Check compression turned on
SHOW STATUS LIKE 'Compression'; SHOW STATUS LIKE 'Compression';
...@@ -16,4 +15,3 @@ SHOW STATUS LIKE 'Compression'; ...@@ -16,4 +15,3 @@ SHOW STATUS LIKE 'Compression';
# Source select test case # Source select test case
-- source t/select.test -- source t/select.test
disable_compress;
# 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 @@ ...@@ -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
--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
#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
--error 1045
#connect (con1,localhost,test,,test2); connect (fail_con,localhost,test,,test2);
#--error 1045 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
#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
#--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
--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
--error 1045
#connect (con1,localhost,test,,test2); connect (fail_con,localhost,test,,test2);
#--error 1045 --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
#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
#--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
--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; ...@@ -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;
......
...@@ -498,8 +498,8 @@ drop table t1; ...@@ -498,8 +498,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;
......
...@@ -650,6 +650,7 @@ insert into t1 values (10),(11),(12); ...@@ -650,6 +650,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");
...@@ -674,8 +675,10 @@ insert into t1 (a) values (10),(11),(12); ...@@ -674,8 +675,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));
......
...@@ -358,11 +358,11 @@ select 3 from t1 ; ...@@ -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
...@@ -808,6 +808,66 @@ select "a" as col1, "c" as col2; ...@@ -808,6 +808,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
......
...@@ -13,11 +13,11 @@ grant select on test.* to ssl_user2@localhost require cipher "DHE-RSA-AES256-SHA ...@@ -13,11 +13,11 @@ 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;
enable_ssl;
connect (con1,localhost,ssl_user1,,); connect (con1,localhost,ssl_user1,,,,,SSL);
connect (con2,localhost,ssl_user2,,); connect (con2,localhost,ssl_user2,,,,,SSL);
connect (con3,localhost,ssl_user3,,); connect (con3,localhost,ssl_user3,,,,,SSL);
connect (con4,localhost,ssl_user4,,); connect (con4,localhost,ssl_user4,,,,,SSL);
connection con1; connection con1;
# Check ssl turned on # Check ssl turned on
......
...@@ -336,6 +336,7 @@ connection user1; ...@@ -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;
......
...@@ -3,12 +3,10 @@ ...@@ -3,12 +3,10 @@
-- source include/have_openssl.inc -- source include/have_openssl.inc
enable_ssl;
# Reconnect to turn ssl on for # Reconnect to turn ssl on for
# default connection # default connection
disconnect default; disconnect default;
connect (default,localhost,root,,); connect (default,localhost,root,,,,,SSL);
# Check ssl turned on # Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
...@@ -16,6 +14,5 @@ SHOW STATUS LIKE 'Ssl_cipher'; ...@@ -16,6 +14,5 @@ SHOW STATUS LIKE 'Ssl_cipher';
# Source select test case # Source select test case
-- source t/select.test -- source t/select.test
disable_ssl;
...@@ -4,13 +4,11 @@ ...@@ -4,13 +4,11 @@
-- source include/have_openssl.inc -- source include/have_openssl.inc
-- source include/have_compress.inc -- source include/have_compress.inc
enable_compress;
enable_ssl;
# Reconnect to turn ssl and compress on for # Reconnect to turn ssl and compress on for
# default connection # default connection
disconnect default; disconnect default;
connect (default,localhost,root,,); connect (default,localhost,root,,,,,SSL COMPRESS);
# Check ssl turned on # Check ssl turned on
SHOW STATUS LIKE 'Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher';
...@@ -21,5 +19,3 @@ SHOW STATUS LIKE 'Compression'; ...@@ -21,5 +19,3 @@ SHOW STATUS LIKE 'Compression';
# Source select test case # Source select test case
-- source t/select.test -- source t/select.test
disable_compress;
disable_ssl;
...@@ -5858,9 +5858,7 @@ struct show_var_st status_vars[]= { ...@@ -5858,9 +5858,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},
#ifdef HAVE_COMPRESS
{"Compression", (char*) 0, SHOW_NET_COMPRESSION}, {"Compression", (char*) 0, SHOW_NET_COMPRESSION},
#endif /* HAVE_COMPRESS */
{"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},
......
...@@ -1632,11 +1632,9 @@ static bool show_status_array(THD *thd, const char *wild, ...@@ -1632,11 +1632,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;
#ifdef HAVE_COMPRESS
case SHOW_NET_COMPRESSION: case SHOW_NET_COMPRESSION:
end= strmov(buff, thd->net.compress ? "ON" : "OFF"); end= strmov(buff, thd->net.compress ? "ON" : "OFF");
break; break;
#endif /* HAVE_COMPRESS */
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
......
...@@ -185,9 +185,7 @@ enum SHOW_TYPE ...@@ -185,9 +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 */
#ifdef HAVE_COMPRESS
SHOW_NET_COMPRESSION, SHOW_NET_COMPRESSION,
#endif /* HAVE_COMPRESS */
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment