1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fixes for mysql-test failures

mysql-test/r/acl_roles_show_grants.result:
  one can do SHOW GRANTS for himself
mysql-test/t/acl_roles_set_role-table-column-priv.test:
  correct error message
mysql-test/t/acl_roles_show_grants.test:
  one can SHOW GRANTS for himself
sql/sql_acl.cc:
  bugfixing:
  * don't assign with && - it can shortcut and the second assignment won't be executed
  * correct the test in check_grant_all_columns() - want_access should not be modified
  *
sql/sql_cmd.h.OTHER:
  add new commands at the end
sql/sql_db.cc:
  don't call acl_get() if all privileges are already satisfied
  (crashes when run with --skip-grants, because acl data stuctures aren't initialized)
sql/sql_parse.cc:
  * test for current_user in get_current_user()
  * map explicitly specified user@host to current_user
This commit is contained in:
Sergei Golubchik
2013-10-18 08:10:51 -07:00
parent 8122996a59
commit 72d8b533cc
28 changed files with 145 additions and 50 deletions

View File

@ -161,6 +161,9 @@ def mysql proxies_priv Proxied_user 4 NO char 16 48 NULL NULL NULL utf8 utf8_bi
def mysql proxies_priv Timestamp 7 CURRENT_TIMESTAMP NO timestamp NULL NULL NULL NULL 0 NULL NULL timestamp on update CURRENT_TIMESTAMP select,insert,update,references
def mysql proxies_priv User 2 NO char 16 48 NULL NULL NULL utf8 utf8_bin char(16) PRI select,insert,update,references
def mysql proxies_priv With_grant 5 0 NO tinyint NULL NULL 3 0 NULL NULL NULL tinyint(1) select,insert,update,references
def mysql roles_mapping HostFk 1 NO char 60 60 NULL NULL NULL latin1 latin1_bin char(60) select,insert,update,references
def mysql roles_mapping RoleFk 3 NO char 16 16 NULL NULL NULL latin1 latin1_bin char(16) select,insert,update,references
def mysql roles_mapping UserFk 2 NO char 16 16 NULL NULL NULL latin1 latin1_bin char(16) select,insert,update,references
def mysql servers Db 3 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references
def mysql servers Host 2 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references
def mysql servers Owner 9 NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references
@ -224,6 +227,7 @@ def mysql user Grant_priv 14 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci e
def mysql user Host 1 NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references
def mysql user Index_priv 16 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql user Insert_priv 5 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql user is_role 43 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql user Lock_tables_priv 21 N NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references
def mysql user max_connections 39 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned select,insert,update,references
def mysql user max_questions 37 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned select,insert,update,references
@ -480,6 +484,9 @@ NULL mysql procs_priv Timestamp timestamp NULL NULL NULL NULL timestamp
NULL mysql proxies_priv With_grant tinyint NULL NULL NULL NULL tinyint(1)
3.0000 mysql proxies_priv Grantor char 77 231 utf8 utf8_bin char(77)
NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp
1.0000 mysql roles_mapping HostFk char 60 60 latin1 latin1_bin char(60)
1.0000 mysql roles_mapping UserFk char 16 16 latin1 latin1_bin char(16)
1.0000 mysql roles_mapping RoleFk char 16 16 latin1 latin1_bin char(16)
3.0000 mysql servers Server_name char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Host char 64 192 utf8 utf8_general_ci char(64)
3.0000 mysql servers Db char 64 192 utf8 utf8_general_ci char(64)
@ -567,3 +574,4 @@ NULL mysql user max_connections int NULL NULL NULL NULL int(11) unsigned
NULL mysql user max_user_connections int NULL NULL NULL NULL int(11)
1.0000 mysql user plugin char 64 64 latin1 latin1_swedish_ci char(64)
1.0000 mysql user authentication_string text 65535 65535 utf8 utf8_bin text
3.0000 mysql user is_role enum 1 3 utf8 utf8_general_ci enum('N','Y')

View File

@ -428,6 +428,29 @@ user_comment User proxy privileges
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME roles_mapping
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA
VERSION 10
ROW_FORMAT Fixed
TABLE_ROWS #TBLR#
AVG_ROW_LENGTH #ARL#
DATA_LENGTH #DL#
MAX_DATA_LENGTH #MDL#
INDEX_LENGTH #IL#
DATA_FREE #DF#
AUTO_INCREMENT NULL
CREATE_TIME #CRT#
UPDATE_TIME #UT#
CHECK_TIME #CT#
TABLE_COLLATION latin1_swedish_ci
CHECKSUM NULL
CREATE_OPTIONS #CO#
TABLE_COMMENT #TC#
user_comment
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
TABLE_NAME servers
TABLE_TYPE BASE TABLE
ENGINE MYISAM_OR_MARIA

View File

@ -129,6 +129,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser2
Password
@ -171,6 +172,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser3
Password
@ -213,6 +215,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
#
# Add GRANT OPTION db_datadict.* to testuser1;
GRANT UPDATE ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
@ -279,6 +282,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser2
Password
@ -321,6 +325,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser3
Password
@ -363,6 +368,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
# Establish connection testuser1 (user=testuser1)
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
@ -415,6 +421,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser2
Password
@ -457,6 +464,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser3
Password
@ -499,6 +507,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
SHOW GRANTS;
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
@ -573,6 +582,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser2
Password
@ -615,6 +625,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser3
Password
@ -657,6 +668,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION;
#
# Here <SELECT YES> is shown correctly for testuser1;
@ -723,6 +735,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser2
Password
@ -765,6 +778,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser3
Password
@ -807,6 +821,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
# Switch to connection testuser1
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
@ -859,6 +874,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser2
Password
@ -901,6 +917,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser3
Password
@ -943,6 +960,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
SHOW GRANTS;
Grants for testuser1@localhost
GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION
@ -1047,6 +1065,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser2
Password
@ -1089,6 +1108,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser3
Password
@ -1131,6 +1151,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
# Switch to connection testuser1
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
@ -1230,6 +1251,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser2
Password
@ -1272,6 +1294,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser3
Password
@ -1314,6 +1337,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
# Switch to connection testuser1
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''
@ -1366,6 +1390,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser2
Password
@ -1408,6 +1433,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser3
Password
@ -1450,6 +1476,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
SHOW GRANTS;
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
@ -1509,6 +1536,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser2
Password
@ -1551,6 +1579,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser3
Password
@ -1593,6 +1622,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
SHOW GRANTS;
Grants for testuser1@localhost
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
@ -1667,6 +1697,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser2
Password
@ -1709,6 +1740,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
Host localhost
User testuser3
Password
@ -1751,6 +1783,7 @@ max_connections 0
max_user_connections 0
plugin
authentication_string
is_role N
# Switch to connection testuser1
SELECT * FROM information_schema.user_privileges
WHERE grantee LIKE '''testuser%'''