Commit 14e181a4 authored by Sergei Golubchik's avatar Sergei Golubchik

misc cleanups

* remove dead code (from .yy)
* remove redundant commands from the test
* extract common code into a reusable function
  (get_auth_plugin, push_new_user)
* rename update_user_table->update_user_table_password
* simplify acl_update_user
* don't strdup a string that's already in a memroot
  (in ACL_ROLE::ACL_ROLE(ACL_USER*))
* create parent_grantee and role_grants dynamic arrays with size 0.
  to avoid any memory allocations when roles aren't used.
parent 76151f3c
...@@ -102,7 +102,6 @@ update mysql.user set plugin="", authentication_string="", password=old_password ...@@ -102,7 +102,6 @@ update mysql.user set plugin="", authentication_string="", password=old_password
flush privileges; flush privileges;
connect con10,localhost,test,gambling2,; connect con10,localhost,test,gambling2,;
connect con5,localhost,test,gambling2,mysql; connect con5,localhost,test,gambling2,mysql;
connection con5;
set password=""; set password="";
set password='gambling3'; set password='gambling3';
ERROR HY000: Password hash should be a 41-digit hexadecimal number ERROR HY000: Password hash should be a 41-digit hexadecimal number
...@@ -161,7 +160,6 @@ ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) ...@@ -161,7 +160,6 @@ ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES)
delete from mysql.user where user=_binary"test"; delete from mysql.user where user=_binary"test";
flush privileges; flush privileges;
connect con7,localhost,root,,test; connect con7,localhost,root,,test;
connection con7;
create table t1 (id integer not null auto_increment primary key); create table t1 (id integer not null auto_increment primary key);
create temporary table t2(id integer not null auto_increment primary key); create temporary table t2(id integer not null auto_increment primary key);
set @id := 1; set @id := 1;
...@@ -302,12 +300,10 @@ SET GLOBAL event_scheduler = OFF; ...@@ -302,12 +300,10 @@ SET GLOBAL event_scheduler = OFF;
# -- End of Bug#35074. # -- End of Bug#35074.
connect extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,; connect extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,;
connection extracon;
SELECT 'Connection on extra port ok'; SELECT 'Connection on extra port ok';
Connection on extra port ok Connection on extra port ok
Connection on extra port ok Connection on extra port ok
connect extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,; connect extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,;
connection extracon2;
SELECT 'Connection on extra port 2 ok'; SELECT 'Connection on extra port 2 ok';
Connection on extra port 2 ok Connection on extra port 2 ok
Connection on extra port 2 ok Connection on extra port 2 ok
...@@ -338,7 +334,6 @@ connect(localhost,mysqltest_up1,foo,test,MASTER_PORT,MASTER_SOCKET); ...@@ -338,7 +334,6 @@ connect(localhost,mysqltest_up1,foo,test,MASTER_PORT,MASTER_SOCKET);
connect pcon1,localhost,mysqltest_up1,foo,,$MASTER_MYPORT,; connect pcon1,localhost,mysqltest_up1,foo,,$MASTER_MYPORT,;
ERROR 28000: Access denied for user 'mysqltest_up1'@'localhost' (using password: YES) ERROR 28000: Access denied for user 'mysqltest_up1'@'localhost' (using password: YES)
connect pcon2,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,; connect pcon2,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,;
connection pcon2;
select user(), current_user(); select user(), current_user();
user() current_user() user() current_user()
mysqltest_up1@localhost mysqltest_up1@% mysqltest_up1@localhost mysqltest_up1@%
...@@ -347,7 +342,6 @@ connect(localhost,mysqltest_up2,newpw,test,MASTER_PORT,MASTER_SOCKET); ...@@ -347,7 +342,6 @@ connect(localhost,mysqltest_up2,newpw,test,MASTER_PORT,MASTER_SOCKET);
connect pcon3,localhost,mysqltest_up2,newpw,,$MASTER_MYPORT,; connect pcon3,localhost,mysqltest_up2,newpw,,$MASTER_MYPORT,;
ERROR 28000: Access denied for user 'mysqltest_up2'@'localhost' (using password: YES) ERROR 28000: Access denied for user 'mysqltest_up2'@'localhost' (using password: YES)
connect pcon4,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,; connect pcon4,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,;
connection pcon4;
select user(), current_user(); select user(), current_user();
user() current_user() user() current_user()
mysqltest_up2@localhost mysqltest_up2@% mysqltest_up2@localhost mysqltest_up2@%
...@@ -368,13 +362,11 @@ mysqltest_up1 mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB ...@@ -368,13 +362,11 @@ mysqltest_up1 mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB
mysqltest_up2 mysql_old_password 09301740536db389 mysqltest_up2 mysql_old_password 09301740536db389
flush privileges; flush privileges;
connect pcon6,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,; connect pcon6,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,;
connection pcon6;
select user(), current_user(); select user(), current_user();
user() current_user() user() current_user()
mysqltest_up1@localhost mysqltest_up1@% mysqltest_up1@localhost mysqltest_up1@%
disconnect pcon6; disconnect pcon6;
connect pcon7,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,; connect pcon7,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,;
connection pcon7;
select user(), current_user(); select user(), current_user();
user() current_user() user() current_user()
mysqltest_up2@localhost mysqltest_up2@% mysqltest_up2@localhost mysqltest_up2@%
......
...@@ -71,7 +71,6 @@ flush privileges; ...@@ -71,7 +71,6 @@ flush privileges;
connect (con10,localhost,test,gambling2,); connect (con10,localhost,test,gambling2,);
connect (con5,localhost,test,gambling2,mysql); connect (con5,localhost,test,gambling2,mysql);
connection con5;
set password=""; set password="";
--error ER_PASSWD_LENGTH --error ER_PASSWD_LENGTH
set password='gambling3'; set password='gambling3';
...@@ -108,7 +107,6 @@ flush privileges; ...@@ -108,7 +107,6 @@ flush privileges;
# Bug#12517 Clear user variables and replication events before # Bug#12517 Clear user variables and replication events before
# closing temp tables in thread cleanup. # closing temp tables in thread cleanup.
connect (con7,localhost,root,,test); connect (con7,localhost,root,,test);
connection con7;
let $connection_id= `select connection_id()`; let $connection_id= `select connection_id()`;
create table t1 (id integer not null auto_increment primary key); create table t1 (id integer not null auto_increment primary key);
create temporary table t2(id integer not null auto_increment primary key); create temporary table t2(id integer not null auto_increment primary key);
...@@ -314,11 +312,9 @@ SET GLOBAL event_scheduler = OFF; ...@@ -314,11 +312,9 @@ SET GLOBAL event_scheduler = OFF;
# Test connections to the extra port. # Test connections to the extra port.
connect(extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,); connect(extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
connection extracon;
SELECT 'Connection on extra port ok'; SELECT 'Connection on extra port ok';
connect(extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,); connect(extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,);
connection extracon2;
SELECT 'Connection on extra port 2 ok'; SELECT 'Connection on extra port 2 ok';
--disable_abort_on_error --disable_abort_on_error
...@@ -349,7 +345,6 @@ GRANT ALL ON test.* TO 'O1234567890123456789012345678901234567890123456789012345 ...@@ -349,7 +345,6 @@ GRANT ALL ON test.* TO 'O1234567890123456789012345678901234567890123456789012345
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
connect (con1,localhost,O1234567890123456789012345678901234567890123456789012345678901234567890123456789x,test123,test); connect (con1,localhost,O1234567890123456789012345678901234567890123456789012345678901234567890123456789x,test123,test);
disconnect con1; disconnect con1;
...@@ -380,18 +375,14 @@ CREATE USER mysqltest_up2 IDENTIFIED VIA mysql_old_password using '09301740536db ...@@ -380,18 +375,14 @@ CREATE USER mysqltest_up2 IDENTIFIED VIA mysql_old_password using '09301740536db
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
connect(pcon1,localhost,mysqltest_up1,foo,,$MASTER_MYPORT,); connect(pcon1,localhost,mysqltest_up1,foo,,$MASTER_MYPORT,);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
connect(pcon2,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,); connect(pcon2,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,);
connection pcon2;
select user(), current_user(); select user(), current_user();
disconnect pcon2; disconnect pcon2;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
--error ER_ACCESS_DENIED_ERROR --error ER_ACCESS_DENIED_ERROR
connect(pcon3,localhost,mysqltest_up2,newpw,,$MASTER_MYPORT,); connect(pcon3,localhost,mysqltest_up2,newpw,,$MASTER_MYPORT,);
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
connect(pcon4,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,); connect(pcon4,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,);
connection pcon4;
select user(), current_user(); select user(), current_user();
disconnect pcon4; disconnect pcon4;
...@@ -421,15 +412,11 @@ select user, password, plugin, authentication_string from mysql.user ...@@ -421,15 +412,11 @@ select user, password, plugin, authentication_string from mysql.user
where user like 'mysqltest_up_'; where user like 'mysqltest_up_';
flush privileges; flush privileges;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
connect(pcon6,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,); connect(pcon6,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,);
connection pcon6;
select user(), current_user(); select user(), current_user();
disconnect pcon6; disconnect pcon6;
--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT
connect(pcon7,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,); connect(pcon7,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,);
connection pcon7;
select user(), current_user(); select user(), current_user();
disconnect pcon7; disconnect pcon7;
connection default; connection default;
......
This diff is collapsed.
...@@ -16819,8 +16819,6 @@ grant_user: ...@@ -16819,8 +16819,6 @@ grant_user:
{ {
$$= $1; $$= $1;
$1->pwtext= $4; $1->pwtext= $4;
if (unlikely(Lex->sql_command == SQLCOM_REVOKE))
MYSQL_YYABORT;
} }
| user IDENTIFIED_SYM BY PASSWORD_SYM TEXT_STRING | user IDENTIFIED_SYM BY PASSWORD_SYM TEXT_STRING
{ {
......
...@@ -17172,8 +17172,6 @@ grant_user: ...@@ -17172,8 +17172,6 @@ grant_user:
{ {
$$= $1; $$= $1;
$1->pwtext= $4; $1->pwtext= $4;
if (unlikely(Lex->sql_command == SQLCOM_REVOKE))
MYSQL_YYABORT;
} }
| user IDENTIFIED_SYM BY PASSWORD_SYM TEXT_STRING | user IDENTIFIED_SYM BY PASSWORD_SYM TEXT_STRING
{ {
......
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