| 1 |
--source include/not_embedded.inc |
| 2 |
|
| 3 |
if (!$SIMPLE_PASSWORD_CHECK_SO) { |
| 4 |
skip No SIMPLE_PASSWORD_CHECK plugin; |
| 5 |
} |
| 6 |
|
| 7 |
install soname "simple_password_check"; |
| 8 |
|
| 9 |
--vertical_results |
| 10 |
--replace_result .dll .so |
| 11 |
select * from information_schema.plugins where plugin_name='simple_password_check'; |
| 12 |
|
| 13 |
select * from information_schema.system_variables where variable_name like 'simple_password_check%' order by 1; |
| 14 |
--horizontal_results |
| 15 |
|
| 16 |
--error ER_NOT_VALID_PASSWORD |
| 17 |
create user foo1 identified by 'pwd'; |
| 18 |
show warnings; |
| 19 |
|
| 20 |
# Create user with no password. |
| 21 |
--error ER_NOT_VALID_PASSWORD |
| 22 |
create user foo1; |
| 23 |
show warnings; |
| 24 |
|
| 25 |
--error ER_NOT_VALID_PASSWORD |
| 26 |
grant select on *.* to foo1 identified by 'pwd'; |
| 27 |
show warnings; |
| 28 |
|
| 29 |
--error ER_NOT_VALID_PASSWORD |
| 30 |
grant select on *.* to `FooBar1!` identified by 'FooBar1!'; |
| 31 |
show warnings; |
| 32 |
|
| 33 |
grant select on *.* to `BarFoo1!` identified by 'FooBar1!'; |
| 34 |
drop user `BarFoo1!`; |
| 35 |
|
| 36 |
create user foo1 identified by 'aA.12345'; |
| 37 |
grant select on *.* to foo1; |
| 38 |
drop user foo1; |
| 39 |
|
| 40 |
set global simple_password_check_digits=3; |
| 41 |
set global simple_password_check_letters_same_case=3; |
| 42 |
set global simple_password_check_other_characters=3; |
| 43 |
show variables like 'simple_password_check_%'; |
| 44 |
|
| 45 |
create user foo1 identified by '123:qwe:ASD!'; |
| 46 |
drop user foo1; |
| 47 |
|
| 48 |
--error ER_NOT_VALID_PASSWORD |
| 49 |
create user foo1 identified by '-23:qwe:ASD!'; |
| 50 |
show warnings; |
| 51 |
|
| 52 |
--error ER_NOT_VALID_PASSWORD |
| 53 |
create user foo1 identified by '123:4we:ASD!'; |
| 54 |
show warnings; |
| 55 |
|
| 56 |
--error ER_NOT_VALID_PASSWORD |
| 57 |
create user foo1 identified by '123:qwe:4SD!'; |
| 58 |
show warnings; |
| 59 |
|
| 60 |
--error ER_NOT_VALID_PASSWORD |
| 61 |
create user foo1 identified by '123:qwe:ASD4'; |
| 62 |
show warnings; |
| 63 |
|
| 64 |
create user foo1 identified by '123:qwe:ASD!'; |
| 65 |
--error ER_NOT_VALID_PASSWORD |
| 66 |
set password for foo1 = password('qwe:-23:ASD!'); |
| 67 |
show warnings; |
| 68 |
--error ER_NOT_VALID_PASSWORD |
| 69 |
set password for foo1 = old_password('4we:123:ASD!'); |
| 70 |
--error ER_NOT_VALID_PASSWORD |
| 71 |
set password for foo1 = password('qwe:123:4SD!'); |
| 72 |
show warnings; |
| 73 |
--error ER_NOT_VALID_PASSWORD |
| 74 |
set password for foo1 = old_password('qwe:123:ASD4'); |
| 75 |
show warnings; |
| 76 |
set password for foo1 = password('qwe:123:ASD!'); |
| 77 |
|
| 78 |
# now, strict_password_validation |
| 79 |
select @@strict_password_validation; |
| 80 |
|
| 81 |
--error ER_NOT_VALID_PASSWORD |
| 82 |
set password for foo1 = ''; |
| 83 |
show warnings; |
| 84 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 85 |
set password for foo1 = '2222222222222222'; |
| 86 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 87 |
set password for foo1 = '11111111111111111111111111111111111111111'; |
| 88 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 89 |
create user foo2 identified by password '11111111111111111111111111111111111111111'; |
| 90 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 91 |
grant select on *.* to foo2 identified by password '2222222222222222'; |
| 92 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 93 |
create user foo2 identified with mysql_native_password using '11111111111111111111111111111111111111111'; |
| 94 |
--error ER_OPTION_PREVENTS_STATEMENT |
| 95 |
grant select on *.* to foo2 identified with mysql_old_password using '2222222222222222'; |
| 96 |
--error ER_NOT_VALID_PASSWORD |
| 97 |
create user foo2 identified with mysql_native_password using ''; |
| 98 |
show warnings; |
| 99 |
--error ER_NOT_VALID_PASSWORD |
| 100 |
grant select on *.* to foo2 identified with mysql_old_password using ''; |
| 101 |
--error ER_NOT_VALID_PASSWORD |
| 102 |
grant select on *.* to foo2 identified with mysql_old_password; |
| 103 |
|
| 104 |
# direct updates are not protected |
| 105 |
update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'xxx') where user='foo1'; |
| 106 |
|
| 107 |
set global strict_password_validation=0; |
| 108 |
|
| 109 |
--error ER_NOT_VALID_PASSWORD |
| 110 |
set password for foo1 = ''; |
| 111 |
show warnings; |
| 112 |
set password for foo1 = '2222222222222222'; |
| 113 |
set password for foo1 = '11111111111111111111111111111111111111111'; |
| 114 |
create user foo2 identified by password '11111111111111111111111111111111111111111'; |
| 115 |
drop user foo2; |
| 116 |
grant select on *.* to foo2 identified by password '2222222222222222'; |
| 117 |
drop user foo2; |
| 118 |
create user foo2 identified with mysql_native_password using '11111111111111111111111111111111111111111'; |
| 119 |
drop user foo2; |
| 120 |
grant select on *.* to foo2 identified with mysql_old_password using '2222222222222222'; |
| 121 |
drop user foo2; |
| 122 |
|
| 123 |
set global strict_password_validation=1; |
| 124 |
drop user foo1; |
| 125 |
|
| 126 |
# |
| 127 |
# MDEV-9940 CREATE ROLE blocked by password validation plugin |
| 128 |
# |
| 129 |
create role r1; |
| 130 |
drop role r1; |
| 131 |
|
| 132 |
flush privileges; |
| 133 |
|
| 134 |
uninstall plugin simple_password_check; |
| 135 |
|
| 136 |
create user foo1 identified by 'pwd'; |
| 137 |
drop user foo1; |
| 138 |
|
| 139 |
--echo # |
| 140 |
--echo # MDEV-26650: Failed ALTER USER/GRANT statement removes the |
| 141 |
--echo # password from the cache |
| 142 |
--echo # |
| 143 |
create user foo1@localhost identified by '<GDFH:3ghj'; |
| 144 |
show grants for foo1@localhost; |
| 145 |
install soname "simple_password_check"; |
| 146 |
--error ER_CANNOT_USER |
| 147 |
ALTER USER foo1@localhost identified by 'foo1'; |
| 148 |
show grants for foo1@localhost; |
| 149 |
flush privileges; |
| 150 |
show grants for foo1@localhost; |
| 151 |
drop user foo1@localhost; |
| 152 |
uninstall plugin simple_password_check; |
| 153 |
|
| 154 |
|
| 155 |
--echo # |
| 156 |
--echo # MDEV-22418 mysqladmin wrong error with simple_password_check |
| 157 |
--echo # |
| 158 |
|
| 159 |
install soname "simple_password_check"; |
| 160 |
|
| 161 |
--replace_regex /.*[\/\\]// /(mysqladmin|mariadb-admin)(\.exe)?/MARIADB-ADMIN/ |
| 162 |
--error 1 |
| 163 |
--exec $MYSQLADMIN -uroot password foo 2>&1 |
| 164 |
|
| 165 |
--echo # All done |
| 166 |
uninstall plugin simple_password_check; |
| 167 |
|
| 168 |
--echo # End of 10.4 tests |
| 169 |
|
| 170 |
--echo # |
| 171 |
--echo # MDEV-30190 Password check plugin prevents changing grants for CURRENT_USER |
| 172 |
--echo # |
| 173 |
select priv into @old_priv from mysql.global_priv where user='root' and host='localhost'; |
| 174 |
install soname "simple_password_check"; |
| 175 |
grant all on db1.* to current_user; |
| 176 |
select current_user; |
| 177 |
show grants; |
| 178 |
revoke all on db1.* from current_user; |
| 179 |
uninstall plugin simple_password_check; |
| 180 |
#cleanup |
| 181 |
update mysql.global_priv set priv=@old_priv where user='root' and host='localhost'; |
| 182 |
|
| 183 |
--echo # End of 10.11 tests |