mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
- Added new error message.
- Changed error message in sql_acl.cc - Added some more tests for GRANT.
This commit is contained in:
@ -595,3 +595,5 @@ character-set=latin1
|
||||
"Invalid ON UPDATE clause for '%-.64s' field",
|
||||
#define ER_UNSUPPORTED_PS 1295
|
||||
"This command is not supported in the prepared statement protocol yet",
|
||||
#define ER_CANT_CREATE_USER_WITH_GRANT 1296
|
||||
"You are not allowed to create a user with GRANT"
|
||||
|
@ -165,7 +165,7 @@ GRANT UPDATE (c2) ON "test"."t2" TO 'mysqltest_1'@'%'
|
||||
GRANT UPDATE ON "test"."t1" TO 'mysqltest_1'@'%'
|
||||
drop user 'mysqltest_1', 'mysqltest_3';
|
||||
grant all on test.t1 to 'mysqltest_1';
|
||||
ERROR 42000: 'root'@'localhost' is not allowed to create new users
|
||||
ERROR HY000: You are not allowed to create a user with GRANT
|
||||
drop user 'mysqltest_1';
|
||||
ERROR HY000: Operation DROP USER failed for 'mysqltest_1'@'%'
|
||||
drop table t1, t2;
|
||||
|
17
mysql-test/r/grant3.result
Normal file
17
mysql-test/r/grant3.result
Normal file
@ -0,0 +1,17 @@
|
||||
SET NAMES binary;
|
||||
drop table if exists t1;
|
||||
delete from mysql.user where user like 'mysqltest\_%';
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
||||
delete from mysql.columns_priv where user like 'mysqltest\_%';
|
||||
flush privileges;
|
||||
create user mysqltest_1@localhost;
|
||||
grant grant option on mysql.* to mysqltest_1@localhost;
|
||||
grant select on `my\_1`.* to mysqltest_1@localhost with grant option;
|
||||
grant select on `my\_1`.* to mysqltest_2@localhost;
|
||||
ERROR HY000: You are not allowed to create a user with GRANT
|
||||
delete from mysql.user where user like 'mysqltest\_%';
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
||||
delete from mysql.columns_priv where user like 'mysqltest\_%';
|
||||
flush privileges;
|
@ -179,7 +179,7 @@ show grants for 'mysqltest_1';
|
||||
drop user 'mysqltest_1', 'mysqltest_3';
|
||||
#
|
||||
# Grant must not create user
|
||||
--error 1211
|
||||
--error 1410
|
||||
grant all on test.t1 to 'mysqltest_1';
|
||||
--error 1396
|
||||
drop user 'mysqltest_1';
|
||||
|
1
mysql-test/t/grant3-master.opt
Normal file
1
mysql-test/t/grant3-master.opt
Normal file
@ -0,0 +1 @@
|
||||
--safe-user-create
|
32
mysql-test/t/grant3.test
Normal file
32
mysql-test/t/grant3.test
Normal file
@ -0,0 +1,32 @@
|
||||
# Test of GRANT commands
|
||||
|
||||
SET NAMES binary;
|
||||
connect (master,localhost,root,,);
|
||||
connection master;
|
||||
|
||||
# Cleanup
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
--enable_warnings
|
||||
|
||||
delete from mysql.user where user like 'mysqltest\_%';
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
||||
delete from mysql.columns_priv where user like 'mysqltest\_%';
|
||||
flush privileges;
|
||||
|
||||
create user mysqltest_1@localhost;
|
||||
grant grant option on mysql.* to mysqltest_1@localhost;
|
||||
grant select on `my\_1`.* to mysqltest_1@localhost with grant option;
|
||||
connect (user_a,localhost,mysqltest_1,,);
|
||||
connection user_a;
|
||||
--error 1410
|
||||
grant select on `my\_1`.* to mysqltest_2@localhost;
|
||||
disconnect user_a;
|
||||
connection default;
|
||||
|
||||
delete from mysql.user where user like 'mysqltest\_%';
|
||||
delete from mysql.db where user like 'mysqltest\_%';
|
||||
delete from mysql.tables_priv where user like 'mysqltest\_%';
|
||||
delete from mysql.columns_priv where user like 'mysqltest\_%';
|
||||
flush privileges;
|
@ -5332,3 +5332,5 @@ ER_STARTUP
|
||||
eng "%s: ready for connections.\nVersion: '%s' socket: '%s' port: %d %s"
|
||||
ER_LOAD_FROM_FIXED_SIZE_ROWS_TO_VAR
|
||||
eng "Can't load value from file with fixed size rows to variable"
|
||||
ER_CANT_CREATE_USER_WITH_GRANT
|
||||
eng "You are not allowed to create a user with GRANT"
|
||||
|
@ -1627,7 +1627,7 @@ static int replace_user_table(THD *thd, TABLE *table, const LEX_USER &combo,
|
||||
else if (((thd->variables.sql_mode & MODE_NO_AUTO_CREATE_USER) &&
|
||||
!password_len) || !create_user)
|
||||
{
|
||||
my_error(ER_NO_PERMISSION_TO_CREATE_USER, MYF(0),
|
||||
my_error(ER_CANT_CREATE_USER_WITH_GRANT, MYF(0),
|
||||
thd->user, thd->host_or_ip);
|
||||
goto end;
|
||||
}
|
||||
|
Reference in New Issue
Block a user