mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-16774 SET PASSWORD and ALTER USER with slightly different results
set both `password` and `authentication_string` columns in `mysql`.`user` table for now. Suppress the "password was ignored" warning if the password is the same as the authentication string
This commit is contained in:
@ -11,10 +11,10 @@ select user, host, password, plugin, authentication_string from mysql.user where
|
||||
user host password plugin authentication_string
|
||||
natauth localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
|
||||
newpass localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
|
||||
newpassnat localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
|
||||
newpassnat localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
|
||||
oldauth localhost 378b243e220ca493
|
||||
oldpass localhost 378b243e220ca493
|
||||
oldpassold localhost mysql_old_password 378b243e220ca493
|
||||
oldpassold localhost 378b243e220ca493 mysql_old_password 378b243e220ca493
|
||||
connect con,localhost,natauth,test,;
|
||||
select current_user();
|
||||
current_user()
|
||||
@ -86,12 +86,12 @@ set password for oldpass@localhost = PASSWORD('test2');
|
||||
set password for oldpassold@localhost = PASSWORD('test2');
|
||||
select user, host, password, plugin, authentication_string from mysql.user where user != 'root';
|
||||
user host password plugin authentication_string
|
||||
natauth localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
newpass localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
newpassnat localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
oldauth localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
oldpass localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
oldpassold localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
natauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
newpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
newpassnat localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
oldauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
oldpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
oldpassold localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
|
||||
connect con,localhost,natauth,test2,;
|
||||
select current_user();
|
||||
current_user()
|
||||
@ -173,7 +173,7 @@ disconnect foo;
|
||||
connection default;
|
||||
select user,host,password,plugin,authentication_string from mysql.user where user='foo';
|
||||
user host password plugin authentication_string
|
||||
foo localhost mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB
|
||||
foo localhost *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB
|
||||
set password for 'foo'@'localhost' = '';
|
||||
select user,host,password,plugin,authentication_string from mysql.user where user='foo';
|
||||
user host password plugin authentication_string
|
||||
|
@ -71,7 +71,7 @@ connection default;
|
||||
set password for u1 = PASSWORD('SOMETHINGELSE');
|
||||
select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
|
||||
user host password plugin authentication_string
|
||||
u1 % mysql_native_password *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6
|
||||
u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 mysql_native_password *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6
|
||||
#
|
||||
# Here we should use the password field, as that primes over
|
||||
# the authentication_string field.
|
||||
|
@ -518,24 +518,24 @@ connection master;
|
||||
SET PASSWORD FOR 'user_test_rpl'@'localhost' = '*0000000000000000000000000000000000000000';
|
||||
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
|
||||
host user password plugin authentication_string select_priv
|
||||
localhost user_test_rpl mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
localhost user_test_rpl *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
connection slave;
|
||||
USE test_rpl;
|
||||
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
|
||||
host user password plugin authentication_string select_priv
|
||||
localhost user_test_rpl mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
localhost user_test_rpl *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
connection master;
|
||||
|
||||
******************** RENAME USER ********************
|
||||
RENAME USER 'user_test_rpl'@'localhost' TO 'user_test_rpl_2'@'localhost';
|
||||
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
|
||||
host user password plugin authentication_string select_priv
|
||||
localhost user_test_rpl_2 mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
localhost user_test_rpl_2 *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
connection slave;
|
||||
USE test_rpl;
|
||||
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
|
||||
host user password plugin authentication_string select_priv
|
||||
localhost user_test_rpl_2 mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
localhost user_test_rpl_2 *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
connection master;
|
||||
|
||||
******************** DROP USER ********************
|
||||
|
@ -2056,7 +2056,9 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
|
||||
user_table.authentication_string()));
|
||||
user.auth_string.length= strlen(user.auth_string.str);
|
||||
|
||||
if (user.auth_string.length && password_len)
|
||||
if (user.auth_string.length && password_len &&
|
||||
(user.auth_string.length != password_len ||
|
||||
memcmp(user.auth_string.str, password, password_len)))
|
||||
{
|
||||
sql_print_warning("'user' entry '%s@%s' has both a password "
|
||||
"and an authentication plugin specified. The "
|
||||
@ -3927,7 +3929,6 @@ static bool update_user_table(THD *thd, const User_table& user_table,
|
||||
{
|
||||
set_authentication_plugin_from_password(user_table, new_password,
|
||||
new_password_len);
|
||||
new_password_len= 0;
|
||||
}
|
||||
|
||||
if (user_table.password())
|
||||
|
@ -521,24 +521,24 @@ connection master;
|
||||
SET PASSWORD FOR 'user_test_rpl'@'localhost' = '*0000000000000000000000000000000000000000';
|
||||
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
|
||||
host user password plugin authentication_string select_priv
|
||||
localhost user_test_rpl mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
localhost user_test_rpl *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
connection slave;
|
||||
USE test_rpl;
|
||||
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
|
||||
host user password plugin authentication_string select_priv
|
||||
localhost user_test_rpl mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
localhost user_test_rpl *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
connection master;
|
||||
|
||||
******************** RENAME USER ********************
|
||||
RENAME USER 'user_test_rpl'@'localhost' TO 'user_test_rpl_2'@'localhost';
|
||||
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
|
||||
host user password plugin authentication_string select_priv
|
||||
localhost user_test_rpl_2 mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
localhost user_test_rpl_2 *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
connection slave;
|
||||
USE test_rpl;
|
||||
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
|
||||
host user password plugin authentication_string select_priv
|
||||
localhost user_test_rpl_2 mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
localhost user_test_rpl_2 *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
|
||||
connection master;
|
||||
|
||||
******************** DROP USER ********************
|
||||
|
Reference in New Issue
Block a user