diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result index 9407c17f52e..817a58e6ec2 100644 --- a/mysql-test/main/grant5.result +++ b/mysql-test/main/grant5.result @@ -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'); flush privileges; drop table mysql.host; -# # 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 diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test index a7b82f454dc..48cc3087ffc 100644 --- a/mysql-test/main/grant5.test +++ b/mysql-test/main/grant5.test @@ -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; drop table mysql.host; ---echo # --echo # End of 10.4 tests + --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 diff --git a/mysql-test/main/grant_plugin.result b/mysql-test/main/grant_plugin.result new file mode 100644 index 00000000000..bf5b42b28b6 --- /dev/null +++ b/mysql-test/main/grant_plugin.result @@ -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 ' INTO 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 diff --git a/mysql-test/main/grant_plugin.test b/mysql-test/main/grant_plugin.test new file mode 100644 index 00000000000..610176b0ce7 --- /dev/null +++ b/mysql-test/main/grant_plugin.test @@ -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 diff --git a/mysql-test/main/plugin_auth.test b/mysql-test/main/plugin_auth.test index 6912462066c..54d4b6637cb 100644 --- a/mysql-test/main/plugin_auth.test +++ b/mysql-test/main/plugin_auth.test @@ -31,7 +31,7 @@ connect(plug_con,localhost,plug,plug_dest); select USER(),CURRENT_USER(); --echo ## test SET PASSWORD -#--error ER_SET_PASSWORD_AUTH_PLUGIN +# here we set for native password plugin SET PASSWORD = PASSWORD('plug_dest'); connection default; diff --git a/mysql-test/suite/plugins/r/multiauth.result b/mysql-test/suite/plugins/r/multiauth.result index d1ecd600d84..07238b0940d 100644 --- a/mysql-test/suite/plugins/r/multiauth.result +++ b/mysql-test/suite/plugins/r/multiauth.result @@ -139,6 +139,7 @@ show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA unix_socket OR mysql_native_password USING '*BFE3F4604CFD21E6595080A261D92EF0183B5971' set password for mysqltest1 = password('foobar'); +ERROR HY000: SET PASSWORD is ignored for users authenticating via unix_socket plugin show create user mysqltest1; CREATE USER for mysqltest1@% CREATE USER `mysqltest1`@`%` IDENTIFIED VIA unix_socket OR mysql_native_password USING '*9B500343BC52E2911172EB52AE5CF4847604C6E5' diff --git a/mysql-test/suite/plugins/t/multiauth.test b/mysql-test/suite/plugins/t/multiauth.test index 86c98a5d5c3..8f8a093e401 100644 --- a/mysql-test/suite/plugins/t/multiauth.test +++ b/mysql-test/suite/plugins/t/multiauth.test @@ -145,6 +145,7 @@ set password for mysqltest1 = password('foobar'); show create user mysqltest1; alter user mysqltest1 identified via unix_socket OR mysql_native_password as password("some"); show create user mysqltest1; +--error ER_SET_PASSWORD_AUTH_PLUGIN set password for mysqltest1 = password('foobar'); show create user mysqltest1; alter user mysqltest1 identified via unix_socket; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index d0fa2ff9c1f..cd579be8010 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -2312,11 +2312,10 @@ static int set_user_auth(THD *thd, const LEX_CSTRING &user, mysql_mutex_assert_owner(&acl_cache->lock); + // check for SET PASSWORD if (!plugin) { - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_PLUGIN_IS_NOT_LOADED, - ER_THD(thd, ER_PLUGIN_IS_NOT_LOADED), plugin_name); + my_error(ER_PLUGIN_IS_NOT_LOADED, MYF(0), plugin_name); return ER_PLUGIN_IS_NOT_LOADED; } @@ -2370,6 +2369,21 @@ static int set_user_auth(THD *thd, const LEX_CSTRING &user, res= 0; 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) plugin_unlock(thd, plugin); return res;