Skip to content

Commit cc6bba0

Browse files
committed
MDEV-26647 (plugin name) Include password validation plugin information in the error message if the SQL statement is not satisfied password policy
Add plugin name to the error message.
1 parent 0ee1082 commit cc6bba0

File tree

6 files changed

+37
-32
lines changed

6 files changed

+37
-32
lines changed

mysql-test/suite/plugins/r/binlog-simple_plugin_check.result

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ simple_password_check
88
#
99
CREATE USER user1@localhost IDENTIFIED BY 'BsG9#9.cem#!85';
1010
CREATE USER user2@localhost IDENTIFIED BY 'bsg9#d.cem#!85';
11-
ERROR HY000: Your password does not satisfy the current policy requirements
11+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
1212
DROP USER user1@localhost;
1313
include/show_binlog_events.inc
1414
Log_name Pos Event_type Server_id End_log_pos Info

mysql-test/suite/plugins/r/cracklib_password_check.result

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,37 +14,37 @@ LOAD_OPTION ON
1414
PLUGIN_MATURITY Stable
1515
PLUGIN_AUTH_VERSION 1.0
1616
grant select on *.* to foocar identified by 'foocar';
17-
ERROR HY000: Your password does not satisfy the current policy requirements
17+
ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check)
1818
show warnings;
1919
Level Code Message
2020
Warning 1819 cracklib: it is based on your username
21-
Error 1819 Your password does not satisfy the current policy requirements
21+
Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check)
2222
grant select on *.* to foocar identified by 'racoof';
23-
ERROR HY000: Your password does not satisfy the current policy requirements
23+
ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check)
2424
show warnings;
2525
Level Code Message
2626
Warning 1819 cracklib: it is based on your username
27-
Error 1819 Your password does not satisfy the current policy requirements
27+
Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check)
2828
grant select on *.* to foo@barbar identified by 'barbar';
29-
ERROR HY000: Your password does not satisfy the current policy requirements
29+
ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check)
3030
show warnings;
3131
Level Code Message
3232
Warning 1819 cracklib: it does not contain enough DIFFERENT characters
33-
Error 1819 Your password does not satisfy the current policy requirements
33+
Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check)
3434
grant select on *.* to foobar identified by 'qwerty';
35-
ERROR HY000: Your password does not satisfy the current policy requirements
35+
ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check)
3636
show warnings;
3737
Level Code Message
3838
Warning 1819 cracklib: it is based on a dictionary word
39-
Error 1819 Your password does not satisfy the current policy requirements
39+
Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check)
4040
grant select on *.* to foobar identified by 'q$%^&*rty';
4141
drop user foobar;
4242
#
4343
# MDEV-9851: CREATE USER w/o IDENTIFIED BY clause causes crash
4444
# when using cracklib plugin
4545
#
4646
create user 'newuser'@'localhost';
47-
ERROR HY000: Your password does not satisfy the current policy requirements
47+
ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check)
4848
uninstall plugin cracklib_password_check;
4949
create user foo1 identified by 'pwd';
5050
drop user foo1;

mysql-test/suite/plugins/r/simple_password_check.result

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ ENUM_VALUE_LIST NULL
7171
READ_ONLY NO
7272
COMMAND_LINE_ARGUMENT REQUIRED
7373
create user foo1 identified by 'pwd';
74-
ERROR HY000: Your password does not satisfy the current policy requirements
74+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
7575
create user foo1;
76-
ERROR HY000: Your password does not satisfy the current policy requirements
76+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
7777
grant select on *.* to foo1 identified by 'pwd';
78-
ERROR HY000: Your password does not satisfy the current policy requirements
78+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
7979
grant select on *.* to `FooBar1!` identified by 'FooBar1!';
80-
ERROR HY000: Your password does not satisfy the current policy requirements
80+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
8181
grant select on *.* to `BarFoo1!` identified by 'FooBar1!';
8282
drop user `BarFoo1!`;
8383
create user foo1 identified by 'aA.12345';
@@ -99,28 +99,28 @@ simple_password_check_other_characters 3
9999
create user foo1 identified by '123:qwe:ASD!';
100100
drop user foo1;
101101
create user foo1 identified by '-23:qwe:ASD!';
102-
ERROR HY000: Your password does not satisfy the current policy requirements
102+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
103103
create user foo1 identified by '123:4we:ASD!';
104-
ERROR HY000: Your password does not satisfy the current policy requirements
104+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
105105
create user foo1 identified by '123:qwe:4SD!';
106-
ERROR HY000: Your password does not satisfy the current policy requirements
106+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
107107
create user foo1 identified by '123:qwe:ASD4';
108-
ERROR HY000: Your password does not satisfy the current policy requirements
108+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
109109
create user foo1 identified by '123:qwe:ASD!';
110110
set password for foo1 = password('qwe:-23:ASD!');
111-
ERROR HY000: Your password does not satisfy the current policy requirements
111+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
112112
set password for foo1 = old_password('4we:123:ASD!');
113-
ERROR HY000: Your password does not satisfy the current policy requirements
113+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
114114
set password for foo1 = password('qwe:123:4SD!');
115-
ERROR HY000: Your password does not satisfy the current policy requirements
115+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
116116
set password for foo1 = old_password('qwe:123:ASD4');
117-
ERROR HY000: Your password does not satisfy the current policy requirements
117+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
118118
set password for foo1 = password('qwe:123:ASD!');
119119
select @@strict_password_validation;
120120
@@strict_password_validation
121121
1
122122
set password for foo1 = '';
123-
ERROR HY000: Your password does not satisfy the current policy requirements
123+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
124124
set password for foo1 = '2222222222222222';
125125
ERROR HY000: The MariaDB server is running with the --strict-password-validation option so it cannot execute this statement
126126
set password for foo1 = '11111111111111111111111111111111111111111';
@@ -134,13 +134,13 @@ ERROR HY000: The MariaDB server is running with the --strict-password-validation
134134
grant select on *.* to foo2 identified with mysql_old_password using '2222222222222222';
135135
ERROR HY000: The MariaDB server is running with the --strict-password-validation option so it cannot execute this statement
136136
create user foo2 identified with mysql_native_password using '';
137-
ERROR HY000: Your password does not satisfy the current policy requirements
137+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
138138
grant select on *.* to foo2 identified with mysql_old_password;
139139
ERROR 28000: Can't find any matching row in the user table
140140
update mysql.user set password='xxx' where user='foo1';
141141
set global strict_password_validation=0;
142142
set password for foo1 = '';
143-
ERROR HY000: Your password does not satisfy the current policy requirements
143+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
144144
set password for foo1 = '2222222222222222';
145145
set password for foo1 = '11111111111111111111111111111111111111111';
146146
create user foo2 identified by password '11111111111111111111111111111111111111111';

