diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-03 10:47:52 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-03 12:19:59 +0200 |
commit | d2f1c3ed6ccf823babf311970dfa0b7c57850db7 (patch) | |
tree | 7c3db13f204c0a0c08f48ddaa402e64a2e209192 /plugin | |
parent | 212994f704496d01881f377e34e04bd007e5e298 (diff) | |
parent | af143474d8925cdbcfc0795a2bc274cbeaad8889 (diff) | |
download | mariadb-git-d2f1c3ed6ccf823babf311970dfa0b7c57850db7.tar.gz |
Merge branch '10.5' into bb-10.6-release
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/simple_password_check/simple_password_check.c | 28 |
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 || |