MDEV-8227 simple_password_check_minimal_length gets adjusted without a warning
This commit is contained in:
parent
4b88cf33c2
commit
c5d73186c0
@ -85,7 +85,11 @@ grant select on *.* to foo1;
|
|||||||
drop user foo1;
|
drop user foo1;
|
||||||
set global simple_password_check_digits=3;
|
set global simple_password_check_digits=3;
|
||||||
set global simple_password_check_letters_same_case=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;
|
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_%';
|
show variables like 'simple_password_check_%';
|
||||||
Variable_name Value
|
Variable_name Value
|
||||||
simple_password_check_digits 3
|
simple_password_check_digits 3
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
|
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 <mysql/plugin_password_validation.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.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)),
|
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)
|
void *var_ptr, const void *save)
|
||||||
{
|
{
|
||||||
|
uint new_min_length;
|
||||||
*((unsigned int *)var_ptr)= *((unsigned int *)save);
|
*((unsigned int *)var_ptr)= *((unsigned int *)save);
|
||||||
if (min_length < min_digits + 2 * min_letters + min_others)
|
new_min_length= min_digits + 2 * min_letters + min_others;
|
||||||
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,
|
static MYSQL_SYSVAR_UINT(minimal_length, min_length, PLUGIN_VAR_RQCMDARG,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user