summaryrefslogtreecommitdiff
path: root/scripts/mysql_system_tables_fix.sql
diff options
context:
space:
mode:
authorDaniel Black <daniel@mariadb.org>2021-08-16 08:40:56 +1000
committerDaniel Black <daniel@mariadb.org>2021-10-20 12:39:04 +1100
commit4590f8b41cfec0c98a96e5980b6ad7b2e250818c (patch)
tree7b4777cae8e4bf628a6ae1b29e763479a30275d5 /scripts/mysql_system_tables_fix.sql
parentc9a9ae65544e03f9585a65db9c0e6d729616a40c (diff)
downloadmariadb-git-4590f8b41cfec0c98a96e5980b6ad7b2e250818c.tar.gz
MDEV-26363 Passwords incorrectly expiring after MySQL5.7 -> MariaDB10.3 -> 10.4+ upgradesbb-10.4-MDEV-26363-danielblack-zero_last_password_changed
MySQL-5.7 mysql.user tables have a last_password_changed field. Because before MariaDB-10.4 remained oblivious to this, the act of creating users or otherwise changing a users row left the last_password_field with 0. Running a MariaDB-10.4 instance on this would work correctly, until mysql_upgrade is run, when this 0 value immediately translates to password expired state. MySQL-5.7 relied on the password_expired enum to indicate password expiry so we aren't going to activate password that were expired in MySQL-5.7. Thanks Hans Borresen for the bug report and review of the fix.
Diffstat (limited to 'scripts/mysql_system_tables_fix.sql')
-rw-r--r--scripts/mysql_system_tables_fix.sql2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql
index 9dd775aaf30..ec3d532ec11 100644
--- a/scripts/mysql_system_tables_fix.sql
+++ b/scripts/mysql_system_tables_fix.sql
@@ -815,7 +815,7 @@ IF 'BASE TABLE' = (select table_type from information_schema.tables where table_
'max_statement_time', max_statement_time,
'plugin', if(plugin>'',plugin,if(length(password)=16,'mysql_old_password','mysql_native_password')),
'authentication_string', if(plugin>'' and authentication_string>'',authentication_string,password),
- 'password_last_changed', if(password_expired='Y', 0, UNIX_TIMESTAMP(password_last_changed)),
+ 'password_last_changed', if(password_expired='Y', 0, if(password_last_changed, UNIX_TIMESTAMP(password_last_changed), UNIX_TIMESTAMP())),
'password_lifetime', ifnull(password_lifetime, -1),
'account_locked', 'Y'=account_locked,
'default_role', default_role,