mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-18151 Skipped error returning for GRANT/SET PASSWORD
Make error issueing for GRANT and SET PASSWORD the same. Report errors wich were skipped before.
This commit is contained in:
@ -461,6 +461,14 @@ create table mysql.host (host char(60) binary default '' not null, db char(64) b
|
|||||||
insert mysql.host values('10.5.0.0/255.255.0.0','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','N');
|
insert mysql.host values('10.5.0.0/255.255.0.0','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','N');
|
||||||
flush privileges;
|
flush privileges;
|
||||||
drop table mysql.host;
|
drop table mysql.host;
|
||||||
#
|
|
||||||
# End of 10.4 tests
|
# End of 10.4 tests
|
||||||
#
|
#
|
||||||
|
# MDEV-18151: Skipped error returning for GRANT/SET PASSWORD
|
||||||
|
#
|
||||||
|
CREATE USER foo@localhost;
|
||||||
|
GRANT FILE ON *.* TO foo@localhost IDENTIFIED VIA not_installed_plugin;
|
||||||
|
ERROR HY000: Plugin 'not_installed_plugin' is not loaded
|
||||||
|
DROP USER foo@localhost;
|
||||||
|
CREATE USER foo@localhost IDENTIFIED VIA not_installed_plugin;
|
||||||
|
ERROR HY000: Plugin 'not_installed_plugin' is not loaded
|
||||||
|
# End of 10.5 tests
|
||||||
|
@ -419,6 +419,20 @@ insert mysql.host values('10.5.0.0/255.255.0.0','','Y','Y','Y','Y','Y','Y','Y','
|
|||||||
flush privileges;
|
flush privileges;
|
||||||
drop table mysql.host;
|
drop table mysql.host;
|
||||||
|
|
||||||
--echo #
|
|
||||||
--echo # End of 10.4 tests
|
--echo # End of 10.4 tests
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
|
--echo # MDEV-18151: Skipped error returning for GRANT/SET PASSWORD
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
CREATE USER foo@localhost;
|
||||||
|
--error ER_PLUGIN_IS_NOT_LOADED
|
||||||
|
GRANT FILE ON *.* TO foo@localhost IDENTIFIED VIA not_installed_plugin;
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
DROP USER foo@localhost;
|
||||||
|
|
||||||
|
--error ER_PLUGIN_IS_NOT_LOADED
|
||||||
|
CREATE USER foo@localhost IDENTIFIED VIA not_installed_plugin;
|
||||||
|
|
||||||
|
--echo # End of 10.5 tests
|
||||||
|
17
mysql-test/main/grant_plugin.result
Normal file
17
mysql-test/main/grant_plugin.result
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#
|
||||||
|
# MDEV-18151: Skipped error returning for GRANT/SET PASSWORD
|
||||||
|
#
|
||||||
|
install soname 'auth_0x0100';
|
||||||
|
CREATE USER foo@localhost IDENTIFIED VIA auth_0x0100;
|
||||||
|
uninstall plugin auth_0x0100;
|
||||||
|
select Priv from mysql.global_priv where User = "foo" and host="localhost"
|
||||||
|
into @priv;
|
||||||
|
Warnings:
|
||||||
|
Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be removed in a future release. Please use 'SELECT <select list> INTO <destination> FROM...' instead
|
||||||
|
SET PASSWORD FOR foo@localhost = "1111";
|
||||||
|
ERROR HY000: Plugin 'auth_0x0100' is not loaded
|
||||||
|
select Priv = @priv as "Nothing changed" from mysql.global_priv where User = "foo" and host="localhost";
|
||||||
|
Nothing changed
|
||||||
|
1
|
||||||
|
DROP USER foo@localhost;
|
||||||
|
# End of 10.5 tests
|
24
mysql-test/main/grant_plugin.test
Normal file
24
mysql-test/main/grant_plugin.test
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
--source include/not_embedded.inc
|
||||||
|
|
||||||
|
if (!$AUTH_0X0100_SO) {
|
||||||
|
skip No auth_0x0100 plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-18151: Skipped error returning for GRANT/SET PASSWORD
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
install soname 'auth_0x0100';
|
||||||
|
CREATE USER foo@localhost IDENTIFIED VIA auth_0x0100;
|
||||||
|
uninstall plugin auth_0x0100;
|
||||||
|
|
||||||
|
select Priv from mysql.global_priv where User = "foo" and host="localhost"
|
||||||
|
into @priv;
|
||||||
|
--error ER_PLUGIN_IS_NOT_LOADED
|
||||||
|
SET PASSWORD FOR foo@localhost = "1111";
|
||||||
|
select Priv = @priv as "Nothing changed" from mysql.global_priv where User = "foo" and host="localhost";
|
||||||
|
|
||||||
|
DROP USER foo@localhost;
|
||||||
|
|
||||||
|
--echo # End of 10.5 tests
|
@ -31,7 +31,7 @@ connect(plug_con,localhost,plug,plug_dest);
|
|||||||
select USER(),CURRENT_USER();
|
select USER(),CURRENT_USER();
|
||||||
|
|
||||||
--echo ## test SET PASSWORD
|
--echo ## test SET PASSWORD
|
||||||
#--error ER_SET_PASSWORD_AUTH_PLUGIN
|
# here we set for native password plugin
|
||||||
SET PASSWORD = PASSWORD('plug_dest');
|
SET PASSWORD = PASSWORD('plug_dest');
|
||||||
|
|
||||||
connection default;
|
connection default;
|
||||||
|
@ -139,6 +139,7 @@ show create user mysqltest1;
|
|||||||
CREATE USER for mysqltest1@%
|
CREATE USER for mysqltest1@%
|
||||||
CREATE USER `mysqltest1`@`%` IDENTIFIED VIA unix_socket OR mysql_native_password USING '*BFE3F4604CFD21E6595080A261D92EF0183B5971'
|
CREATE USER `mysqltest1`@`%` IDENTIFIED VIA unix_socket OR mysql_native_password USING '*BFE3F4604CFD21E6595080A261D92EF0183B5971'
|
||||||
set password for mysqltest1 = password('foobar');
|
set password for mysqltest1 = password('foobar');
|
||||||
|
ERROR HY000: SET PASSWORD is ignored for users authenticating via unix_socket plugin
|
||||||
show create user mysqltest1;
|
show create user mysqltest1;
|
||||||
CREATE USER for mysqltest1@%
|
CREATE USER for mysqltest1@%
|
||||||
CREATE USER `mysqltest1`@`%` IDENTIFIED VIA unix_socket OR mysql_native_password USING '*9B500343BC52E2911172EB52AE5CF4847604C6E5'
|
CREATE USER `mysqltest1`@`%` IDENTIFIED VIA unix_socket OR mysql_native_password USING '*9B500343BC52E2911172EB52AE5CF4847604C6E5'
|
||||||
|
@ -145,6 +145,7 @@ set password for mysqltest1 = password('foobar');
|
|||||||
show create user mysqltest1;
|
show create user mysqltest1;
|
||||||
alter user mysqltest1 identified via unix_socket OR mysql_native_password as password("some");
|
alter user mysqltest1 identified via unix_socket OR mysql_native_password as password("some");
|
||||||
show create user mysqltest1;
|
show create user mysqltest1;
|
||||||
|
--error ER_SET_PASSWORD_AUTH_PLUGIN
|
||||||
set password for mysqltest1 = password('foobar');
|
set password for mysqltest1 = password('foobar');
|
||||||
show create user mysqltest1;
|
show create user mysqltest1;
|
||||||
alter user mysqltest1 identified via unix_socket;
|
alter user mysqltest1 identified via unix_socket;
|
||||||
|
@ -2312,11 +2312,10 @@ static int set_user_auth(THD *thd, const LEX_CSTRING &user,
|
|||||||
|
|
||||||
mysql_mutex_assert_owner(&acl_cache->lock);
|
mysql_mutex_assert_owner(&acl_cache->lock);
|
||||||
|
|
||||||
|
// check for SET PASSWORD
|
||||||
if (!plugin)
|
if (!plugin)
|
||||||
{
|
{
|
||||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
|
my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), plugin_name);
|
||||||
ER_PLUGIN_IS_NOT_LOADED,
|
|
||||||
ER_THD(thd, ER_PLUGIN_IS_NOT_LOADED), plugin_name);
|
|
||||||
return ER_PLUGIN_IS_NOT_LOADED;
|
return ER_PLUGIN_IS_NOT_LOADED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2370,6 +2369,21 @@ static int set_user_auth(THD *thd, const LEX_CSTRING &user,
|
|||||||
|
|
||||||
res= 0;
|
res= 0;
|
||||||
end:
|
end:
|
||||||
|
switch(res)
|
||||||
|
{
|
||||||
|
case ER_OUTOFMEMORY: // should be reported by my_malloc
|
||||||
|
case ER_NOT_VALID_PASSWORD: // should be reported by plugin
|
||||||
|
case ER_PASSWD_LENGTH: // should be reported by plugin
|
||||||
|
DBUG_ASSERT(thd->is_error());
|
||||||
|
/* fall through*/
|
||||||
|
case 0:
|
||||||
|
break;
|
||||||
|
case ER_SET_PASSWORD_AUTH_PLUGIN:
|
||||||
|
my_error(res, MYF(0), plugin_name);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
DBUG_ASSERT(0);
|
||||||
|
}
|
||||||
if (unlock_plugin)
|
if (unlock_plugin)
|
||||||
plugin_unlock(thd, plugin);
|
plugin_unlock(thd, plugin);
|
||||||
return res;
|
return res;
|
||||||
|
Reference in New Issue
Block a user