summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2014-11-23 20:30:56 +0100
committerSergei Golubchik <serg@mariadb.org>2014-12-04 10:41:53 +0100
commitf5722f5851bb4603040d5010aeeb98244cc2789f (patch)
tree31656aab4df27d339103cfaf8574bc6982a563bd /mysql-test
parentc1204da1c72bb51c0b4904704b69411f7ce391e3 (diff)
downloadmariadb-git-f5722f5851bb4603040d5010aeeb98244cc2789f.tar.gz
cleanup: normalize LEX_USER to get rid of different representation of the same thing
username IDENTIFIED BY PASSWORD xxx username IDENTIFIED VIA mysql_native_password USING xxx etc also check for valid strlen(xxx)
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/connect.result4
-rw-r--r--mysql-test/r/grant4.result34
-rw-r--r--mysql-test/t/connect.test4
-rw-r--r--mysql-test/t/grant4.test31
4 files changed, 69 insertions, 4 deletions
diff --git a/mysql-test/r/connect.result b/mysql-test/r/connect.result
index 32c7bdfcf12..778219f6ed9 100644
--- a/mysql-test/r/connect.result
+++ b/mysql-test/r/connect.result
@@ -273,8 +273,8 @@ connect(localhost,mysqltest_nouser,newpw,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: YES)
connect(localhost,mysqltest_nouser,,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'mysqltest_nouser'@'localhost' (using password: NO)
-update mysql.user set password=authentication_string, authentication_string=''
- where user like 'mysqltest_up_';
+update mysql.user set plugin='mysql_native_password' where user = 'mysqltest_up1';
+update mysql.user set plugin='mysql_old_password' where user = 'mysqltest_up2';
select user, password, plugin, authentication_string from mysql.user
where user like 'mysqltest_up_';
user password plugin authentication_string
diff --git a/mysql-test/r/grant4.result b/mysql-test/r/grant4.result
index 60617acbd1f..d96802d105c 100644
--- a/mysql-test/r/grant4.result
+++ b/mysql-test/r/grant4.result
@@ -178,3 +178,37 @@ mysqltest_db1.t1 repair status OK
# Switching to connection 'default'.
drop database mysqltest_db1;
drop user mysqltest_u1@localhost;
+create user foo1 identified by password '11111111111111111111111111111111111111111';
+create user foo2 identified by password '2222222222222222';
+create user foo3 identified via mysql_native_password using '11111111111111111111111111111111111111111';
+create user foo4 identified via mysql_old_password using '2222222222222222';
+grant select on test.* to foo5 identified by password '11111111111111111111111111111111111111111';
+grant select on test.* to foo6 identified by password '2222222222222222';
+grant select on test.* to foo7 identified via mysql_native_password using '11111111111111111111111111111111111111111';
+grant select on test.* to foo8 identified via mysql_old_password using '2222222222222222';
+select user,password,plugin,authentication_string from mysql.user where user like 'foo%';
+user password plugin authentication_string
+foo1 11111111111111111111111111111111111111111
+foo2 2222222222222222
+foo3 11111111111111111111111111111111111111111
+foo4 2222222222222222
+foo5 11111111111111111111111111111111111111111
+foo6 2222222222222222
+foo7 11111111111111111111111111111111111111111
+foo8 2222222222222222
+drop user foo1;
+drop user foo2;
+drop user foo3;
+drop user foo4;
+drop user foo5;
+drop user foo6;
+drop user foo7;
+drop user foo8;
+create user foo1 identified via mysql_native_password using '00';
+ERROR HY000: Password hash should be a 41-digit hexadecimal number
+create user foo2 identified via mysql_native_password using '2222222222222222';
+ERROR HY000: Password hash should be a 41-digit hexadecimal number
+create user foo3 identified via mysql_old_password using '00';
+ERROR HY000: Password hash should be a 16-digit hexadecimal number
+create user foo4 identified via mysql_old_password using '11111111111111111111111111111111111111111';
+ERROR HY000: Password hash should be a 16-digit hexadecimal number
diff --git a/mysql-test/t/connect.test b/mysql-test/t/connect.test
index fca588de8e8..c4a6fb73b10 100644
--- a/mysql-test/t/connect.test
+++ b/mysql-test/t/connect.test
@@ -397,8 +397,8 @@ connection default;
#
# cannot connect when password is set and plugin=mysql_native_password
#
-update mysql.user set password=authentication_string, authentication_string=''
- where user like 'mysqltest_up_';
+update mysql.user set plugin='mysql_native_password' where user = 'mysqltest_up1';
+update mysql.user set plugin='mysql_old_password' where user = 'mysqltest_up2';
select user, password, plugin, authentication_string from mysql.user
where user like 'mysqltest_up_';
flush privileges;
diff --git a/mysql-test/t/grant4.test b/mysql-test/t/grant4.test
index 756454237f5..36c44fe997a 100644
--- a/mysql-test/t/grant4.test
+++ b/mysql-test/t/grant4.test
@@ -201,3 +201,34 @@ disconnect con1;
connection default;
drop database mysqltest_db1;
drop user mysqltest_u1@localhost;
+
+create user foo1 identified by password '11111111111111111111111111111111111111111';
+create user foo2 identified by password '2222222222222222';
+create user foo3 identified via mysql_native_password using '11111111111111111111111111111111111111111';
+create user foo4 identified via mysql_old_password using '2222222222222222';
+
+grant select on test.* to foo5 identified by password '11111111111111111111111111111111111111111';
+grant select on test.* to foo6 identified by password '2222222222222222';
+grant select on test.* to foo7 identified via mysql_native_password using '11111111111111111111111111111111111111111';
+grant select on test.* to foo8 identified via mysql_old_password using '2222222222222222';
+
+--sorted_result
+select user,password,plugin,authentication_string from mysql.user where user like 'foo%';
+
+drop user foo1;
+drop user foo2;
+drop user foo3;
+drop user foo4;
+drop user foo5;
+drop user foo6;
+drop user foo7;
+drop user foo8;
+
+--error ER_PASSWD_LENGTH
+create user foo1 identified via mysql_native_password using '00';
+--error ER_PASSWD_LENGTH
+create user foo2 identified via mysql_native_password using '2222222222222222';
+--error ER_PASSWD_LENGTH
+create user foo3 identified via mysql_old_password using '00';
+--error ER_PASSWD_LENGTH
+create user foo4 identified via mysql_old_password using '11111111111111111111111111111111111111111';