From 2144dc1ff2916ba1c0b0fded9cb7022b9ecf47a9 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 21 Apr 2020 18:45:12 +0200 Subject: [PATCH] more verbose tests --- mysql-test/include/switch_to_mysql_global_priv.inc | 1 + mysql-test/include/switch_to_mysql_user.inc | 1 + mysql-test/main/connect.result | 4 ++++ mysql-test/main/empty_user_table.result | 2 ++ mysql-test/main/grant.result | 2 ++ mysql-test/main/grant4.result | 4 ++++ mysql-test/main/grant_4332.result | 2 ++ mysql-test/main/mysql_upgrade.result | 4 ++++ mysql-test/main/mysql_upgrade_noengine.result | 3 +++ mysql-test/main/password_expiration.result | 2 ++ mysql-test/main/plugin_auth.result | 1 + mysql-test/main/set_password.result | 2 ++ mysql-test/main/sp_notembedded.result | 4 ++++ mysql-test/main/system_mysql_db_507.result | 2 ++ mysql-test/suite/plugins/r/multiauth.result | 2 ++ .../roles/create_and_drop_role_invalid_user_table.result | 2 ++ 16 files changed, 38 insertions(+) diff --git a/mysql-test/include/switch_to_mysql_global_priv.inc b/mysql-test/include/switch_to_mysql_global_priv.inc index 78df6642760..3a93746c4e8 100644 --- a/mysql-test/include/switch_to_mysql_global_priv.inc +++ b/mysql-test/include/switch_to_mysql_global_priv.inc @@ -1,3 +1,4 @@ +echo # switching back from mysql.user to mysql.global_priv; disable_query_log; drop table mysql.user; rename table mysql.user_bak to mysql.user; diff --git a/mysql-test/include/switch_to_mysql_user.inc b/mysql-test/include/switch_to_mysql_user.inc index 4d67f30a10b..7e5e460390c 100644 --- a/mysql-test/include/switch_to_mysql_user.inc +++ b/mysql-test/include/switch_to_mysql_user.inc @@ -1,3 +1,4 @@ +echo # switching from mysql.global_priv to mysql.user; disable_query_log; rename table mysql.user to mysql.user_bak; CREATE TABLE mysql.user ( diff --git a/mysql-test/main/connect.result b/mysql-test/main/connect.result index ee1844bc3ee..229c2d9dafe 100644 --- a/mysql-test/main/connect.result +++ b/mysql-test/main/connect.result @@ -99,6 +99,7 @@ ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET); connect fail_con,localhost,test,zorro,; ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) +# switching from mysql.global_priv to mysql.user update mysql.user set plugin="", authentication_string="", password=old_password("gambling2") where user=_binary"test"; flush privileges; show grants for test@localhost; @@ -168,6 +169,7 @@ ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET); connect fail_con,localhost,test,zorro,; ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) +# switching back from mysql.user to mysql.global_priv delete from mysql.user where user=_binary"test"; connect con7,localhost,root,,test; create table t1 (id integer not null auto_increment primary key); @@ -363,6 +365,7 @@ connect(localhost,mysqltest_nouser,,test,MASTER_PORT,MASTER_SOCKET); connect pcon5,localhost,mysqltest_nouser,,,$MASTER_MYPORT,; ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: NO) connection default; +# switching from mysql.global_priv to mysql.user update mysql.user set plugin='mysql_native_password' where user = 'mysqltest_up1'; update mysql.user set plugin='mysql_old_password' where user = 'mysqltest_up2'; select user, password, plugin, authentication_string from mysql.user @@ -382,6 +385,7 @@ user() current_user() mysqltest_up2@localhost mysqltest_up2@% disconnect pcon7; connection default; +# switching back from mysql.user to mysql.global_priv DROP USER mysqltest_up1@'%'; DROP USER mysqltest_up2@'%'; # diff --git a/mysql-test/main/empty_user_table.result b/mysql-test/main/empty_user_table.result index 924e4cd8ea5..e5307c36e24 100644 --- a/mysql-test/main/empty_user_table.result +++ b/mysql-test/main/empty_user_table.result @@ -7,8 +7,10 @@ Got one of the listed errors insert mysql.global_priv select * from t1; drop table t1; flush privileges; +# switching from mysql.global_priv to mysql.user truncate table mysql.user; flush privileges; connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET); connect fail,localhost,u1; Got one of the listed errors +# switching back from mysql.user to mysql.global_priv diff --git a/mysql-test/main/grant.result b/mysql-test/main/grant.result index 5d4fdabfd41..3d2313e8c9b 100644 --- a/mysql-test/main/grant.result +++ b/mysql-test/main/grant.result @@ -2757,6 +2757,7 @@ DROP USER dummy@localhost; # # MDEV-19948 'show grants' return privileges individually # +# switching from mysql.global_priv to mysql.user CREATE USER ten2; GRANT ALL ON *.* TO ten2; SHOW GRANTS FOR ten2; @@ -2767,6 +2768,7 @@ SHOW GRANTS FOR ten2; Grants for ten2@% GRANT ALL PRIVILEGES ON *.* TO `ten2`@`%` DROP USER ten2; +# switching back from mysql.user to mysql.global_priv # # End of 10.3 tests # diff --git a/mysql-test/main/grant4.result b/mysql-test/main/grant4.result index 9da0b0b40b7..f252a4c2ad5 100644 --- a/mysql-test/main/grant4.result +++ b/mysql-test/main/grant4.result @@ -129,6 +129,7 @@ connection default; disconnect con1; drop database mysqltest_db1; drop user mysqltest_u1@localhost; +# switching from mysql.global_priv to mysql.user call mtr.add_suppression("Table 'mysql.user' doesn't exist"); call mtr.add_suppression("'mysql.user' is not of type 'TABLE'"); rename table mysql.user to mysql.user1; @@ -141,6 +142,8 @@ flush privileges; ERROR 42S02: Table 'mysql.user' doesn't exist drop temporary table mysql.user; rename table mysql.user1 to mysql.user; +# switching back from mysql.user to mysql.global_priv +# switching from mysql.global_priv to mysql.user call mtr.add_suppression('mysql.user table is damaged'); rename table mysql.user to mysql.user1; create table mysql.user (Host char(100), User char(100)); @@ -148,6 +151,7 @@ flush privileges; ERROR HY000: Unknown error drop table mysql.user; rename table mysql.user1 to mysql.user; +# switching back from mysql.user to mysql.global_priv End of 5.5 tests # # Additional coverage for refactoring which is made as part diff --git a/mysql-test/main/grant_4332.result b/mysql-test/main/grant_4332.result index af6b23088f5..7fc29795b6f 100644 --- a/mysql-test/main/grant_4332.result +++ b/mysql-test/main/grant_4332.result @@ -1,3 +1,4 @@ +# switching from mysql.global_priv to mysql.user set global sql_mode=""; set local sql_mode=""; alter table mysql.user modify User char(16) binary not null default ''; @@ -33,3 +34,4 @@ def user() 253 141 14 N 1 39 8 user() root@localhost set global sql_mode=default; +# switching back from mysql.user to mysql.global_priv diff --git a/mysql-test/main/mysql_upgrade.result b/mysql-test/main/mysql_upgrade.result index 862e7e8f3d4..33c3d1b8198 100644 --- a/mysql-test/main/mysql_upgrade.result +++ b/mysql-test/main/mysql_upgrade.result @@ -575,6 +575,7 @@ SET GLOBAL enforce_storage_engine=NULL; # Ensure that mysql_upgrade correctly sets truncate_versioning_priv # on upgrade from 10.2 # +# switching from mysql.global_priv to mysql.user drop view mysql.user_bak; CREATE USER 'user3'@'%'; GRANT USAGE ON *.* TO 'user3'@'%'; @@ -593,6 +594,7 @@ update mysql.db set Delete_history_priv='Y' where db like 'test%'; drop table mysql.global_priv; rename table mysql.global_priv_bak to mysql.global_priv; # End of 10.3 tests +# switching from mysql.global_priv to mysql.user drop view mysql.user_bak; create user 'user3'@'localhost' identified with mysql_native_password as password('a_password'); show create user user3@localhost; @@ -625,11 +627,13 @@ connection default; drop user user3@localhost; drop table mysql.global_priv; rename table mysql.global_priv_bak to mysql.global_priv; +# switching from mysql.global_priv to mysql.user drop view mysql.user_bak; drop table mysql.innodb_index_stats, mysql.innodb_table_stats; # mysql_upgrade --force --silent 2>&1 drop table mysql.global_priv; rename table mysql.global_priv_bak to mysql.global_priv; +# switching from mysql.global_priv to mysql.user drop view mysql.user_bak; alter table mysql.user change authentication_string auth_string text collate utf8_bin not null; # mysql_upgrade --force --silent 2>&1 diff --git a/mysql-test/main/mysql_upgrade_noengine.result b/mysql-test/main/mysql_upgrade_noengine.result index 79ad04e1849..7b7082ab007 100644 --- a/mysql-test/main/mysql_upgrade_noengine.result +++ b/mysql-test/main/mysql_upgrade_noengine.result @@ -1,3 +1,4 @@ +# switching from mysql.global_priv to mysql.user drop view mysql.user_bak; install soname 'ha_blackhole'; install soname 'ha_archive'; @@ -144,6 +145,7 @@ Code 1286 Message Unknown storage engine 'ARCHIVE' drop table mysql.global_priv; rename table mysql.global_priv_bak to mysql.global_priv; +# switching from mysql.global_priv to mysql.user drop view mysql.user_bak; alter table mysql.user drop column default_role, drop column max_statement_time; Phase 1/7: Checking and upgrading mysql database @@ -236,6 +238,7 @@ Code 1286 Message Unknown storage engine 'ARCHIVE' drop table mysql.global_priv; rename table mysql.global_priv_bak to mysql.global_priv; +# switching from mysql.global_priv to mysql.user drop view mysql.user_bak; alter table mysql.user drop column default_role, drop column max_statement_time; Phase 1/7: Checking and upgrading mysql database diff --git a/mysql-test/main/password_expiration.result b/mysql-test/main/password_expiration.result index bb39d8788dc..d05f6b3b5d0 100644 --- a/mysql-test/main/password_expiration.result +++ b/mysql-test/main/password_expiration.result @@ -138,6 +138,7 @@ ERROR HY000: Incorrect DAY value: '0' # # Password expiration fields are loaded properly on 10.3 tables # +# switching from mysql.global_priv to mysql.user create user user1@localhost; show create user user1@localhost; CREATE USER for user1@localhost @@ -205,6 +206,7 @@ connection default; drop user user1@localhost; set global disconnect_on_expired_password=default; set global default_password_lifetime=default; +# switching back from mysql.user to mysql.global_priv # # PASSWORD EXPIRE DEFAULT should use the default_password_lifetime # system var to set the number of days till expiration diff --git a/mysql-test/main/plugin_auth.result b/mysql-test/main/plugin_auth.result index 244e048c517..73c384734bd 100644 --- a/mysql-test/main/plugin_auth.result +++ b/mysql-test/main/plugin_auth.result @@ -354,6 +354,7 @@ uplain@localhost uplain@localhost connection default; disconnect cleartext_con; DROP USER uplain@localhost; +# switching from mysql.global_priv to mysql.user drop view mysql.user_bak; # # Bug #59038 : mysql.user.authentication_string column diff --git a/mysql-test/main/set_password.result b/mysql-test/main/set_password.result index eef7c6eccea..91c8b567ad6 100644 --- a/mysql-test/main/set_password.result +++ b/mysql-test/main/set_password.result @@ -158,6 +158,7 @@ connection default; drop user natauth@localhost, newpass@localhost, newpassnat@localhost; drop user oldauth@localhost, oldpass@localhost, oldpassold@localhost; set global secure_auth=default; +# switching from mysql.global_priv to mysql.user create user foo@localhost identified with mysql_native_password; update mysql.user set authentication_string=password('foo'), plugin='mysql_native_password' where user='foo' and host='localhost'; set password for 'foo'@'localhost' = password('bar'); @@ -179,3 +180,4 @@ select user,host,password,plugin,authentication_string from mysql.user where use user host password plugin authentication_string foo localhost mysql_native_password drop user foo@localhost; +# switching back from mysql.user to mysql.global_priv diff --git a/mysql-test/main/sp_notembedded.result b/mysql-test/main/sp_notembedded.result index 3cf066f5b4c..e03361598a6 100644 --- a/mysql-test/main/sp_notembedded.result +++ b/mysql-test/main/sp_notembedded.result @@ -212,6 +212,7 @@ disconnect rl_contender; drop procedure p1; drop table t1; set session low_priority_updates=default; +# switching from mysql.global_priv to mysql.user INSERT IGNORE INTO mysql.user (Host, User, Password, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, @@ -231,6 +232,7 @@ CREATE PROCEDURE p1(i INT) BEGIN END; disconnect con1; connection default; DROP PROCEDURE p1; +# switching back from mysql.user to mysql.global_priv # # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al. # @@ -323,6 +325,7 @@ DROP EVENT teste_bug11763507; # ------------------------------------------------------------------ # -- End of 5.1 tests # ------------------------------------------------------------------ +# switching from mysql.global_priv to mysql.user grant create routine on test.* to foo1@localhost identified by 'foo'; update mysql.user set authentication_string = replace(authentication_string, '*', '-') where user='foo1'; connect foo,localhost,foo1,foo; @@ -347,4 +350,5 @@ connection default; disconnect foo; drop procedure spfoo; drop user foo1@localhost; +# switching back from mysql.user to mysql.global_priv set @@global.concurrent_insert= @old_concurrent_insert; diff --git a/mysql-test/main/system_mysql_db_507.result b/mysql-test/main/system_mysql_db_507.result index 00b53a5798d..2d68dc82529 100644 --- a/mysql-test/main/system_mysql_db_507.result +++ b/mysql-test/main/system_mysql_db_507.result @@ -3,6 +3,7 @@ # Fatal error: mysql.user table is damaged or in # unsupported 3.20 format # +# switching from mysql.global_priv to mysql.user # # Original mysql.user table # @@ -221,3 +222,4 @@ drop user user@localhost; # # Reset to final original state. # +# switching back from mysql.user to mysql.global_priv diff --git a/mysql-test/suite/plugins/r/multiauth.result b/mysql-test/suite/plugins/r/multiauth.result index 4b9a603867c..a62532e3225 100644 --- a/mysql-test/suite/plugins/r/multiauth.result +++ b/mysql-test/suite/plugins/r/multiauth.result @@ -152,8 +152,10 @@ show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA mysql_native_password USING '*BFE3F4604CFD21E6595080A261D92EF0183B5971' OR unix_socket drop user mysqltest1; +# switching from mysql.global_priv to mysql.user create user mysqltest1 identified via ed25519 as password("good") OR unix_socket OR mysql_native_password as password("works"); ERROR HY000: Column count of mysql.user is wrong. Expected 3, found 47. Created with MariaDB XX.YY.ZZ, now running XX.YY.ZZ. Please use mysql_upgrade to fix this error +# switching back from mysql.user to mysql.global_priv create user USER identified via mysql_native_password as '1234567890123456789012345678901234567890a' OR unix_socket; create user mysqltest1 identified via mysql_native_password as '1234567890123456789012345678901234567890a' OR unix_socket; update mysql.global_priv set priv=replace(priv, '1234567890123456789012345678901234567890a', 'invalid password'); diff --git a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result index 5902ae0e16c..412ddf9d423 100644 --- a/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result +++ b/mysql-test/suite/roles/create_and_drop_role_invalid_user_table.result @@ -1,3 +1,4 @@ +# switching from mysql.global_priv to mysql.user connect mysql, localhost, root,,; use mysql; alter table user drop column is_role; @@ -26,3 +27,4 @@ update user set is_role='N'; flush privileges; create role test_role; drop role test_role; +# switching back from mysql.user to mysql.global_priv