Skip to content

Commit 3df2bc1

Browse files
author
Arun Kuruvila
committed
Bug #24619222: PASSWORD_LIFETIME IS RESET TO NULL WHEN USER
EXECUTES ALTER USER STATEMENT. Analysis:- The "password_lifetime" value is set to NULL for certain set of statements. Fix:- A check is introduced before resetting the password_lifetime value to NULL.
1 parent 46eada1 commit 3df2bc1

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

mysql-test/r/grant_user_lock_qa.result

+2-2
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ plugin mysql_native_password
425425
authentication_string #
426426
ssl_type X509
427427
password_expired N
428-
password_lifetime NULL
428+
password_lifetime 0
429429
account_locked N
430430

431431
SHOW CREATE USER u6@localhost;
@@ -543,7 +543,7 @@ ssl_cipher
543543
x509_issuer
544544
x509_subject /C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client
545545
password_expired N
546-
password_lifetime NULL
546+
password_lifetime 0
547547
account_locked N
548548

549549
SHOW CREATE USER u9@localhost;

mysql-test/suite/binlog/r/binlog_grant_alter_user.result

+2-2
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ plugin mysql_native_password
428428
authentication_string #
429429
password_expired N
430430
password_last_changed #
431-
password_lifetime NULL
431+
password_lifetime 0
432432
ALTER USER u3@localhost
433433
REQUIRE SUBJECT '/C=SE/ST=Stockholm/L=Stockholm/O=Oracle/OU=MySQL/CN=Client'
434434
WITH MAX_QUERIES_PER_HOUR 2 MAX_USER_CONNECTIONS 2
@@ -535,7 +535,7 @@ plugin mysql_native_password
535535
authentication_string #
536536
password_expired N
537537
password_last_changed #
538-
password_lifetime NULL
538+
password_lifetime 80
539539
CREATE USER u7@localhost IDENTIFIED WITH 'mysql_native_password'
540540
BY 'auth_string' REQUIRE CIPHER 'DHE-RSA-AES256-SHA';
541541
SELECT user,ssl_type,ssl_cipher,x509_issuer,x509_subject,

sql/auth/sql_user.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,8 @@ bool set_and_validate_user_attributes(THD *thd,
458458
always check for password expire/interval attributes as there is no
459459
way to differentiate NEVER EXPIRE and EXPIRE DEFAULT scenario
460460
*/
461-
what_to_set|= PASSWORD_EXPIRE_ATTR;
461+
if (Str->alter_status.update_password_expired_fields)
462+
what_to_set|= PASSWORD_EXPIRE_ATTR;
462463
}
463464
else
464465
{

0 commit comments

Comments
 (0)