Commit a3126bfc authored by unknown's avatar unknown

Bug#33275 Server crash when creating temporary table mysql.user

When creating a temporary table that uses the same name as the mysql
privs table the server would crash on FLUSH PRIVILEGES.

This patches corrects the problem by setting a flag to ignore any
temporary table when trying to reload the privileges.


mysql-test/r/grant.result:
  Test for checking shadowing of privilege tables
mysql-test/t/grant.test:
  Test for checking shadowing of privilege tables
sql/sql_acl.cc:
  Set flag for ignoring temporary tables when trying to reload privileges.
parent 0769fe55
...@@ -1129,4 +1129,10 @@ DROP USER mysqltest_1@localhost; ...@@ -1129,4 +1129,10 @@ DROP USER mysqltest_1@localhost;
DROP DATABASE db27878; DROP DATABASE db27878;
use test; use test;
DROP TABLE t1; DROP TABLE t1;
#
# Bug#33275 Server crash when creating temporary table mysql.user
#
CREATE TEMPORARY TABLE mysql.user (id INT);
FLUSH PRIVILEGES;
DROP TABLE mysql.user;
End of 5.0 tests End of 5.0 tests
...@@ -1153,4 +1153,11 @@ DROP DATABASE db27878; ...@@ -1153,4 +1153,11 @@ DROP DATABASE db27878;
use test; use test;
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # Bug#33275 Server crash when creating temporary table mysql.user
--echo #
CREATE TEMPORARY TABLE mysql.user (id INT);
FLUSH PRIVILEGES;
DROP TABLE mysql.user;
--echo End of 5.0 tests --echo End of 5.0 tests
...@@ -558,6 +558,8 @@ my_bool acl_reload(THD *thd) ...@@ -558,6 +558,8 @@ my_bool acl_reload(THD *thd)
tables[0].next_local= tables[0].next_global= tables+1; tables[0].next_local= tables[0].next_global= tables+1;
tables[1].next_local= tables[1].next_global= tables+2; tables[1].next_local= tables[1].next_global= tables+2;
tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_READ; tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_READ;
tables[0].skip_temporary= tables[1].skip_temporary=
tables[2].skip_temporary= TRUE;
if (simple_open_n_lock_tables(thd, tables)) if (simple_open_n_lock_tables(thd, tables))
{ {
...@@ -3528,7 +3530,8 @@ my_bool grant_reload(THD *thd) ...@@ -3528,7 +3530,8 @@ my_bool grant_reload(THD *thd)
tables[0].next_local= tables[0].next_global= tables+1; tables[0].next_local= tables[0].next_global= tables+1;
tables[1].next_local= tables[1].next_global= tables+2; tables[1].next_local= tables[1].next_global= tables+2;
tables[0].lock_type= tables[1].lock_type= tables[2].lock_type= TL_READ; tables[0].lock_type= tables[1].lock_type= tables[2].lock_type= TL_READ;
tables[0].skip_temporary= tables[1].skip_temporary=
tables[2].skip_temporary= TRUE;
/* /*
To avoid deadlocks we should obtain table locks before To avoid deadlocks we should obtain table locks before
obtaining LOCK_grant rwlock. obtaining LOCK_grant rwlock.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment