Commit 45a376dd authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-26647 (reuse info) Include password validation plugin information in the...

MDEV-26647 (reuse info) Include password validation plugin information in the error message if the SQL statement is not satisfied password policy

send information about password reusing
parent 3f4eb607
...@@ -10,11 +10,13 @@ grant select on *.* to user_name@localhost identified by 'test_pwd'; ...@@ -10,11 +10,13 @@ grant select on *.* to user_name@localhost identified by 'test_pwd';
ERROR HY000: Your password does not satisfy the current policy requirements ERROR HY000: Your password does not satisfy the current policy requirements
show warnings; show warnings;
Level Code Message Level Code Message
Warning 1819 password_reuse_check: The password was already used
Error 1819 Your password does not satisfy the current policy requirements Error 1819 Your password does not satisfy the current policy requirements
alter user user_name@localhost identified by 'test_pwd'; alter user user_name@localhost identified by 'test_pwd';
ERROR HY000: Operation ALTER USER failed for 'user_name'@'localhost' ERROR HY000: Operation ALTER USER failed for 'user_name'@'localhost'
show warnings; show warnings;
Level Code Message Level Code Message
Warning 1819 password_reuse_check: The password was already used
Error 1819 Your password does not satisfy the current policy requirements Error 1819 Your password does not satisfy the current policy requirements
Error 1396 Operation ALTER USER failed for 'user_name'@'localhost' Error 1396 Operation ALTER USER failed for 'user_name'@'localhost'
# check exparation # check exparation
...@@ -23,6 +25,7 @@ alter user user_name@localhost identified by 'test_pwd'; ...@@ -23,6 +25,7 @@ alter user user_name@localhost identified by 'test_pwd';
ERROR HY000: Operation ALTER USER failed for 'user_name'@'localhost' ERROR HY000: Operation ALTER USER failed for 'user_name'@'localhost'
show warnings; show warnings;
Level Code Message Level Code Message
Warning 1819 password_reuse_check: The password was already used
Error 1819 Your password does not satisfy the current policy requirements Error 1819 Your password does not satisfy the current policy requirements
Error 1396 Operation ALTER USER failed for 'user_name'@'localhost' Error 1396 Operation ALTER USER failed for 'user_name'@'localhost'
select hex(hash) from mysql.password_reuse_check_history; select hex(hash) from mysql.password_reuse_check_history;
......
...@@ -108,9 +108,17 @@ static int run_query_with_table_creation(MYSQL *mysql, const char *query, ...@@ -108,9 +108,17 @@ static int run_query_with_table_creation(MYSQL *mysql, const char *query,
unsigned int rc= mysql_errno(mysql); unsigned int rc= mysql_errno(mysql);
if (rc != ER_NO_SUCH_TABLE) if (rc != ER_NO_SUCH_TABLE)
{ {
// suppress this error in case of try to add the same password twice
if (rc != ER_DUP_ENTRY) if (rc != ER_DUP_ENTRY)
{
report_sql_error(mysql); report_sql_error(mysql);
}
else
{
// warning used to do not change error code
my_printf_error(ER_NOT_VALID_PASSWORD,
"password_reuse_check: The password was already used",
ME_WARNING);
}
return 1; return 1;
} }
if (create_table(mysql)) if (create_table(mysql))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment