mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
9368c7bcd8
- ie. backport from 5.1 - also update testcase error dected by new version mysql-test/include/show_msg.inc: BitKeeper file /home/msvensson/mysql/same_tools/my41-same_tools/mysql-test/include/show_msg.inc mysql-test/include/show_msg80.inc: BitKeeper file /home/msvensson/mysql/same_tools/my41-same_tools/mysql-test/include/show_msg80.inc BitKeeper/deleted/.del-rpl_chain_temp_table.test: Delete: mysql-test/t/rpl_chain_temp_table.test BitKeeper/deleted/.del-rpl_chain_temp_table.result: Delete: mysql-test/r/rpl_chain_temp_table.result BitKeeper/deleted/.del-rpl_failsafe.result: Delete: mysql-test/r/rpl_failsafe.result BitKeeper/deleted/.del-rpl_failsafe.test: Delete: mysql-test/t/rpl_failsafe.test BitKeeper/deleted/.del-rpl_heap.test: Delete: mysql-test/t/rpl_heap.test BitKeeper/deleted/.del-rpl_heap.result: Delete: mysql-test/r/rpl_heap.result BitKeeper/deleted/.del-rpl000018.result: Delete: mysql-test/r/rpl000018.result BitKeeper/deleted/.del-rpl000018.test: Delete: mysql-test/t/rpl000018.test client/Makefile.am: Link mysqltest with mysys/my_copy.c client/mysqltest.c: Update mysqltest to latest version mysql-test/include/have_multi_ndb.inc: Remove old syntax "@filename" in favor of "--require filename" mysql-test/include/master-slave.inc: Remove old syntax "@filename" in favor of "--require filename" mysql-test/include/ps_query.inc: Remove the comment about no output now when it does. mysql-test/r/check.result: Update output from --send mysql-test/r/connect.result: Update result file for connect test after backport form 5.1 mysql-test/r/flush.result: Update output from --send mysql-test/r/flush_block_commit.result: Update output from --send mysql-test/r/func_misc.result: Update output from --send mysql-test/r/grant2.result: Update output from --send mysql-test/r/handler.result: Update output from --send mysql-test/r/kill.result: Update output from --send mysql-test/r/lock_multi.result: Update output from --send mysql-test/r/mix_innodb_myisam_binlog.result: Update output from --send mysql-test/r/mysqltest.result: Update mysqltest.result after backport mysql-test/r/ps_2myisam.result: Update result as the output from query is now printed mysql-test/r/ps_3innodb.result: Update result as the output from query is now printed mysql-test/r/ps_4heap.result: Update result as the output from query is now printed mysql-test/r/ps_5merge.result: Update result as the output from query is now printed mysql-test/r/ps_6bdb.result: Update result as the output from query is now printed mysql-test/r/ps_7ndb.result: Update result as the output from query is now printed mysql-test/r/rename.result: Update output from --send mysql-test/r/rpl000001.result: Update output from --send mysql-test/r/rpl_error_ignored_table.result: Update output from --send mysql-test/r/rpl_master_pos_wait.result: Update output from --send mysql-test/r/subselect.result: Update result file after adding missing ; mysql-test/r/synchronization.result: Update output from --send mysql-test/r/type_blob.result: Update result file after adding missing ; mysql-test/t/connect.test: Backport test from 5.1 mysql-test/t/init_file.test: Update test so something is printed mysql-test/t/mysql_client_test.test: Update test so result is sent to file and something is printed mysql-test/t/mysqltest.test: Backport latest mysqltest.test file mysql-test/t/ps.test: Move the --replace_column statement to just before the statetement it should replace mysql-test/t/ps_1general.test: Move the --replace_column statement to just before the statetement it should replace mysql-test/t/ps_grant.test: Remove the $DB, no other test uses it mysql-test/t/rpl_flush_tables.test: Fetch $SERVER_VERSION from the db server mysql-test/t/rpl_trunc_temp.test: Remove the selection of connection master after it's been disconnected already mysql-test/t/subselect.test: Add missing ; mysql-test/t/type_blob.test: Add missing ;
115 lines
3.5 KiB
Text
115 lines
3.5 KiB
Text
# Can't test grants with embedded server
|
|
-- source include/not_embedded.inc
|
|
|
|
let $type= 'MYISAM' ;
|
|
|
|
################ GRANT/REVOKE/DROP affecting a parallel session ################
|
|
--disable_query_log
|
|
select '------ grant/revoke/drop affects a parallel session test ------'
|
|
as test_sequence ;
|
|
--enable_query_log
|
|
|
|
#---------------------------------------------------------------------#
|
|
# Here we test that:
|
|
# 1. A new GRANT will be visible within another sessions. #
|
|
# #
|
|
# Let's assume there is a parallel session with an already prepared #
|
|
# statement for a table. #
|
|
# A DROP TABLE will affect the EXECUTE properties. #
|
|
# A REVOKE will affect the EXECUTE properties. #
|
|
#---------------------------------------------------------------------#
|
|
|
|
# Who am I ?
|
|
# this is different across different systems:
|
|
# select current_user(), user() ;
|
|
|
|
#### create a new user account ####
|
|
## There should be no grants for that non existing user
|
|
--error 1141
|
|
show grants for second_user@localhost ;
|
|
## create a new user account by using GRANT statements on t9
|
|
create database mysqltest;
|
|
# create the tables (t1 and t9) used in many tests
|
|
use mysqltest;
|
|
--disable_query_log
|
|
--source include/ps_create.inc
|
|
--source include/ps_renew.inc
|
|
--enable_query_log
|
|
use test;
|
|
grant usage on mysqltest.* to second_user@localhost
|
|
identified by 'looser' ;
|
|
grant select on mysqltest.t9 to second_user@localhost
|
|
identified by 'looser' ;
|
|
show grants for second_user@localhost ;
|
|
|
|
|
|
#### establish a second session to the new user account
|
|
connect (con3,localhost,second_user,looser,mysqltest);
|
|
## switch to the second session
|
|
connection con3;
|
|
# Who am I ?
|
|
select current_user();
|
|
## check the access rights
|
|
show grants for current_user();
|
|
prepare s_t9 from 'select c1 as my_col
|
|
from t9 where c1= 1' ;
|
|
execute s_t9 ;
|
|
# check that we cannot do a SELECT on the table t1;
|
|
--error 1142
|
|
select a as my_col from t1;
|
|
|
|
|
|
#### give access rights to t1 and drop table t9
|
|
## switch back to the first session
|
|
connection default;
|
|
grant select on mysqltest.t1 to second_user@localhost
|
|
identified by 'looser' ;
|
|
show grants for second_user@localhost ;
|
|
drop table mysqltest.t9 ;
|
|
show grants for second_user@localhost ;
|
|
|
|
|
|
#### check the access as new user
|
|
## switch to the second session
|
|
connection con3;
|
|
######## Question 1: The table t1 should be now accessible. ########
|
|
show grants for second_user@localhost ;
|
|
prepare s_t1 from 'select a as my_col from t1' ;
|
|
execute s_t1 ;
|
|
######## Question 2: The table t9 does not exist. ########
|
|
--error 1146
|
|
execute s_t9 ;
|
|
deallocate prepare s_t9;
|
|
|
|
|
|
#### revoke the access rights to t1
|
|
## switch back to the first session
|
|
connection default;
|
|
revoke all privileges on mysqltest.t1 from second_user@localhost
|
|
identified by 'looser' ;
|
|
show grants for second_user@localhost ;
|
|
|
|
#### check the access as new user
|
|
## switch to the second session
|
|
connection con3;
|
|
show grants for second_user@localhost ;
|
|
######## Question 2: The table t1 should be now not accessible. ########
|
|
--error 1142
|
|
execute s_t1 ;
|
|
|
|
## cleanup
|
|
## switch back to the first session
|
|
connection default;
|
|
## disconnect the second session
|
|
disconnect con3 ;
|
|
## remove all rights of second_user@localhost
|
|
revoke all privileges, grant option from second_user@localhost ;
|
|
show grants for second_user@localhost ;
|
|
drop user second_user@localhost ;
|
|
commit ;
|
|
--error 1141
|
|
show grants for second_user@localhost ;
|
|
|
|
drop database mysqltest;
|
|
|
|
# End of 4.1 tests
|