1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +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

@ -4297,6 +4297,7 @@ void Security_context::init()
host_or_ip= "connecting host";
priv_user[0]= priv_host[0]= proxy_user[0]= priv_role[0]= '\0';
master_access= 0;
password_expired= false;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
db_access= NO_ACCESS;
#endif
@ -4335,6 +4336,7 @@ void Security_context::skip_grants()
host_or_ip= (char *)"";
master_access= ~NO_ACCESS;
*priv_user= *priv_host= '\0';
password_expired= false;
}
@ -4453,6 +4455,13 @@ bool Security_context::user_matches(Security_context *them)
!strcmp(user, them->user));
}
bool Security_context::is_priv_user(const char *user, const char *host)
{
return ((user != NULL) && (host != NULL) &&
!strcmp(user, priv_user) &&
!my_strcasecmp(system_charset_info, host,priv_host));
}
/****************************************************************************
Handling of open and locked tables states.