1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-7597 Expiration of user passwords

This patch adds support for expiring user passwords.
The following statements are extended:
  CREATE USER user@localhost PASSWORD EXPIRE [option]
  ALTER USER user@localhost PASSWORD EXPIRE [option]
If no option is specified, the password is expired with immediate
effect. If option is DEFAULT, global policy applies according to
the default_password_lifetime system var (if 0, password never
expires, if N, password expires every N days). If option is NEVER,
the password never expires and if option is INTERVAL N DAY, the
password expires every N days.
The feature also supports the disconnect_on_expired_password system
var and the --connect-expired-password client option.

Closes #1166
This commit is contained in:
Robert Bindar
2019-01-16 19:44:30 +02:00
committed by Sergei Golubchik
parent 83de75d66d
commit 90ad4dbd17
34 changed files with 1259 additions and 99 deletions

View File

@ -1626,6 +1626,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
thd->get_stmt_da()->set_skip_flush();
}
if (unlikely(thd->security_ctx->password_expired &&
command != COM_QUERY &&
command != COM_PING &&
command != COM_QUIT))
{
my_error(ER_MUST_CHANGE_PASSWORD, MYF(0));
goto dispatch_end;
}
switch (command) {
case COM_INIT_DB:
{
@ -2357,8 +2366,8 @@ com_multi_end:
break;
}
dispatch_end:
#ifdef WITH_WSREP
dispatch_end:
/*
BF aborted before sending response back to client
*/
@ -3252,6 +3261,13 @@ mysql_execute_command(THD *thd)
#endif
DBUG_ENTER("mysql_execute_command");
if (thd->security_ctx->password_expired &&
lex->sql_command != SQLCOM_SET_OPTION)
{
my_error(ER_MUST_CHANGE_PASSWORD, MYF(0));
DBUG_RETURN(1);
}
DBUG_ASSERT(thd->transaction.stmt.is_empty() || thd->in_sub_stmt);
/*
Each statement or replication event which might produce deadlock