diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-02 14:15:39 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-02 14:15:39 +0200 |
commit | 48e35b8cf61cbedb515787762708afe7bd75386b (patch) | |
tree | 401ce3f31fcb689fb0c0a5aa2a6031d895b0d7cd /plugin | |
parent | 1ea5e402a89a1e3fb9ba8045e58570d23837714a (diff) | |
parent | 5ac528a91f2d8a3b84e83b434b08fa9dc428f80c (diff) | |
download | mariadb-git-48e35b8cf61cbedb515787762708afe7bd75386b.tar.gz |
Merge branch '10.3' into 10.4
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 || |