| 1 |
--source include/have_ndb.inc |
| 2 |
|
| 3 |
# Bug#34626727 Password for stored user is expired on remote SQL nodes |
| 4 |
# when the password is not set |
| 5 |
|
| 6 |
CREATE USER t346; |
| 7 |
GRANT NDB_STORED_USER ON *.* TO t346; |
| 8 |
SELECT password_expired FROM mysql.user WHERE USER = 't346'; |
| 9 |
|
| 10 |
connect(mysqld2,127.0.0.1,root,,test,$MASTER_MYPORT1); |
| 11 |
|
| 12 |
--echo server 2: |
| 13 |
SELECT password_expired FROM mysql.user WHERE USER = 't346'; |
| 14 |
|
| 15 |
connection default; |
| 16 |
|
| 17 |
# Bug#33172887 password_last_changed is geting updated on sql node restart |
| 18 |
# for user with NDB_STORED_USER privilege |
| 19 |
|
| 20 |
--disable_result_log |
| 21 |
--disable_query_log |
| 22 |
|
| 23 |
# Create a stored user |
| 24 |
CREATE USER t331@localhost IDENTIFIED BY "i_did_not_change_my_password"; |
| 25 |
GRANT NDB_STORED_USER ON *.* to "t331"@"localhost"; |
| 26 |
|
| 27 |
# Check the password mod time |
| 28 |
let $mt1=`SELECT password_last_changed from mysql.user WHERE User = "t331"`; |
| 29 |
|
| 30 |
# Restart the server |
| 31 |
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.1.expect |
| 32 |
--enable_reconnect |
| 33 |
--shutdown_server |
| 34 |
--source include/wait_until_connected_again.inc |
| 35 |
|
| 36 |
# Check the password mod time again |
| 37 |
let $mt2=`SELECT password_last_changed from mysql.user WHERE User = "t331"`; |
| 38 |
|
| 39 |
# It should not have changed since the first time |
| 40 |
assert ($mt1 == $mt2); |
| 41 |
|
| 42 |
--enable_query_log |
| 43 |
--enable_result_log |
| 44 |
--result_format 2 |
| 45 |
|
| 46 |
## When a MySQL server starts up, it has to catch up on all the changes |
| 47 |
## to NDB stored users as recorded in the ndb_sql_metadata table. The snapshots |
| 48 |
## in the table include the output of SHOW CREATE USER. If the local result |
| 49 |
## from SHOW CREATE USER is identical to the one stored in the snapshot, it |
| 50 |
## can mark a user as synchronized without touching their password_last_changed |
| 51 |
## timestamp. |
| 52 |
## |
| 53 |
## We are going to record some output from SHOW CREATE USER in the result file |
| 54 |
## here, so that this test will fail whenever that output changes. Any time |
| 55 |
## that output changes from one release to the next we should respond, either |
| 56 |
## by writing code that expects the change, or by writing a release note to |
| 57 |
## tell users that upgrading will cause password timestamps to get bumped. |
| 58 |
|
| 59 |
set print_identified_with_as_hex = true; |
| 60 |
replace_regex /0x[0123456789ABCDEF]*/'0x_hashed_password_'/ |
| 61 |
/AS '.*'/AS 'encrypted_password'/; |
| 62 |
query_vertical SHOW CREATE USER t331@localhost; |
| 63 |
set print_identified_with_as_hex = false; |
| 64 |
|
| 65 |
## Cleanup |
| 66 |
DROP USER t346; |
| 67 |
DROP USER t331@localhost; |