summaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2016-07-12 13:02:26 +0200
committerSergei Golubchik <serg@mariadb.org>2016-07-12 22:21:49 +0200
commitc5d73186c01998178eaed206e200334b160eb5e8 (patch)
tree5579e40b1c892d406771d2f0234dc503771bec7e /plugin
parent4b88cf33c25a2597925264aa4de91810fc53f4c4 (diff)
downloadmariadb-git-c5d73186c01998178eaed206e200334b160eb5e8.tar.gz
MDEV-8227 simple_password_check_minimal_length gets adjusted without a warning
Diffstat (limited to 'plugin')
-rw-r--r--plugin/simple_password_check/simple_password_check.c16
1 files changed, 13 insertions, 3 deletions
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 <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,