summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-08-03 07:12:27 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2022-08-03 07:12:27 +0200
commitaf143474d8925cdbcfc0795a2bc274cbeaad8889 (patch)
tree790022e64c90ce37310d20f1de25af35b0f722c9 /plugin
parent7b500f04fb0baf56b02583f82982508203e58d38 (diff)
parent48e35b8cf61cbedb515787762708afe7bd75386b (diff)
downloadmariadb-git-af143474d8925cdbcfc0795a2bc274cbeaad8889.tar.gz
Merge branch '10.4' into 10.5
Diffstat (limited to 'plugin')
-rw-r--r--plugin/simple_password_check/simple_password_check.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/plugin/simple_password_check/simple_password_check.c b/plugin/simple_password_check/simple_password_check.c
index 65d017e24a1..1762690f2c5 100644
--- a/plugin/simple_password_check/simple_password_check.c
+++ b/plugin/simple_password_check/simple_password_check.c
@@ -29,7 +29,13 @@ static int validate(const MYSQL_CONST_LEX_STRING *username,
const char *ptr= password->str, *end= ptr + length;
if (strncmp(password->str, username->str, length) == 0)
+ {
+ // warning used to do not change error code
+ my_printf_error(ER_NOT_VALID_PASSWORD,
+ "simple_password_check: The password equal to the user name",
+ ME_WARNING);
return 1;
+ }
/* everything non-ascii is the "other" character and is good for the password */
for(; ptr < end; ptr++)
@@ -43,6 +49,28 @@ static int validate(const MYSQL_CONST_LEX_STRING *username,
else
others++;
}
+
+ // warnings used to do not change error code
+ if (length < min_length)
+ my_printf_error(ER_NOT_VALID_PASSWORD,
+ "simple_password_check: Too short password (< %u)",
+ ME_WARNING, min_length);
+ if (uppers < min_letters)
+ my_printf_error(ER_NOT_VALID_PASSWORD,
+ "simple_password_check: Not enough upper case "
+ "letters (< %u)",ME_WARNING, min_letters);
+ if (lowers < min_letters)
+ my_printf_error(ER_NOT_VALID_PASSWORD,
+ "simple_password_check: Not enough lower case "
+ "letters (< %u)",ME_WARNING, min_letters);
+ if (digits < min_digits)
+ my_printf_error(ER_NOT_VALID_PASSWORD,
+ "simple_password_check: Not enough digits (< %u)",
+ ME_WARNING, min_digits);
+ if (others < min_others)
+ my_printf_error(ER_NOT_VALID_PASSWORD,
+ "simple_password_check: Not enough special "
+ "characters (< %u)",ME_WARNING, min_others);
/* remember TRUE means the password failed the validation */
return length < min_length ||
uppers < min_letters ||