From c94ec9fc6721f50fadb1d86d1d0bf004b39c69d2 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 12 Jan 2019 15:56:25 +0100 Subject: MDEV-17950 SHOW GRANTS FOR does not work for a user identified with non-existing plugin Revert the side effect of 7c40996cc866. Do not convert password hash to its binary representation when a user entry is loaded. Do it lazily on the first authenticatation attempt. As a collateral - force all authentication plugins to follow the protocol and read_packet at least once before accessing info->username (username is not available before first client handshake packet is read). Fix PAM and GSSAPI plugins to behave. --- mysql-test/main/grant5.result | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'mysql-test/main/grant5.result') diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result index 5bf7b2d1934..c35e8201582 100644 --- a/mysql-test/main/grant5.result +++ b/mysql-test/main/grant5.result @@ -59,12 +59,9 @@ update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u5'; update mysql.global_priv set priv=json_set(priv, '$.plugin', 'nonexistent') where user='u8'; flush privileges; -Warnings: -Error 1372 Password hash should be a 41-digit hexadecimal number -Error 1372 Password hash should be a 16-digit hexadecimal number -Warning 1524 Plugin 'nonexistent' is not loaded show create user u1@h; -ERROR 28000: Can't find any matching row in the user table +CREATE USER for u1@h +CREATE USER 'u1'@'h' IDENTIFIED BY PASSWORD 'bad' show create user u2@h; CREATE USER for u2@h CREATE USER 'u2'@'h' IDENTIFIED BY PASSWORD '*975B2CD4FF9AE554FE8AD33168FBFC326D2021DD' @@ -75,7 +72,8 @@ show create user u4@h; CREATE USER for u4@h CREATE USER 'u4'@'h' IDENTIFIED BY PASSWORD '*975B2CD4FF9AE554FE8AD33168FBFC326D2021DD' show create user u5@h; -ERROR 28000: Can't find any matching row in the user table +CREATE USER for u5@h +CREATE USER 'u5'@'h' IDENTIFIED BY PASSWORD 'bad' show create user u6@h; CREATE USER for u6@h CREATE USER 'u6'@'h' IDENTIFIED BY PASSWORD '78a302dd267f6044' @@ -83,26 +81,24 @@ show create user u7@h; CREATE USER for u7@h CREATE USER 'u7'@'h' IDENTIFIED BY PASSWORD '78a302dd267f6044' show create user u8@h; -ERROR 28000: Can't find any matching row in the user table +CREATE USER for u8@h +CREATE USER 'u8'@'h' IDENTIFIED VIA nonexistent USING '78a302dd267f6044' grant select on *.* to u1@h; -ERROR 28000: Can't find any matching row in the user table grant select on *.* to u2@h; grant select on *.* to u3@h; grant select on *.* to u4@h; grant select on *.* to u5@h; -ERROR 28000: Can't find any matching row in the user table grant select on *.* to u6@h; grant select on *.* to u7@h; grant select on *.* to u8@h; -ERROR 28000: Can't find any matching row in the user table select user,select_priv,plugin,authentication_string from mysql.user where user like 'u_'; User Select_priv plugin authentication_string -u1 N mysql_native_password bad +u1 Y mysql_native_password bad u2 Y mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD u3 Y mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD u4 Y mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD -u5 N mysql_old_password bad +u5 Y mysql_old_password bad u6 Y mysql_old_password 78a302dd267f6044 u7 Y mysql_old_password 78a302dd267f6044 -u8 N nonexistent 78a302dd267f6044 +u8 Y nonexistent 78a302dd267f6044 drop user u1@h, u2@h, u3@h, u4@h, u5@h, u6@h, u7@h, u8@h; -- cgit v1.2.1