mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
MDEV-21704 Add a new JSON field "version_id" into mysql.global_priv.priv
This commit is contained in:
109
mysql-test/main/system_mysql_db_error_log.test
Normal file
109
mysql-test/main/system_mysql_db_error_log.test
Normal file
@ -0,0 +1,109 @@
|
||||
--source include/not_embedded.inc
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-21704 Add a new JSON field "version_id" into mysql.global_priv.priv
|
||||
--echo #
|
||||
|
||||
SET @super_acl_100500= 1 << 15;
|
||||
SELECT HEX(@super_acl_100500);
|
||||
|
||||
SET @all_known_privileges_100500= (1 << 30) - 1;
|
||||
SELECT HEX(@all_known_privileges_100500);
|
||||
|
||||
SET @all_known_privileges_current= (1 << 30) - 1;
|
||||
SELECT HEX(@all_known_privileges_current);
|
||||
|
||||
CREATE USER bad_access1@localhost;
|
||||
UPDATE
|
||||
mysql.global_priv
|
||||
SET
|
||||
Priv=json_set(Priv, '$.access',@all_known_privileges_current+1)
|
||||
WHERE
|
||||
host='localhost' and user='bad_access1';
|
||||
FLUSH PRIVILEGES;
|
||||
SHOW GRANTS FOR bad_access1@localhost;
|
||||
DROP USER bad_access1@localhost;
|
||||
|
||||
|
||||
CREATE USER bad_version_id_1000000@localhost;
|
||||
GRANT ALL PRIVILEGES ON *.* to bad_version_id_1000000@localhost;
|
||||
SHOW GRANTS FOR bad_version_id_1000000@localhost;
|
||||
UPDATE
|
||||
mysql.global_priv
|
||||
SET
|
||||
Priv=json_set(Priv, '$.version_id',1000000)
|
||||
WHERE
|
||||
host='localhost' and user='bad_version_id_1000000';
|
||||
FLUSH PRIVILEGES;
|
||||
SHOW GRANTS FOR bad_version_id_1000000@localhost;
|
||||
DROP USER bad_version_id_1000000@localhost;
|
||||
|
||||
|
||||
CREATE USER bad_version_id_minus_3@localhost;
|
||||
GRANT ALL PRIVILEGES ON *.* to bad_version_id_minus_3@localhost;
|
||||
SHOW GRANTS FOR bad_version_id_minus_3@localhost;
|
||||
UPDATE
|
||||
mysql.global_priv
|
||||
SET
|
||||
Priv=json_set(Priv, '$.version_id',-3)
|
||||
WHERE
|
||||
host='localhost' and user='bad_version_id_minus_3';
|
||||
FLUSH PRIVILEGES;
|
||||
SHOW GRANTS FOR bad_version_id_minus_3@localhost;
|
||||
DROP USER bad_version_id_minus_3@localhost;
|
||||
|
||||
CREATE USER bad_version_id_100300@localhost;
|
||||
GRANT ALL PRIVILEGES ON *.* to bad_version_id_100300@localhost;
|
||||
SHOW GRANTS FOR bad_version_id_100300@localhost;
|
||||
UPDATE
|
||||
mysql.global_priv
|
||||
SET
|
||||
Priv=json_set(Priv, '$.version_id',100300)
|
||||
WHERE
|
||||
host='localhost' and user='bad_version_id_100300';
|
||||
FLUSH PRIVILEGES;
|
||||
SHOW GRANTS FOR bad_version_id_100300@localhost;
|
||||
DROP USER bad_version_id_100300@localhost;
|
||||
|
||||
|
||||
CREATE USER good_version_id_100400@localhost;
|
||||
GRANT ALL PRIVILEGES ON *.* to good_version_id_100400@localhost;
|
||||
SHOW GRANTS FOR good_version_id_100400@localhost;
|
||||
UPDATE
|
||||
mysql.global_priv
|
||||
SET
|
||||
Priv=json_set(Priv, '$.version_id',100400, '$.access', @all_known_privileges_100500)
|
||||
WHERE
|
||||
host='localhost' and user='good_version_id_100400';
|
||||
FLUSH PRIVILEGES;
|
||||
SHOW GRANTS FOR good_version_id_100400@localhost;
|
||||
DROP USER good_version_id_100400@localhost;
|
||||
|
||||
|
||||
CREATE USER good_version_id_100500@localhost;
|
||||
GRANT SUPER ON *.* to good_version_id_100500@localhost;
|
||||
SHOW GRANTS FOR good_version_id_100500@localhost;
|
||||
UPDATE
|
||||
mysql.global_priv
|
||||
SET
|
||||
Priv=json_set(Priv, '$.version_id',100500)
|
||||
WHERE
|
||||
host='localhost' and user='good_version_id_100500';
|
||||
FLUSH PRIVILEGES;
|
||||
SHOW GRANTS FOR good_version_id_100500@localhost;
|
||||
DROP USER good_version_id_100500@localhost;
|
||||
|
||||
|
||||
--let SEARCH_FILE=$MYSQLTEST_VARDIR/tmp/system_mysql_db_error_log.err
|
||||
|
||||
--let SEARCH_PATTERN= Warning.*'user' entry 'bad_access1@localhost' has a wrong 'access' value.*version_id=
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
--let SEARCH_PATTERN= Warning.*'user' entry 'bad_version_id_1000000@localhost' has a wrong 'version_id' value 1000000
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
--let SEARCH_PATTERN= Warning.*'user' entry 'bad_version_id_minus_3@localhost' has a wrong 'version_id' value -3
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
--let SEARCH_PATTERN= Warning.*'user' entry 'bad_version_id_100300@localhost' has a wrong 'version_id' value 100300
|
||||
--source include/search_pattern_in_file.inc
|
Reference in New Issue
Block a user