Skip to content

Commit 45a376d

Browse files
committed
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
1 parent 3f4eb60 commit 45a376d

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

mysql-test/suite/plugins/r/password_reuse_check.result

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,13 @@ grant select on *.* to user_name@localhost identified by 'test_pwd';
1010
ERROR HY000: Your password does not satisfy the current policy requirements
1111
show warnings;
1212
Level Code Message
13+
Warning 1819 password_reuse_check: The password was already used
1314
Error 1819 Your password does not satisfy the current policy requirements
1415
alter user user_name@localhost identified by 'test_pwd';
1516
ERROR HY000: Operation ALTER USER failed for 'user_name'@'localhost'
1617
show warnings;
1718
Level Code Message
19+
Warning 1819 password_reuse_check: The password was already used
1820
Error 1819 Your password does not satisfy the current policy requirements
1921
Error 1396 Operation ALTER USER failed for 'user_name'@'localhost'
2022
# check exparation
@@ -23,6 +25,7 @@ alter user user_name@localhost identified by 'test_pwd';
2325
ERROR HY000: Operation ALTER USER failed for 'user_name'@'localhost'
2426
show warnings;
2527
Level Code Message
28+
Warning 1819 password_reuse_check: The password was already used
2629
Error 1819 Your password does not satisfy the current policy requirements
2730
Error 1396 Operation ALTER USER failed for 'user_name'@'localhost'
2831
select hex(hash) from mysql.password_reuse_check_history;

plugin/password_reuse_check/password_reuse_check.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,17 @@ static int run_query_with_table_creation(MYSQL *mysql, const char *query,
108108
unsigned int rc= mysql_errno(mysql);
109109
if (rc != ER_NO_SUCH_TABLE)
110110
{
111-
// suppress this error in case of try to add the same password twice
112111
if (rc != ER_DUP_ENTRY)
112+
{
113113
report_sql_error(mysql);
114+
}
115+
else
116+
{
117+
// warning used to do not change error code
118+
my_printf_error(ER_NOT_VALID_PASSWORD,
119+
"password_reuse_check: The password was already used",
120+
ME_WARNING);
121+
}
114122
return 1;
115123
}
116124
if (create_table(mysql))

0 commit comments

Comments
 (0)