mysql-test/suite/plugins/r/two_password_validations.result

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ install soname "cracklib_password_check";
55
grant select on *.* to foobar identified by 'q$%^&*R1234ty';
66
drop user foobar;
77
grant select on *.* to Fff_fff1 identified by '1fff_ffF';
8-
ERROR HY000: Your password does not satisfy the current policy requirements
8+
ERROR HY000: Your password does not satisfy the current policy requirements (cracklib_password_check)
99
show warnings;
1010
Level Code Message
1111
Warning 1819 cracklib: it does not contain enough DIFFERENT characters
12-
Error 1819 Your password does not satisfy the current policy requirements
12+
Error 1819 Your password does not satisfy the current policy requirements (cracklib_password_check)
1313
grant select on *.* to foobar identified by 'q-%^&*rty';
14-
ERROR HY000: Your password does not satisfy the current policy requirements
14+
ERROR HY000: Your password does not satisfy the current policy requirements (simple_password_check)
1515
show warnings;
1616
Level Code Message
17-
Error 1819 Your password does not satisfy the current policy requirements
17+
Error 1819 Your password does not satisfy the current policy requirements (simple_password_check)
1818
uninstall plugin simple_password_check;
1919
grant select on *.* to foobar identified by 'q-%^&*rty';
2020
drop user foobar;

sql/share/errmsg-utf8.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6925,7 +6925,8 @@ ER_INVALID_YEAR_COLUMN_LENGTH
69256925
rus "Тип YEAR(%lu) более не поддерживается, вместо него будет создана колонка с типом YEAR(4)"
69266926

69276927
ER_NOT_VALID_PASSWORD
6928-
eng "Your password does not satisfy the current policy requirements"
6928+
eng "Your password does not satisfy the current policy requirements (%s)"
6929+
ukr "Ваш пароль не відповідає поточним правилам (%s)"
69296930

69306931
ER_MUST_CHANGE_PASSWORD
69316932
eng "You must SET PASSWORD before executing this statement"

sql/sql_acl.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,7 +1450,12 @@ static my_bool do_validate(THD *, plugin_ref plugin, void *arg)
14501450
struct validation_data *data= (struct validation_data *)arg;
14511451
struct st_mariadb_password_validation *handler=
14521452
(st_mariadb_password_validation *)plugin_decl(plugin)->info;
1453-
return handler->validate_password(data->user, data->password);
1453+
if (handler->validate_password(data->user, data->password))
1454+
{
1455+
my_error(ER_NOT_VALID_PASSWORD, MYF(0), plugin_ref_to_int(plugin)->name.str);
1456+
return true;
1457+
}
1458+
return false;
14541459
}
14551460

14561461

@@ -1464,7 +1469,6 @@ static bool validate_password(LEX_USER *user, THD *thd)
14641469
if (plugin_foreach(NULL, do_validate,
14651470
MariaDB_PASSWORD_VALIDATION_PLUGIN, &data))
14661471
{
1467-
my_error(ER_NOT_VALID_PASSWORD, MYF(0));
14681472
return true;
14691473
}
14701474
}

0 commit comments

Comments
 (0)