From d72a4710aaad2f1e76ac20d50793f13f941ef899 Mon Sep 17 00:00:00 2001 From: Gleb Shchepa Date: Fri, 21 May 2010 22:47:32 +0400 Subject: Bug #53804: serious flaws in the alter database .. upgrade data directory name command The check_db_name function has been modified to validate tails of #mysql50#-prefixed database names for compliance with MySQL 5.0 database name encoding rules (the check_table_name function call has been reused). mysql-test/r/renamedb.result: Updated test case. mysql-test/r/upgrade.result: Test case for bug #53804. mysql-test/t/renamedb.test: Updated test case. mysql-test/t/upgrade.test: Test case for bug #53804. sql/mysql_priv.h: Bug #53804: serious flaws in the alter database .. upgrade data directory name command The check_mysql50_prefix has been added. sql/sql_table.cc: Bug #53804: serious flaws in the alter database .. upgrade data directory name command - The check_mysql50_prefix has been added. - The check_n_cut_mysql50_prefix function has been refactored to share code with new check_mysql50_prefix function. sql/table.cc: Bug #53804: serious flaws in the alter database .. upgrade data directory name command The check_db_name function has been modified to validate tails of #mysql50#-prefixed database names for compliance with MySQL 5.0 database name encoding rules. --- mysql-test/t/renamedb.test | 2 +- mysql-test/t/upgrade.test | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) (limited to 'mysql-test/t') diff --git a/mysql-test/t/renamedb.test b/mysql-test/t/renamedb.test index 84315090b7a..71d0c127058 100644 --- a/mysql-test/t/renamedb.test +++ b/mysql-test/t/renamedb.test @@ -44,7 +44,7 @@ ALTER DATABASE `#mysql41#not-supported` UPGRADE DATA DIRECTORY NAME; --error ER_WRONG_USAGE ALTER DATABASE `#mysql51#not-yet` UPGRADE DATA DIRECTORY NAME; ---error ER_WRONG_USAGE +--error ER_WRONG_DB_NAME ALTER DATABASE `#mysql50#` UPGRADE DATA DIRECTORY NAME; --error ER_BAD_DB_ERROR diff --git a/mysql-test/t/upgrade.test b/mysql-test/t/upgrade.test index e390e8a1253..a7b9a1531ff 100644 --- a/mysql-test/t/upgrade.test +++ b/mysql-test/t/upgrade.test @@ -137,3 +137,37 @@ select * from `a-b-c`.v1; --enable_ps_protocol drop database `a-b-c`; use test; + +--echo # End of 5.0 tests + +--echo # +--echo # Bug #53804: serious flaws in the alter database .. upgrade data +--echo # directory name command +--echo # + +--error ER_BAD_DB_ERROR +ALTER DATABASE `#mysql50#:` UPGRADE DATA DIRECTORY NAME; +--error ER_WRONG_DB_NAME +ALTER DATABASE `#mysql50#.` UPGRADE DATA DIRECTORY NAME; +--error ER_WRONG_DB_NAME +ALTER DATABASE `#mysql50#../` UPGRADE DATA DIRECTORY NAME; +--error ER_WRONG_DB_NAME +ALTER DATABASE `#mysql50#../..` UPGRADE DATA DIRECTORY NAME; +--error ER_WRONG_DB_NAME +ALTER DATABASE `#mysql50#../../` UPGRADE DATA DIRECTORY NAME; +--error ER_WRONG_DB_NAME +ALTER DATABASE `#mysql50#./blablabla` UPGRADE DATA DIRECTORY NAME; +--error ER_WRONG_DB_NAME +ALTER DATABASE `#mysql50#../blablabla` UPGRADE DATA DIRECTORY NAME; +--error ER_WRONG_DB_NAME +ALTER DATABASE `#mysql50#/` UPGRADE DATA DIRECTORY NAME; +--error ER_WRONG_DB_NAME +ALTER DATABASE `#mysql50#/.` UPGRADE DATA DIRECTORY NAME; + +--error ER_WRONG_DB_NAME +USE `#mysql50#.`; +--error ER_WRONG_DB_NAME +USE `#mysql50#../blablabla`; + +--echo # End of 5.1 tests + -- cgit v1.2.1