Skip to content

Commit b1daecf

Browse files
committed
MDEV-30190 Password check plugin prevents changing grants for CURRENT_USER
CURRENT_USER should not initialize $$->auth, just like explicitly specified user name doesn't.
1 parent aef0468 commit b1daecf

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,22 @@ install soname "simple_password_check";
261261
MARIADB-ADMIN: unable to change password; error: 'The MariaDB server is running with the --strict-password-validation option so it cannot execute this statement'
262262
# All done
263263
uninstall plugin simple_password_check;
264-
#
265264
# End of 10.4 tests
266265
#
266+
# MDEV-30190 Password check plugin prevents changing grants for CURRENT_USER
267+
#
268+
select priv into @old_priv from mysql.global_priv where user='root' and host='localhost';
269+
install soname "simple_password_check";
270+
grant all on db1.* to current_user;
271+
select current_user;
272+
current_user
273+
root@localhost
274+
show grants;
275+
Grants for root@localhost
276+
GRANT ALL PRIVILEGES ON *.* TO `root`@`localhost` WITH GRANT OPTION
277+
GRANT ALL PRIVILEGES ON `db1`.* TO `root`@`localhost`
278+
GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION
279+
revoke all on db1.* from current_user;
280+
uninstall plugin simple_password_check;
281+
update mysql.global_priv set priv=@old_priv where user='root' and host='localhost';
282+
# End of 10.11 tests

mysql-test/suite/plugins/t/simple_password_check.test

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,19 @@ install soname "simple_password_check";
165165
--echo # All done
166166
uninstall plugin simple_password_check;
167167

168-
--echo #
169168
--echo # End of 10.4 tests
169+
170+
--echo #
171+
--echo # MDEV-30190 Password check plugin prevents changing grants for CURRENT_USER
170172
--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

sql/sql_yacc.yy

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15505,7 +15505,6 @@ user_maybe_role:
1550515505
if (unlikely(!($$=(LEX_USER*)thd->calloc(sizeof(LEX_USER)))))
1550615506
MYSQL_YYABORT;
1550715507
$$->user= current_user;
15508-
$$->auth= new (thd->mem_root) USER_AUTH();
1550915508
}
1551015509
;
1551115510

0 commit comments

Comments
 (0)