diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /mysql-test/main/long_host.test | |
parent | Initial commit. (diff) | |
download | mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.tar.xz mariadb-3f619478f796eddbba6e39502fe941b285dd97b1.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mysql-test/main/long_host.test')
-rw-r--r-- | mysql-test/main/long_host.test | 200 |
1 files changed, 200 insertions, 0 deletions
diff --git a/mysql-test/main/long_host.test b/mysql-test/main/long_host.test new file mode 100644 index 00000000..301744a1 --- /dev/null +++ b/mysql-test/main/long_host.test @@ -0,0 +1,200 @@ + +--source include/have_debug_sync.inc +--source include/not_embedded.inc +#enable view protocol after fix MDEV-29542 +--source include/no_view_protocol.inc + +--echo # check user + +# User 128 characters +create user user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678; +# User 129 characters +--error ER_WRONG_STRING_LENGTH +create user user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_3456789; + +SELECT host, user FROM mysql.user where user like "user56789%"; +drop user user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678; + +# Host 255 characters +create user user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; + +# Host 256 characters +--error ER_WRONG_STRING_LENGTH +create user user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_3456; + +SELECT host, user FROM mysql.user where user like "user56789%"; + +create database mariadbtestdb; +create database mariadbtestdb2; +create table mariadbtestdb.t1 (a int, b int); +create table mariadbtestdb2.t2 (a int); +create table mariadbtestdb.t3 (a int); + + +SET @saved_dbug = @@GLOBAL.debug_dbug; +set global debug_dbug= "+d,vio_peer_addr_fake_ipv4,getnameinfo_fake_long_host,getaddrinfo_fake_good_ipv4"; + +--echo # check connect + +connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,); +connection con1; +select current_user(); + +--echo # check global privileges + +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb.t1; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb2.t2; + +connection default; +grant SELECT ON *.* TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; +disconnect con1; +connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,); +connection con1; +select * from mariadbtestdb.t1; +select * from mariadbtestdb2.t2; + + +--echo # check revoke + +connection default; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; +disconnect con1; +connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,); +connection con1; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb.t1; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb2.t2; + + +--echo # check data base privileges + +connection default; +grant SELECT ON mariadbtestdb.* TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; +disconnect con1; +connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,); +connection con1; +select * from mariadbtestdb.t1; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb2.t2; +select * from mariadbtestdb.t3; + +--echo # check table privileges + +connection default; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; +grant SELECT ON mariadbtestdb.t1 TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; +disconnect con1; +connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,); +connection con1; +select * from mariadbtestdb.t1; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb2.t2; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb.t3; + +--echo # check column privileges + +connection default; +REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; +grant SELECT (a) ON mariadbtestdb.t1 TO user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; +disconnect con1; +connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,"*NO-ONE*",$MASTER_MYPORT,); +connection con1; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb.t1; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb2.t2; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb.t3; +select a from mariadbtestdb.t1; + +--echo # check role + +connection default; + +# Role 128 characters +CREATE ROLE role5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678; + +# Role 129 characters +--error ER_WRONG_STRING_LENGTH +CREATE ROLE role5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_3456789; + +grant SELECT (a) ON mariadbtestdb.t1 TO role5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678; + +REVOKE ALL PRIVILEGES, GRANT OPTION FROM user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; + +GRANT CREATE ROUTINE on test.* to user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; + +grant role5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678 to user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; + +disconnect con1; +connect (con1,"127.0.0.1","user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678",,test,$MASTER_MYPORT,); +connection con1; + +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb.t1; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb2.t2; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb.t3; +--error ER_TABLEACCESS_DENIED_ERROR +select a from mariadbtestdb.t1; + +SELECT CURRENT_ROLE; +SET ROLE role5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678; +SELECT CURRENT_ROLE; + +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb.t1; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb2.t2; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mariadbtestdb.t3; +select a from mariadbtestdb.t1; + + +--echo # check procedure + +create procedure foo() + select a from mariadbtestdb.t1; +show create procedure foo; + +connection default; +select Host,Db,User,Routine_name,Routine_type,Grantor,Proc_priv from mysql.procs_priv where Routine_name="foo"; + + +connection default; +disconnect con1; +drop procedure foo; + +SET @@GLOBAL.debug_dbug = @saved_dbug; + +drop user user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678@host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_345; +DROP ROLE role5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678; +drop database mariadbtestdb; +drop database mariadbtestdb2; + +--echo # +--echo # MDEV-24968: Assertion `magic < 1<<26' failed in get_magic_sort +--echo # + +create user u1@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907%'; +drop user u1@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907%'; + +create user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_34%'; + +drop user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'host5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678913_345678914_345678915_345678916_345678917_345678918_345678919_345678920_345678921_345678922_345678923_345678924_345678925_34%'; + +create user '5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'%'; +drop user '5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'%'; + +create user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'h%s%5%7%9%1%3%5%7%9%2%3%5%7%9%3%3%5%7%9%4%3%5%7%9%5%3%5%7%9%6%3%5%7%9%7%3%5%7%9%8%3%5%7%9%9%3%5%7%9%0%3%5%7%'; +drop user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'h%s%5%7%9%1%3%5%7%9%2%3%5%7%9%3%3%5%7%9%4%3%5%7%9%5%3%5%7%9%6%3%5%7%9%7%3%5%7%9%8%3%5%7%9%9%3%5%7%9%0%3%5%7%'; +create user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%'; +drop user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%?%'; + +create user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????'; +drop user 'user5678901_345678902_345678903_345678904_345678905_345678906_345678907_345678908_345678909_345678910_345678911_345678912_345678'@'???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????'; |