Commit c5d73186 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-8227 simple_password_check_minimal_length gets adjusted without a warning

parent 4b88cf33
......@@ -85,7 +85,11 @@ grant select on *.* to foo1;
drop user foo1;
set global simple_password_check_digits=3;
set global simple_password_check_letters_same_case=3;
Warnings:
Warning 1292 Adjusted the value of simple_password_check_minimal_length from 8 to 10
set global simple_password_check_other_characters=3;
Warnings:
Warning 1292 Adjusted the value of simple_password_check_minimal_length from 10 to 12
show variables like 'simple_password_check_%';
Variable_name Value
simple_password_check_digits 3
......
......@@ -14,6 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
#include <my_sys.h>
#include <mysqld_error.h>
#include <mysql/plugin_password_validation.h>
#include <ctype.h>
#include <string.h>
......@@ -50,12 +52,20 @@ static int validate(MYSQL_LEX_STRING *username, MYSQL_LEX_STRING *password)
}
static void fix_min_length(MYSQL_THD thd __attribute__((unused)),
struct st_mysql_sys_var *var,
struct st_mysql_sys_var *var __attribute__((unused)),
void *var_ptr, const void *save)
{
uint new_min_length;
*((unsigned int *)var_ptr)= *((unsigned int *)save);
if (min_length < min_digits + 2 * min_letters + min_others)
min_length= min_digits + 2 * min_letters + min_others;
new_min_length= min_digits + 2 * min_letters + min_others;
if (min_length < new_min_length)
{
my_printf_error(ER_TRUNCATED_WRONG_VALUE,
"Adjusted the value of simple_password_check_minimal_length "
"from %u to %u", ME_JUST_WARNING,
min_length, new_min_length);
min_length= new_min_length;
}
}
static MYSQL_SYSVAR_UINT(minimal_length, min_length, PLUGIN_VAR_RQCMDARG,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment