Skip to content

Commit dd6e74c

Browse files
committed
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
1 parent abcd09c commit dd6e74c

File tree

5 files changed

+21
-20
lines changed

5 files changed

+21
-20
lines changed

mysql-test/r/set_password.result

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ select user, host, password, plugin, authentication_string from mysql.user where
1111
user host password plugin authentication_string
1212
natauth localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
1313
newpass localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
14-
newpassnat localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
14+
newpassnat localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29
1515
oldauth localhost 378b243e220ca493
1616
oldpass localhost 378b243e220ca493
17-
oldpassold localhost mysql_old_password 378b243e220ca493
17+
oldpassold localhost 378b243e220ca493 mysql_old_password 378b243e220ca493
1818
connect con,localhost,natauth,test,;
1919
select current_user();
2020
current_user()
@@ -86,12 +86,12 @@ set password for oldpass@localhost = PASSWORD('test2');
8686
set password for oldpassold@localhost = PASSWORD('test2');
8787
select user, host, password, plugin, authentication_string from mysql.user where user != 'root';
8888
user host password plugin authentication_string
89-
natauth localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
90-
newpass localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
91-
newpassnat localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
92-
oldauth localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
93-
oldpass localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
94-
oldpassold localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
89+
natauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
90+
newpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
91+
newpassnat localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
92+
oldauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
93+
oldpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
94+
oldpassold localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E
9595
connect con,localhost,natauth,test2,;
9696
select current_user();
9797
current_user()
@@ -173,7 +173,7 @@ disconnect foo;
173173
connection default;
174174
select user,host,password,plugin,authentication_string from mysql.user where user='foo';
175175
user host password plugin authentication_string
176-
foo localhost mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB
176+
foo localhost *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB
177177
set password for 'foo'@'localhost' = '';
178178
select user,host,password,plugin,authentication_string from mysql.user where user='foo';
179179
user host password plugin authentication_string

mysql-test/r/show_grants_with_plugin-7985.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ connection default;
7171
set password for u1 = PASSWORD('SOMETHINGELSE');
7272
select user, host, password, plugin, authentication_string from mysql.user where user = 'u1';
7373
user host password plugin authentication_string
74-
u1 % mysql_native_password *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6
74+
u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 mysql_native_password *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6
7575
#
7676
# Here we should use the password field, as that primes over
7777
# the authentication_string field.

mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -518,24 +518,24 @@ connection master;
518518
SET PASSWORD FOR 'user_test_rpl'@'localhost' = '*0000000000000000000000000000000000000000';
519519
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
520520
host user password plugin authentication_string select_priv
521-
localhost user_test_rpl mysql_native_password *0000000000000000000000000000000000000000 N
521+
localhost user_test_rpl *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
522522
connection slave;
523523
USE test_rpl;
524524
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
525525
host user password plugin authentication_string select_priv
526-
localhost user_test_rpl mysql_native_password *0000000000000000000000000000000000000000 N
526+
localhost user_test_rpl *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
527527
connection master;
528528

529529
******************** RENAME USER ********************
530530
RENAME USER 'user_test_rpl'@'localhost' TO 'user_test_rpl_2'@'localhost';
531531
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
532532
host user password plugin authentication_string select_priv
533-
localhost user_test_rpl_2 mysql_native_password *0000000000000000000000000000000000000000 N
533+
localhost user_test_rpl_2 *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
534534
connection slave;
535535
USE test_rpl;
536536
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
537537
host user password plugin authentication_string select_priv
538-
localhost user_test_rpl_2 mysql_native_password *0000000000000000000000000000000000000000 N
538+
localhost user_test_rpl_2 *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
539539
connection master;
540540

541541
******************** DROP USER ********************

sql/sql_acl.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2056,7 +2056,9 @@ static bool acl_load(THD *thd, const Grant_tables& tables)
20562056
user_table.authentication_string()));
20572057
user.auth_string.length= strlen(user.auth_string.str);
20582058

2059-
if (user.auth_string.length && password_len)
2059+
if (user.auth_string.length && password_len &&
2060+
(user.auth_string.length != password_len ||
2061+
memcmp(user.auth_string.str, password, password_len)))
20602062
{
20612063
sql_print_warning("'user' entry '%s@%s' has both a password "
20622064
"and an authentication plugin specified. The "
@@ -3927,7 +3929,6 @@ static bool update_user_table(THD *thd, const User_table& user_table,
39273929
{
39283930
set_authentication_plugin_from_password(user_table, new_password,
39293931
new_password_len);
3930-
new_password_len= 0;
39313932
}
39323933

39333934
if (user_table.password())

storage/tokudb/mysql-test/rpl/r/rpl_tokudb_mixed_dml.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,24 +521,24 @@ connection master;
521521
SET PASSWORD FOR 'user_test_rpl'@'localhost' = '*0000000000000000000000000000000000000000';
522522
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
523523
host user password plugin authentication_string select_priv
524-
localhost user_test_rpl mysql_native_password *0000000000000000000000000000000000000000 N
524+
localhost user_test_rpl *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
525525
connection slave;
526526
USE test_rpl;
527527
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
528528
host user password plugin authentication_string select_priv
529-
localhost user_test_rpl mysql_native_password *0000000000000000000000000000000000000000 N
529+
localhost user_test_rpl *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
530530
connection master;
531531

532532
******************** RENAME USER ********************
533533
RENAME USER 'user_test_rpl'@'localhost' TO 'user_test_rpl_2'@'localhost';
534534
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
535535
host user password plugin authentication_string select_priv
536-
localhost user_test_rpl_2 mysql_native_password *0000000000000000000000000000000000000000 N
536+
localhost user_test_rpl_2 *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
537537
connection slave;
538538
USE test_rpl;
539539
SELECT host, user, password, plugin, authentication_string, select_priv FROM mysql.user WHERE user LIKE 'user_test_rpl%';
540540
host user password plugin authentication_string select_priv
541-
localhost user_test_rpl_2 mysql_native_password *0000000000000000000000000000000000000000 N
541+
localhost user_test_rpl_2 *0000000000000000000000000000000000000000 mysql_native_password *0000000000000000000000000000000000000000 N
542542
connection master;
543543

544544
******************** DROP USER ********************

0 commit comments

Comments
 (0)