Commit 242e7f95 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-4549 [PATCH] Clean up code working with ACL tables

* enum values to index different ACL tables, instead of hard-coded numbers
  (even different in diffent functions).
* move TABLE_LIST initialization into open_grant_tables()
  and use it everywhere
* change few my_bool's to bool's
parent f321d3e5
call mtr.add_suppression("Can't open and lock privilege tables: Table 'host' was not locked with LOCK TABLES"); call mtr.add_suppression("Can't open and lock privilege tables: Table 'user' was not locked with LOCK TABLES");
SHOW VARIABLES like 'slave_skip_errors'; SHOW VARIABLES like 'slave_skip_errors';
Variable_name Value Variable_name Value
slave_skip_errors OFF slave_skip_errors OFF
...@@ -16,7 +16,7 @@ DROP TABLE IF EXISTS t1; ...@@ -16,7 +16,7 @@ DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (c1 INT); CREATE TABLE t1 (c1 INT);
LOCK TABLES t1 READ; LOCK TABLES t1 READ;
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
ERROR HY000: Table 'host' was not locked with LOCK TABLES ERROR HY000: Table 'user' was not locked with LOCK TABLES
UNLOCK TABLES; UNLOCK TABLES;
DROP TABLE t1; DROP TABLE t1;
# #
......
...@@ -128,11 +128,8 @@ CREATE FUNCTION f1() RETURNS INT RETURN 1; ...@@ -128,11 +128,8 @@ CREATE FUNCTION f1() RETURNS INT RETURN 1;
RENAME TABLE mysql.procs_priv TO procs_priv_backup; RENAME TABLE mysql.procs_priv TO procs_priv_backup;
FLUSH TABLE mysql.procs_priv; FLUSH TABLE mysql.procs_priv;
DROP FUNCTION f1; DROP FUNCTION f1;
ERROR 42S02: Table 'mysql.procs_priv' doesn't exist
SHOW WARNINGS; SHOW WARNINGS;
Level Code Message Level Code Message
Error 1146 Table 'mysql.procs_priv' doesn't exist
Warning 1405 Failed to revoke all privileges to dropped routine
# Restore the procs_priv table # Restore the procs_priv table
RENAME TABLE procs_priv_backup TO mysql.procs_priv; RENAME TABLE procs_priv_backup TO mysql.procs_priv;
FLUSH TABLE mysql.procs_priv; FLUSH TABLE mysql.procs_priv;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
# End of 4.1 tests # End of 4.1 tests
call mtr.add_suppression("Can't open and lock privilege tables: Table 'host' was not locked with LOCK TABLES"); call mtr.add_suppression("Can't open and lock privilege tables: Table 'user' was not locked with LOCK TABLES");
# #
# Bug#43835: SHOW VARIABLES does not include 0 for slave_skip_errors # Bug#43835: SHOW VARIABLES does not include 0 for slave_skip_errors
......
...@@ -214,7 +214,6 @@ RENAME TABLE mysql.procs_priv TO procs_priv_backup; ...@@ -214,7 +214,6 @@ RENAME TABLE mysql.procs_priv TO procs_priv_backup;
FLUSH TABLE mysql.procs_priv; FLUSH TABLE mysql.procs_priv;
# DROP FUNCTION used to cause an assert. # DROP FUNCTION used to cause an assert.
--error ER_NO_SUCH_TABLE
DROP FUNCTION f1; DROP FUNCTION f1;
SHOW WARNINGS; SHOW WARNINGS;
......
This diff is collapsed.
...@@ -197,8 +197,8 @@ static inline int access_denied_error_code(int passwd_used) ...@@ -197,8 +197,8 @@ static inline int access_denied_error_code(int passwd_used)
/* prototypes */ /* prototypes */
bool hostname_requires_resolving(const char *hostname); bool hostname_requires_resolving(const char *hostname);
my_bool acl_init(bool dont_read_acl_tables); bool acl_init(bool dont_read_acl_tables);
my_bool acl_reload(THD *thd); bool acl_reload(THD *thd);
void acl_free(bool end=0); void acl_free(bool end=0);
ulong acl_get(const char *host, const char *ip, ulong acl_get(const char *host, const char *ip,
const char *user, const char *db, my_bool db_is_pattern); const char *user, const char *db, my_bool db_is_pattern);
...@@ -220,9 +220,9 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list, ...@@ -220,9 +220,9 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list,
bool mysql_routine_grant(THD *thd, TABLE_LIST *table, bool is_proc, bool mysql_routine_grant(THD *thd, TABLE_LIST *table, bool is_proc,
List <LEX_USER> &user_list, ulong rights, List <LEX_USER> &user_list, ulong rights,
bool revoke, bool write_to_binlog); bool revoke, bool write_to_binlog);
my_bool grant_init(); bool grant_init();
void grant_free(void); void grant_free(void);
my_bool grant_reload(THD *thd); bool grant_reload(THD *thd);
bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables, bool check_grant(THD *thd, ulong want_access, TABLE_LIST *tables,
bool any_combination_will_do, uint number, bool no_errors); bool any_combination_will_do, uint number, bool no_errors);
bool check_grant_column (THD *thd, GRANT_INFO *grant, bool check_grant_column (THD *thd, GRANT_INFO *grant,
......
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