diff --git a/mysql-test/suite/plugins/r/simple_password_check.result b/mysql-test/suite/plugins/r/simple_password_check.result index bbb96bb8c38..6848a37999c 100644 --- a/mysql-test/suite/plugins/r/simple_password_check.result +++ b/mysql-test/suite/plugins/r/simple_password_check.result @@ -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 diff --git a/plugin/simple_password_check/simple_password_check.c b/plugin/simple_password_check/simple_password_check.c index 1b7668204b6..2d2a0ce0e37 100644 --- a/plugin/simple_password_check/simple_password_check.c +++ b/plugin/simple_password_check/simple_password_check.c @@ -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 +#include #include #include #include @@ -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,