Browse Source
MDEV-7597 Expiration of user passwords
MDEV-7597 Expiration of user passwords
post-merge changes: * handle password expiration on old tables like everything else - make changes in memory, even if they cannot be done on disk * merge "debug" tests with non-debug tests, they don't use dbug anyway * only run rpl password expiration in MIXED mode, it doesn't replicate anything, so no need to repeat it thrice * restore update_user_table_password() prototype, it should not change ACL_USER, this is done in acl_user_update() * don't parse json twice in get_password_lifetime and get_password_expired * remove LEX_USER::is_changing_password, see if there was any auth instead * avoid overflow in expiration calculations * don't initialize Account_options in the constructor, it's bzero-ed later * don't create ulong sysvars - they're not portable, prefer uint or ulonglong * misc simplificationsbb-10.4-elenst-no-mdev371
21 changed files with 251 additions and 359 deletions
-
2mysql-test/main/mysql_upgrade.result
-
58mysql-test/main/password_expiration.result
-
67mysql-test/main/password_expiration.test
-
55mysql-test/main/password_expiration_dbug.result
-
75mysql-test/main/password_expiration_dbug.test
-
99mysql-test/suite/funcs_1/r/is_user_privileges.result
-
22mysql-test/suite/funcs_1/t/is_user_privileges.test
-
3mysql-test/suite/plugins/r/multiauth.result
-
2mysql-test/suite/plugins/t/multiauth.test
-
0mysql-test/suite/rpl/r/password_expiration.result
-
1mysql-test/suite/rpl/t/password_expiration.test
-
2mysql-test/suite/sys_vars/r/sysvars_server_embedded.result
-
2mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result
-
2sql/mysqld.cc
-
2sql/mysqld.h
-
173sql/sql_acl.cc
-
10sql/sql_lex.h
-
16sql/sql_yacc.yy
-
16sql/sql_yacc_ora.yy
-
1sql/structs.h
-
2sql/sys_vars.cc
@ -1,55 +0,0 @@ |
|||
set @old_dbug= @@global.debug_dbug; |
|||
set global debug_dbug= "+d,password_expiration_interval_sec"; |
|||
# |
|||
# PASSWORD EXPIRE DEFAULT should use the default_password_lifetime |
|||
# system var to set the number of days till expiration |
|||
# |
|||
set global disconnect_on_expired_password= ON; |
|||
set global default_password_lifetime= 2; |
|||
create user user1@localhost password expire default; |
|||
set @tstamp_expired= UNIX_TIMESTAMP() - 3; |
|||
update mysql.global_priv set |
|||
priv=json_set(priv, '$.password_last_changed', @tstamp_expired) |
|||
where user='user1'; |
|||
flush privileges; |
|||
connect(localhost,user1,,test,MYSQL_PORT,MYSQL_SOCK); |
|||
connect con1,localhost,user1; |
|||
ERROR HY000: Your password has expired. To log in you must change it using a client that supports expired passwords |
|||
drop user user1@localhost; |
|||
# |
|||
# PASSWORD EXPIRE INTERVAL should expire a client's password after |
|||
# X seconds and not before |
|||
# |
|||
set global disconnect_on_expired_password= ON; |
|||
create user user1@localhost password expire interval 2 day; |
|||
connect con1,localhost,user1; |
|||
disconnect con1; |
|||
connection default; |
|||
set @tstamp_expired= UNIX_TIMESTAMP() - 3; |
|||
update mysql.global_priv set |
|||
priv=json_set(priv, '$.password_last_changed', @tstamp_expired) |
|||
where user='user1'; |
|||
flush privileges; |
|||
connect(localhost,user1,,test,MYSQL_PORT,MYSQL_SOCK); |
|||
connect con1,localhost,user1; |
|||
ERROR HY000: Your password has expired. To log in you must change it using a client that supports expired passwords |
|||
drop user user1@localhost; |
|||
# |
|||
# PASSWORD EXPIRE NEVER should override the other policies and never |
|||
# expire a client's password |
|||
# |
|||
set global disconnect_on_expired_password= ON; |
|||
create user user1@localhost password expire interval 2 day; |
|||
alter user user1@localhost password expire never; |
|||
set @tstamp_expired= UNIX_TIMESTAMP() - 3; |
|||
update mysql.global_priv set |
|||
priv=json_set(priv, '$.password_last_changed', @tstamp_expired) |
|||
where user='user1'; |
|||
flush privileges; |
|||
connect con1,localhost,user1; |
|||
disconnect con1; |
|||
connection default; |
|||
drop user user1@localhost; |
|||
set global debug_dbug= @old_dbug; |
|||
set global disconnect_on_expired_password= default; |
|||
set global default_password_lifetime= default; |
@ -1,75 +0,0 @@ |
|||
# |
|||
# Test password expiration INTERVAL and default_password_lifetime options |
|||
# |
|||
|
|||
--source include/have_debug.inc |
|||
--source include/not_embedded.inc |
|||
|
|||
set @old_dbug= @@global.debug_dbug; |
|||
set global debug_dbug= "+d,password_expiration_interval_sec"; |
|||
|
|||
--echo # |
|||
--echo # PASSWORD EXPIRE DEFAULT should use the default_password_lifetime |
|||
--echo # system var to set the number of days till expiration |
|||
--echo # |
|||
set global disconnect_on_expired_password= ON; |
|||
set global default_password_lifetime= 2; |
|||
create user user1@localhost password expire default; |
|||
|
|||
set @tstamp_expired= UNIX_TIMESTAMP() - 3; |
|||
update mysql.global_priv set |
|||
priv=json_set(priv, '$.password_last_changed', @tstamp_expired) |
|||
where user='user1'; |
|||
flush privileges; |
|||
|
|||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK |
|||
--error ER_MUST_CHANGE_PASSWORD_LOGIN |
|||
connect(con1,localhost,user1); |
|||
drop user user1@localhost; |
|||
|
|||
--echo # |
|||
--echo # PASSWORD EXPIRE INTERVAL should expire a client's password after |
|||
--echo # X seconds and not before |
|||
--echo # |
|||
set global disconnect_on_expired_password= ON; |
|||
create user user1@localhost password expire interval 2 day; |
|||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK |
|||
connect(con1,localhost,user1); |
|||
disconnect con1; |
|||
connection default; |
|||
|
|||
set @tstamp_expired= UNIX_TIMESTAMP() - 3; |
|||
update mysql.global_priv set |
|||
priv=json_set(priv, '$.password_last_changed', @tstamp_expired) |
|||
where user='user1'; |
|||
flush privileges; |
|||
|
|||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK |
|||
--error ER_MUST_CHANGE_PASSWORD_LOGIN |
|||
connect(con1,localhost,user1); |
|||
drop user user1@localhost; |
|||
|
|||
--echo # |
|||
--echo # PASSWORD EXPIRE NEVER should override the other policies and never |
|||
--echo # expire a client's password |
|||
--echo # |
|||
set global disconnect_on_expired_password= ON; |
|||
create user user1@localhost password expire interval 2 day; |
|||
alter user user1@localhost password expire never; |
|||
|
|||
set @tstamp_expired= UNIX_TIMESTAMP() - 3; |
|||
update mysql.global_priv set |
|||
priv=json_set(priv, '$.password_last_changed', @tstamp_expired) |
|||
where user='user1'; |
|||
flush privileges; |
|||
|
|||
--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK |
|||
connect(con1,localhost,user1); |
|||
disconnect con1; |
|||
connection default; |
|||
drop user user1@localhost; |
|||
|
|||
set global debug_dbug= @old_dbug; |
|||
set global disconnect_on_expired_password= default; |
|||
set global default_password_lifetime= default; |
|||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue