summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2021-10-20 12:02:52 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2021-10-20 12:02:52 +0200
commit45a376dd2d505af343cfff68e4343c7650f2565c (patch)
tree2362105a4a952047d737acec540a20870b821693
parent3f4eb6073fbcdcddd1e19228dd8b9d3e2312457e (diff)
downloadmariadb-git-preview-10.7-MDEV-9245-password-reuse.tar.gz
MDEV-26647 (reuse info) Include password validation plugin information in the error message if the SQL statement is not satisfied password policypreview-10.7-MDEV-9245-password-reuse
send information about password reusing
-rw-r--r--mysql-test/suite/plugins/r/password_reuse_check.result3
-rw-r--r--plugin/password_reuse_check/password_reuse_check.c10
2 files changed, 12 insertions, 1 deletions
diff --git a/mysql-test/suite/plugins/r/password_reuse_check.result b/mysql-test/suite/plugins/r/password_reuse_check.result
index 32b665dcaa6..a9b79cf34fc 100644
--- a/mysql-test/suite/plugins/r/password_reuse_check.result
+++ b/mysql-test/suite/plugins/r/password_reuse_check.result
@@ -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
show warnings;
Level Code Message
+Warning 1819 password_reuse_check: The password was already used
Error 1819 Your password does not satisfy the current policy requirements
alter user user_name@localhost identified by 'test_pwd';
ERROR HY000: Operation ALTER USER failed for 'user_name'@'localhost'
show warnings;
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 1396 Operation ALTER USER failed for 'user_name'@'localhost'
# check exparation
@@ -23,6 +25,7 @@ alter user user_name@localhost identified by 'test_pwd';
ERROR HY000: Operation ALTER USER failed for 'user_name'@'localhost'
show warnings;
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 1396 Operation ALTER USER failed for 'user_name'@'localhost'
select hex(hash) from mysql.password_reuse_check_history;
diff --git a/plugin/password_reuse_check/password_reuse_check.c b/plugin/password_reuse_check/password_reuse_check.c
index be416962935..f823e7f098b 100644
--- a/plugin/password_reuse_check/password_reuse_check.c
+++ b/plugin/password_reuse_check/password_reuse_check.c
@@ -108,9 +108,17 @@ static int run_query_with_table_creation(MYSQL *mysql, const char *query,
unsigned int rc= mysql_errno(mysql);
if (rc != ER_NO_SUCH_TABLE)
{
- // suppress this error in case of try to add the same password twice
if (rc != ER_DUP_ENTRY)
+ {
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;
}
if (create_table(mysql))