⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sp-security.test

📁 这是linux下运行的mysql软件包,可用于linux 下安装 php + mysql + apach 的网络配置
💻 TEST
📖 第 1 页 / 共 2 页
字号:
drop procedure bug7291_1;drop procedure bug7291_2;drop procedure bug7291_0;disconnect user1;REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;drop user user1@localhost;## Bug #12318: Wrong error message when accessing an inaccessible stored# procedure in another database when the current database is# information_schema.# --disable_warningsdrop database if exists mysqltest_1;--enable_warningscreate database mysqltest_1;delimiter //;create procedure mysqltest_1.p1()begin   select 1 from dual;end//delimiter ;//grant usage on *.* to mysqltest_1@localhost;connect (n1,localhost,mysqltest_1,,information_schema,$MASTER_MYPORT,$MASTER_MYSOCK);connection n1;--error 1370call mysqltest_1.p1();disconnect n1;# Test also without a current databaseconnect (n2,localhost,mysqltest_1,,*NO-ONE*,$MASTER_MYPORT,$MASTER_MYSOCK);connection n2;--error 1370call mysqltest_1.p1();disconnect n2;connection default;drop procedure mysqltest_1.p1;drop database mysqltest_1;revoke usage on *.* from mysqltest_1@localhost;drop user mysqltest_1@localhost;## BUG#12812 create view calling a function works without execute right#           on functiondelimiter |;--disable_warningsdrop function if exists bug12812|--enable_warningscreate function bug12812() returns char(2)begin  return 'ok';end;create user user_bug12812@localhost IDENTIFIED BY 'ABC'|--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCKconnect (test_user_12812,localhost,user_bug12812,ABC,test)|--error 1370SELECT test.bug12812()|--error 1370CREATE VIEW v1 AS SELECT test.bug12812()|# Cleanupconnection default|disconnect test_user_12812|DROP USER user_bug12812@localhost|drop function bug12812|delimiter ;|## BUG#14834: Server denies to execute Stored Procedure## The problem here was with '_' in the database name.#create database db_bug14834;create user user1_bug14834@localhost identified by '';# The exact name of the database (no wildcard)grant all on `db\_bug14834`.* to user1_bug14834@localhost;create user user2_bug14834@localhost identified by '';# The exact name of the database (no wildcard)grant all on `db\_bug14834`.* to user2_bug14834@localhost;create user user3_bug14834@localhost identified by '';# Wildcards in the database namegrant all on `db__ug14834`.* to user3_bug14834@localhost;connect (user1_bug14834,localhost,user1_bug14834,,db_bug14834);# Create the procedure and check that we can call itcreate procedure p_bug14834() select user(), current_user();call p_bug14834();connect (user2_bug14834,localhost,user2_bug14834,,db_bug14834);# This didn't work beforecall p_bug14834();connect (user3_bug14834,localhost,user3_bug14834,,db_bug14834);# Should also workcall p_bug14834();# Cleanupconnection default;disconnect user1_bug14834;disconnect user2_bug14834;disconnect user3_bug14834;drop user user1_bug14834@localhost;drop user user2_bug14834@localhost;drop user user3_bug14834@localhost;drop database db_bug14834;## BUG#14533: 'desc tbl' in stored procedure causes error 1142#create database db_bug14533;use db_bug14533;create table t1 (id int);create user user_bug14533@localhost identified by '';create procedure bug14533_1()    sql security definer  desc db_bug14533.t1;create procedure bug14533_2()    sql security definer   select * from db_bug14533.t1;grant execute on procedure db_bug14533.bug14533_1 to user_bug14533@localhost;grant execute on procedure db_bug14533.bug14533_2 to user_bug14533@localhost;connect (user_bug14533,localhost,user_bug14533,,test);# These should workcall db_bug14533.bug14533_1();call db_bug14533.bug14533_2();# For reference, these should not work--error ER_TABLEACCESS_DENIED_ERRORdesc db_bug14533.t1;--error ER_TABLEACCESS_DENIED_ERRORselect * from db_bug14533.t1;# Cleanupconnection default;disconnect user_bug14533;drop user user_bug14533@localhost;drop database db_bug14533;## BUG#7787: Stored procedures: improper warning for "grant execute" statement## Prepare.CREATE DATABASE db_bug7787;use db_bug7787;# Test.CREATE PROCEDURE p1()  SHOW INNODB STATUS; GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost; # Cleanup.DROP DATABASE db_bug7787;use test;## WL#2897: Complete definer support in the stored routines.## The following cases are tested:#   1. check that if DEFINER-clause is not explicitly specified, stored routines#     are created with CURRENT_USER privileges;#   2. check that if DEFINER-clause specifies non-current user, SUPER privilege#     is required to create a stored routine;#   3. check that if DEFINER-clause specifies non-existent user, a warning is#     emitted.#   4. check that SHOW CREATE PROCEDURE | FUNCTION works correctly;## The following cases are tested in other test suites:#   - check that mysqldump dumps new attribute correctly;#   - check that slave replicates CREATE-statements with explicitly specified#     DEFINER correctly.## Setup the environment.--echo--echo ---> connection: root--connection con1root--disable_warningsDROP DATABASE IF EXISTS mysqltest;--enable_warningsCREATE DATABASE mysqltest;CREATE USER mysqltest_1@localhost;GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_1@localhost;CREATE USER mysqltest_2@localhost;GRANT SUPER ON *.* TO mysqltest_2@localhost;GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;--connect (mysqltest_2_con,localhost,mysqltest_2,,mysqltest)--connect (mysqltest_1_con,localhost,mysqltest_1,,mysqltest)# test case (1).--echo--echo ---> connection: mysqltest_2_con--connection mysqltest_2_conuse mysqltest;CREATE PROCEDURE wl2897_p1() SELECT 1;CREATE FUNCTION wl2897_f1() RETURNS INT RETURN 1;# test case (2).--echo--echo ---> connection: mysqltest_1_con--connection mysqltest_1_conuse mysqltest;--error ER_SPECIFIC_ACCESS_DENIED_ERRORCREATE DEFINER=root@localhost PROCEDURE wl2897_p2() SELECT 2;--error ER_SPECIFIC_ACCESS_DENIED_ERRORCREATE DEFINER=root@localhost FUNCTION wl2897_f2() RETURNS INT RETURN 2;# test case (3).--echo--echo ---> connection: mysqltest_2_con--connection mysqltest_2_conuse mysqltest;CREATE DEFINER='a @ b @ c'@localhost PROCEDURE wl2897_p3() SELECT 3;CREATE DEFINER='a @ b @ c'@localhost FUNCTION wl2897_f3() RETURNS INT RETURN 3;# test case (4).--echo--echo ---> connection: con1root--connection con1rootuse mysqltest;SHOW CREATE PROCEDURE wl2897_p1;SHOW CREATE PROCEDURE wl2897_p3;SHOW CREATE FUNCTION wl2897_f1;SHOW CREATE FUNCTION wl2897_f3;# Cleanup.DROP USER mysqltest_1@localhost;DROP USER mysqltest_2@localhost;DROP DATABASE mysqltest;--disconnect mysqltest_1_con--disconnect mysqltest_2_con## BUG#13198: SP executes if definer does not exist## Prepare environment.--echo--echo ---> connection: root--connection con1root--disable_warningsDROP DATABASE IF EXISTS mysqltest;--enable_warningsCREATE DATABASE mysqltest;CREATE USER mysqltest_1@localhost;GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_1@localhost;CREATE USER mysqltest_2@localhost;GRANT ALL PRIVILEGES ON mysqltest.* TO mysqltest_2@localhost;--connect (mysqltest_1_con,localhost,mysqltest_1,,mysqltest)--connect (mysqltest_2_con,localhost,mysqltest_2,,mysqltest)# Create a procedure/function under u1.--echo--echo ---> connection: mysqltest_1_con--connection mysqltest_1_conuse mysqltest;CREATE PROCEDURE bug13198_p1()  SELECT 1;CREATE FUNCTION bug13198_f1() RETURNS INT  RETURN 1;CALL bug13198_p1();SELECT bug13198_f1();# Check that u2 can call the procedure/function.--echo--echo ---> connection: mysqltest_2_con--connection mysqltest_2_conuse mysqltest;CALL bug13198_p1();SELECT bug13198_f1();# Drop user u1 (definer of the object);--echo--echo ---> connection: root--connection con1root--disconnect mysqltest_1_conDROP USER mysqltest_1@localhost;# Check that u2 can not call the procedure/function.--echo--echo ---> connection: mysqltest_2_con--connection mysqltest_2_conuse mysqltest;--error ER_NO_SUCH_USERCALL bug13198_p1();--error ER_NO_SUCH_USERSELECT bug13198_f1();# Cleanup.--echo--echo ---> connection: root--connection con1root--disconnect mysqltest_2_conDROP USER mysqltest_2@localhost;DROP DATABASE mysqltest;# End of 5.0 bugs.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -