Skip to content

Commit 30a9ac4

Browse files
author
Alexey Botchkov
committed
MDEV-10956 Strict Password Validation Breaks Replication.
strict_password_validation variable now has no effect in the slave thread.
1 parent 3953c55 commit 30a9ac4

File tree

3 files changed

+42
-4
lines changed

3 files changed

+42
-4
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
include/master-slave.inc
2+
[connection master]
3+
install soname "simple_password_check";
4+
select @@strict_password_validation;
5+
@@strict_password_validation
6+
1
7+
create user foo1 identified by password '11111111111111111111111111111111111111111';
8+
set password for foo1 = PASSWORD('PLAINtext-password!!99');
9+
drop user foo1;
10+
create user foo1 identified by password '11111111111111111111111111111111111111111';
11+
ERROR HY000: The MariaDB server is running with the --strict-password-validation option so it cannot execute this statement
12+
uninstall plugin simple_password_check;
13+
include/rpl_end.inc
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
if (!$SIMPLE_PASSWORD_CHECK_SO) {
2+
skip No SIMPLE_PASSWORD_CHECK plugin;
3+
}
4+
5+
--source include/master-slave.inc
6+
7+
8+
--connection slave
9+
install soname "simple_password_check";
10+
select @@strict_password_validation;
11+
12+
--connection master
13+
create user foo1 identified by password '11111111111111111111111111111111111111111';
14+
set password for foo1 = PASSWORD('PLAINtext-password!!99');
15+
drop user foo1;
16+
--sync_slave_with_master
17+
18+
--connection slave
19+
--error ER_OPTION_PREVENTS_STATEMENT
20+
create user foo1 identified by password '11111111111111111111111111111111111111111';
21+
22+
uninstall plugin simple_password_check;
23+
24+
--source include/rpl_end.inc

sql/sql_acl.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ static my_bool do_validate(THD *, plugin_ref plugin, void *arg)
895895
}
896896

897897

898-
static bool validate_password(LEX_USER *user)
898+
static bool validate_password(LEX_USER *user, THD *thd)
899899
{
900900
if (user->pwtext.length || !user->pwhash.length)
901901
{
@@ -911,7 +911,8 @@ static bool validate_password(LEX_USER *user)
911911
}
912912
else
913913
{
914-
if (strict_password_validation && has_validation_plugins())
914+
if (!thd->slave_thread &&
915+
strict_password_validation && has_validation_plugins())
915916
{
916917
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--strict-password-validation");
917918
return true;
@@ -2750,7 +2751,7 @@ bool check_change_password(THD *thd, LEX_USER *user)
27502751
LEX_USER *real_user= get_current_user(thd, user);
27512752

27522753
if (fix_and_copy_user(real_user, user, thd) ||
2753-
validate_password(real_user))
2754+
validate_password(real_user, thd))
27542755
return true;
27552756

27562757
*user= *real_user;
@@ -3465,7 +3466,7 @@ static int replace_user_table(THD *thd, TABLE *table, LEX_USER &combo,
34653466
}
34663467

34673468
if (!old_row_exists || combo.pwtext.length || combo.pwhash.length)
3468-
if (!handle_as_role && validate_password(&combo))
3469+
if (!handle_as_role && validate_password(&combo, thd))
34693470
goto end;
34703471

34713472
/* Update table columns with new privileges */

0 commit comments

Comments
 (0)