18 changed files with 244 additions and 31 deletions
-
2include/mysql_com.h
-
97mysql-test/r/grant_4332.result
-
2mysql-test/r/status_user.result
-
4mysql-test/suite/funcs_1/r/is_columns_is.result
-
4mysql-test/suite/funcs_1/r/is_columns_is_embedded.result
-
6mysql-test/suite/rpl/r/rpl_password_boundaries.result
-
2mysql-test/suite/rpl/t/rpl_password_boundaries.test
-
107mysql-test/t/grant_4332.test
-
2sql/event_db_repository.cc
-
2sql/item_strfunc.cc
-
6sql/item_strfunc.h
-
2sql/rpl_mi.h
-
2sql/sp.cc
-
6sql/sql_acl.cc
-
16sql/sql_repl.cc
-
2sql/sql_show.cc
-
4sql/sql_yacc.yy
-
9tests/mysql_client_test.c
@ -0,0 +1,97 @@ |
|||
set global event_scheduler = on; |
|||
select user(); |
|||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr |
|||
def user() 253 77 14 N 1 31 8 |
|||
user() |
|||
root@localhost |
|||
create user a17aaaaaaaaaaaaa0@localhost; |
|||
ERROR HY000: String 'a17aaaaaaaaaaaaa0' is too long for user name (should be no longer than 16) |
|||
alter table mysql.user modify User char(80) binary not null default ''; |
|||
alter table mysql.db modify User char(80) binary not null default ''; |
|||
alter table mysql.tables_priv modify User char(80) binary not null default ''; |
|||
alter table mysql.columns_priv modify User char(80) binary not null default ''; |
|||
alter table mysql.procs_priv modify User char(80) binary not null default ''; |
|||
alter table mysql.proc modify definer char(141) collate utf8_bin not null default ''; |
|||
alter table mysql.event modify definer char(141) collate utf8_bin not null default ''; |
|||
flush privileges; |
|||
select user(); |
|||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr |
|||
def user() 253 141 14 N 1 31 8 |
|||
user() |
|||
root@localhost |
|||
create user a17aaaaaaaaaaaaa0@localhost; |
|||
grant usage on *.* to a17aaaaaaaaaaaaa0@localhost; |
|||
grant select on mysql.user to b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost; |
|||
grant select(User) on mysql.tables_priv to c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost; |
|||
select user(), current_user(); |
|||
user() current_user() |
|||
a17aaaaaaaaaaaaa0@localhost a17aaaaaaaaaaaaa0@localhost |
|||
show grants; |
|||
Grants for a17aaaaaaaaaaaaa0@localhost |
|||
GRANT USAGE ON *.* TO 'a17aaaaaaaaaaaaa0'@'localhost' |
|||
select user(), current_user(); |
|||
user() current_user() |
|||
b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost |
|||
show grants; |
|||
Grants for b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost |
|||
GRANT USAGE ON *.* TO 'b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0'@'localhost' |
|||
GRANT SELECT ON `mysql`.`user` TO 'b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0'@'localhost' |
|||
select user,host from mysql.user where user like '%0'; |
|||
user host |
|||
a17aaaaaaaaaaaaa0 localhost |
|||
b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0 localhost |
|||
c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0 localhost |
|||
select user,host from mysql.db; |
|||
ERROR 42000: SELECT command denied to user 'b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'@'localhost' for table 'db' |
|||
select user(), current_user(); |
|||
user() current_user() |
|||
c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost |
|||
show grants; |
|||
Grants for c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost |
|||
GRANT USAGE ON *.* TO 'c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0'@'localhost' |
|||
GRANT SELECT (User) ON `mysql`.`tables_priv` TO 'c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0'@'localhost' |
|||
select user from mysql.tables_priv; |
|||
user |
|||
b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0 |
|||
c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0 |
|||
select user,host from mysql.tables_priv; |
|||
ERROR 42000: SELECT command denied to user 'c80ccccccccccccccccccccccccccccccccccccccccccccc'@'localhost' for column 'host' in table 'tables_priv' |
|||
create procedure test.p1() select user(), current_user(), user from mysql.tables_priv; |
|||
show create procedure test.p1; |
|||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation |
|||
p1 CREATE DEFINER=`c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0`@`localhost` PROCEDURE `p1`() |
|||
select user(), current_user(), user from mysql.tables_priv latin1 latin1_swedish_ci latin1_swedish_ci |
|||
create table test.t1 (a text); |
|||
create event e1 on schedule every 1 second |
|||
do insert test.t1 values (concat(user(), ' ', current_user())); |
|||
call test.p1(); |
|||
user() current_user() user |
|||
root@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0 |
|||
root@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0 |
|||
select * from t1 limit 1; |
|||
a |
|||
event_scheduler@localhost c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost |
|||
grant usage on *.* to d81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd0@lodalhost; |
|||
ERROR HY000: String 'd81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd' is too long for user name (should be no longer than 80) |
|||
drop user d81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd0@lodalhost; |
|||
ERROR HY000: String 'd81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd' is too long for user name (should be no longer than 80) |
|||
drop user c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost; |
|||
drop user b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost; |
|||
drop user a17aaaaaaaaaaaaa0@localhost; |
|||
set global event_scheduler = off; |
|||
drop event e1; |
|||
drop procedure test.p1; |
|||
drop table t1; |
|||
alter table mysql.user modify User char(16) binary not null default ''; |
|||
alter table mysql.db modify User char(16) binary not null default ''; |
|||
alter table mysql.tables_priv modify User char(16) binary not null default ''; |
|||
alter table mysql.columns_priv modify User char(16) binary not null default ''; |
|||
alter table mysql.procs_priv modify User char(16) binary not null default ''; |
|||
alter table mysql.proc modify definer char(77) collate utf8_bin not null default ''; |
|||
alter table mysql.event modify definer char(77) collate utf8_bin not null default ''; |
|||
flush privileges; |
|||
select user(); |
|||
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr |
|||
def user() 253 77 14 N 1 31 8 |
|||
user() |
|||
root@localhost |
@ -0,0 +1,107 @@ |
|||
# |
|||
# MDEV-4332 Increase username length from 16 characters |
|||
# |
|||
|
|||
# user names here have the pattern |
|||
# <letter><length><more letters>0 |
|||
# where '0' at the end is the end-of-name marker |
|||
|
|||
--source include/not_embedded.inc |
|||
|
|||
set global event_scheduler = on; |
|||
|
|||
--enable_metadata |
|||
select user(); |
|||
--disable_metadata |
|||
|
|||
--error ER_WRONG_STRING_LENGTH |
|||
create user a17aaaaaaaaaaaaa0@localhost; |
|||
|
|||
alter table mysql.user modify User char(80) binary not null default ''; |
|||
alter table mysql.db modify User char(80) binary not null default ''; |
|||
alter table mysql.tables_priv modify User char(80) binary not null default ''; |
|||
alter table mysql.columns_priv modify User char(80) binary not null default ''; |
|||
alter table mysql.procs_priv modify User char(80) binary not null default ''; |
|||
alter table mysql.proc modify definer char(141) collate utf8_bin not null default ''; |
|||
alter table mysql.event modify definer char(141) collate utf8_bin not null default ''; |
|||
flush privileges; |
|||
|
|||
--enable_metadata |
|||
select user(); |
|||
--disable_metadata |
|||
|
|||
create user a17aaaaaaaaaaaaa0@localhost; |
|||
grant usage on *.* to a17aaaaaaaaaaaaa0@localhost; |
|||
grant select on mysql.user to b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost; |
|||
grant select(User) on mysql.tables_priv to c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost; |
|||
|
|||
connect (a17,localhost,a17aaaaaaaaaaaaa0,,); |
|||
connect (b64,localhost,b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0,,); |
|||
connect (c80,localhost,c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0,,); |
|||
|
|||
connection a17; |
|||
select user(), current_user(); |
|||
show grants; |
|||
|
|||
connection b64; |
|||
select user(), current_user(); |
|||
show grants; |
|||
select user,host from mysql.user where user like '%0'; |
|||
--error ER_TABLEACCESS_DENIED_ERROR |
|||
select user,host from mysql.db; |
|||
|
|||
connection c80; |
|||
select user(), current_user(); |
|||
show grants; |
|||
select user from mysql.tables_priv; |
|||
--error ER_COLUMNACCESS_DENIED_ERROR |
|||
select user,host from mysql.tables_priv; |
|||
|
|||
create procedure test.p1() select user(), current_user(), user from mysql.tables_priv; |
|||
|
|||
show create procedure test.p1; |
|||
|
|||
create table test.t1 (a text); |
|||
create event e1 on schedule every 1 second |
|||
do insert test.t1 values (concat(user(), ' ', current_user())); |
|||
|
|||
connection default; |
|||
|
|||
call test.p1(); |
|||
|
|||
disconnect a17; |
|||
disconnect b64; |
|||
disconnect c80; |
|||
|
|||
let $wait_timeout= 10; |
|||
let $wait_condition= SELECT 1 from t1; |
|||
--source include/wait_condition.inc |
|||
|
|||
select * from t1 limit 1; |
|||
--error ER_WRONG_STRING_LENGTH |
|||
grant usage on *.* to d81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd0@lodalhost; |
|||
|
|||
--error ER_WRONG_STRING_LENGTH |
|||
drop user d81ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd0@lodalhost; |
|||
drop user c80cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc0@localhost; |
|||
drop user b64bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb0@localhost; |
|||
drop user a17aaaaaaaaaaaaa0@localhost; |
|||
|
|||
set global event_scheduler = off; |
|||
drop event e1; |
|||
drop procedure test.p1; |
|||
drop table t1; |
|||
|
|||
alter table mysql.user modify User char(16) binary not null default ''; |
|||
alter table mysql.db modify User char(16) binary not null default ''; |
|||
alter table mysql.tables_priv modify User char(16) binary not null default ''; |
|||
alter table mysql.columns_priv modify User char(16) binary not null default ''; |
|||
alter table mysql.procs_priv modify User char(16) binary not null default ''; |
|||
alter table mysql.proc modify definer char(77) collate utf8_bin not null default ''; |
|||
alter table mysql.event modify definer char(77) collate utf8_bin not null default ''; |
|||
flush privileges; |
|||
|
|||
--enable_metadata |
|||
select user(); |
|||
--disable_metadata |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue