Commit 06abeb4f authored by unknown's avatar unknown

- Added new error message.

- Changed error message in sql_acl.cc
- Added some more tests for GRANT.


Docs/mysqld_error.txt:
  Added new error message.
mysql-test/r/grant2.result:
  Error message changed.
mysql-test/r/grant3.result:
  Clean up.
mysql-test/t/grant2.test:
  Error message changed.
sql/share/errmsg.txt:
  Added new error message.
sql/sql_acl.cc:
  Changed error message.
mysql-test/t/grant3.test:
  Error message changed.
parent 523a4217
......@@ -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;
......
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';
......
# 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;
}
......
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