Loading mysql-test/r/information_schema.result +23 −1 Original line number Diff line number Diff line Loading @@ -594,7 +594,7 @@ TABLE_CONSTRAINTS TABLE_PRIVILEGES TRIGGERS create database information_schema; ERROR HY000: Can't create database 'information_schema'; database exists ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' use information_schema; show full tables like "T%"; Tables_in_information_schema (T%) Table_type Loading Loading @@ -990,3 +990,25 @@ Field Type Null Key Default Extra c int(11) YES NULL drop view v1; drop table t1; alter database information_schema; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' drop database information_schema; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' drop table information_schema.tables; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' alter table information_schema.tables; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' use information_schema; create temporary table schemata(f1 char(10)); ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' CREATE PROCEDURE p1 () BEGIN SELECT 'foo' FROM DUAL; END | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' select ROUTINE_NAME from routines; ROUTINE_NAME grant all on information_schema.* to 'user1'@'localhost'; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' grant select on information_schema.* to 'user1'@'localhost'; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' mysql-test/t/information_schema.test +37 −1 Original line number Diff line number Diff line Loading @@ -338,7 +338,7 @@ from information_schema.tables where table_schema='information_schema' limit 2; show tables from information_schema like "T%"; --error 1007 --error 1044 create database information_schema; use information_schema; show full tables like "T%"; Loading Loading @@ -678,3 +678,39 @@ show fields from test.v1; connection default; drop view v1; drop table t1; # # Bug #9846 Inappropriate error displayed while dropping table from 'INFORMATION_SCHEMA' # --error 1044 alter database information_schema; --error 1044 drop database information_schema; --error 1044 drop table information_schema.tables; --error 1044 alter table information_schema.tables; # # Bug #9683 INFORMATION_SCH: Creation of temporary table allowed in Information_schema DB # use information_schema; --error 1044 create temporary table schemata(f1 char(10)); # # Bug #10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA # delimiter |; --error 1044 CREATE PROCEDURE p1 () BEGIN SELECT 'foo' FROM DUAL; END | delimiter ;| select ROUTINE_NAME from routines; # # Bug #10734 Grant of privileges other than 'select' and 'create view' should fail on schema # --error 1044 grant all on information_schema.* to 'user1'@'localhost'; --error 1044 grant select on information_schema.* to 'user1'@'localhost'; sql/mysql_priv.h +3 −1 Original line number Diff line number Diff line Loading @@ -621,7 +621,7 @@ void close_connection(THD *thd, uint errcode, bool lock); bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, bool *write_to_binlog); bool check_access(THD *thd, ulong access, const char *db, ulong *save_priv, bool no_grant, bool no_errors); bool no_grant, bool no_errors, bool schema_db); bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables, bool no_errors); bool check_global_access(THD *thd, ulong want_access); Loading Loading @@ -848,6 +848,8 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond); int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond); int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond); bool get_schema_tables_result(JOIN *join); #define is_schema_db(X) \ !my_strcasecmp(system_charset_info, information_schema_name.str, (X)) /* sql_prepare.cc */ Loading sql/repl_failsafe.cc +1 −1 Original line number Diff line number Diff line Loading @@ -162,7 +162,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length) SLAVE_INFO *si; uchar *p= packet, *p_end= packet + packet_length; if (check_access(thd, REPL_SLAVE_ACL, any_db,0,0,0)) if (check_access(thd, REPL_SLAVE_ACL, any_db,0,0,0,0)) return 1; if (!(si = (SLAVE_INFO*)my_malloc(sizeof(SLAVE_INFO), MYF(MY_WME)))) goto err2; Loading sql/sql_acl.cc +5 −5 Original line number Diff line number Diff line Loading @@ -1337,7 +1337,7 @@ bool check_change_password(THD *thd, const char *host, const char *user, (strcmp(thd->user,user) || my_strcasecmp(system_charset_info, host, thd->priv_host))) { if (check_access(thd, UPDATE_ACL, "mysql",0,1,0)) if (check_access(thd, UPDATE_ACL, "mysql",0,1,0,0)) return(1); } if (!thd->slave_thread && !thd->user[0]) Loading Loading @@ -5533,7 +5533,7 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond) ulong want_access; char buff[100]; TABLE *table= tables->table; bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1); bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1,0); char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%"; DBUG_ENTER("fill_schema_user_privileges"); Loading Loading @@ -5586,7 +5586,7 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond) ulong want_access; char buff[100]; TABLE *table= tables->table; bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1); bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1,0); char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%"; DBUG_ENTER("fill_schema_schema_privileges"); Loading Loading @@ -5641,7 +5641,7 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond) uint index; char buff[100]; TABLE *table= tables->table; bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1); bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1,0); char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%"; DBUG_ENTER("fill_schema_table_privileges"); Loading Loading @@ -5703,7 +5703,7 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond) uint index; char buff[100]; TABLE *table= tables->table; bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1); bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1,0); char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%"; DBUG_ENTER("fill_schema_table_privileges"); Loading Loading
mysql-test/r/information_schema.result +23 −1 Original line number Diff line number Diff line Loading @@ -594,7 +594,7 @@ TABLE_CONSTRAINTS TABLE_PRIVILEGES TRIGGERS create database information_schema; ERROR HY000: Can't create database 'information_schema'; database exists ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' use information_schema; show full tables like "T%"; Tables_in_information_schema (T%) Table_type Loading Loading @@ -990,3 +990,25 @@ Field Type Null Key Default Extra c int(11) YES NULL drop view v1; drop table t1; alter database information_schema; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' drop database information_schema; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' drop table information_schema.tables; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' alter table information_schema.tables; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' use information_schema; create temporary table schemata(f1 char(10)); ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' CREATE PROCEDURE p1 () BEGIN SELECT 'foo' FROM DUAL; END | ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' select ROUTINE_NAME from routines; ROUTINE_NAME grant all on information_schema.* to 'user1'@'localhost'; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema' grant select on information_schema.* to 'user1'@'localhost'; ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
mysql-test/t/information_schema.test +37 −1 Original line number Diff line number Diff line Loading @@ -338,7 +338,7 @@ from information_schema.tables where table_schema='information_schema' limit 2; show tables from information_schema like "T%"; --error 1007 --error 1044 create database information_schema; use information_schema; show full tables like "T%"; Loading Loading @@ -678,3 +678,39 @@ show fields from test.v1; connection default; drop view v1; drop table t1; # # Bug #9846 Inappropriate error displayed while dropping table from 'INFORMATION_SCHEMA' # --error 1044 alter database information_schema; --error 1044 drop database information_schema; --error 1044 drop table information_schema.tables; --error 1044 alter table information_schema.tables; # # Bug #9683 INFORMATION_SCH: Creation of temporary table allowed in Information_schema DB # use information_schema; --error 1044 create temporary table schemata(f1 char(10)); # # Bug #10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA # delimiter |; --error 1044 CREATE PROCEDURE p1 () BEGIN SELECT 'foo' FROM DUAL; END | delimiter ;| select ROUTINE_NAME from routines; # # Bug #10734 Grant of privileges other than 'select' and 'create view' should fail on schema # --error 1044 grant all on information_schema.* to 'user1'@'localhost'; --error 1044 grant select on information_schema.* to 'user1'@'localhost';
sql/mysql_priv.h +3 −1 Original line number Diff line number Diff line Loading @@ -621,7 +621,7 @@ void close_connection(THD *thd, uint errcode, bool lock); bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables, bool *write_to_binlog); bool check_access(THD *thd, ulong access, const char *db, ulong *save_priv, bool no_grant, bool no_errors); bool no_grant, bool no_errors, bool schema_db); bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables, bool no_errors); bool check_global_access(THD *thd, ulong want_access); Loading Loading @@ -848,6 +848,8 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond); int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond); int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond); bool get_schema_tables_result(JOIN *join); #define is_schema_db(X) \ !my_strcasecmp(system_charset_info, information_schema_name.str, (X)) /* sql_prepare.cc */ Loading
sql/repl_failsafe.cc +1 −1 Original line number Diff line number Diff line Loading @@ -162,7 +162,7 @@ int register_slave(THD* thd, uchar* packet, uint packet_length) SLAVE_INFO *si; uchar *p= packet, *p_end= packet + packet_length; if (check_access(thd, REPL_SLAVE_ACL, any_db,0,0,0)) if (check_access(thd, REPL_SLAVE_ACL, any_db,0,0,0,0)) return 1; if (!(si = (SLAVE_INFO*)my_malloc(sizeof(SLAVE_INFO), MYF(MY_WME)))) goto err2; Loading
sql/sql_acl.cc +5 −5 Original line number Diff line number Diff line Loading @@ -1337,7 +1337,7 @@ bool check_change_password(THD *thd, const char *host, const char *user, (strcmp(thd->user,user) || my_strcasecmp(system_charset_info, host, thd->priv_host))) { if (check_access(thd, UPDATE_ACL, "mysql",0,1,0)) if (check_access(thd, UPDATE_ACL, "mysql",0,1,0,0)) return(1); } if (!thd->slave_thread && !thd->user[0]) Loading Loading @@ -5533,7 +5533,7 @@ int fill_schema_user_privileges(THD *thd, TABLE_LIST *tables, COND *cond) ulong want_access; char buff[100]; TABLE *table= tables->table; bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1); bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1,0); char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%"; DBUG_ENTER("fill_schema_user_privileges"); Loading Loading @@ -5586,7 +5586,7 @@ int fill_schema_schema_privileges(THD *thd, TABLE_LIST *tables, COND *cond) ulong want_access; char buff[100]; TABLE *table= tables->table; bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1); bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1,0); char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%"; DBUG_ENTER("fill_schema_schema_privileges"); Loading Loading @@ -5641,7 +5641,7 @@ int fill_schema_table_privileges(THD *thd, TABLE_LIST *tables, COND *cond) uint index; char buff[100]; TABLE *table= tables->table; bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1); bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1,0); char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%"; DBUG_ENTER("fill_schema_table_privileges"); Loading Loading @@ -5703,7 +5703,7 @@ int fill_schema_column_privileges(THD *thd, TABLE_LIST *tables, COND *cond) uint index; char buff[100]; TABLE *table= tables->table; bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1); bool no_global_access= check_access(thd, SELECT_ACL, "mysql",0,1,1,0); char *curr_host= thd->priv_host ? thd->priv_host : (char *) "%"; DBUG_ENTER("fill_schema_table_privileges"); Loading