mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
plugin renamed socket_peercred -> unix_socket.
test added.
This commit is contained in:
30
mysql-test/suite/plugins/r/unix_socket.result
Normal file
30
mysql-test/suite/plugins/r/unix_socket.result
Normal file
@ -0,0 +1,30 @@
|
||||
install plugin unix_socket soname 'auth_socket.so';
|
||||
#
|
||||
# with named user
|
||||
#
|
||||
create user USER identified via unix_socket;
|
||||
#
|
||||
# name match = ok
|
||||
#
|
||||
select user(), current_user(), database();
|
||||
user() current_user() database()
|
||||
USER@localhost USER@% test
|
||||
#
|
||||
# name does not match = failure
|
||||
#
|
||||
drop user USER;
|
||||
#
|
||||
# and now with anonymous user
|
||||
#
|
||||
grant SELECT ON test.* TO '' identified via unix_socket;
|
||||
#
|
||||
# name match = ok
|
||||
#
|
||||
select user(), current_user(), database();
|
||||
user() current_user() database()
|
||||
USER@localhost @% test
|
||||
#
|
||||
# name does not match = failure
|
||||
#
|
||||
delete from mysql.user where user='';
|
||||
uninstall plugin unix_socket;
|
56
mysql-test/suite/plugins/t/unix_socket.test
Normal file
56
mysql-test/suite/plugins/t/unix_socket.test
Normal file
@ -0,0 +1,56 @@
|
||||
--source include/not_embedded.inc
|
||||
|
||||
if (!$AUTH_SOCKET_SO) {
|
||||
skip No auth_socket plugin;
|
||||
}
|
||||
|
||||
let $plugindir=`SELECT @@global.plugin_dir`;
|
||||
|
||||
eval install plugin unix_socket soname '$AUTH_SOCKET_SO';
|
||||
|
||||
--echo #
|
||||
--echo # with named user
|
||||
--echo #
|
||||
|
||||
--replace_result $USER USER
|
||||
eval create user $USER identified via unix_socket;
|
||||
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt
|
||||
--replace_result $USER USER
|
||||
select user(), current_user(), database();
|
||||
EOF
|
||||
|
||||
--echo #
|
||||
--echo # name match = ok
|
||||
--echo #
|
||||
--exec $MYSQL_TEST -u $USER --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/peercred_test.txt
|
||||
|
||||
--echo #
|
||||
--echo # name does not match = failure
|
||||
--echo #
|
||||
--error 1
|
||||
--exec $MYSQL_TEST -u foobar --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/peercred_test.txt
|
||||
|
||||
--replace_result $USER USER
|
||||
eval drop user $USER;
|
||||
|
||||
--echo #
|
||||
--echo # and now with anonymous user
|
||||
--echo #
|
||||
grant SELECT ON test.* TO '' identified via unix_socket;
|
||||
--echo #
|
||||
--echo # name match = ok
|
||||
--echo #
|
||||
--exec $MYSQL_TEST -u $USER --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/peercred_test.txt
|
||||
|
||||
--echo #
|
||||
--echo # name does not match = failure
|
||||
--echo #
|
||||
--error 1
|
||||
--exec $MYSQL_TEST -u foobar --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/peercred_test.txt
|
||||
|
||||
# restoring mysql.user to the original state.
|
||||
delete from mysql.user where user='';
|
||||
uninstall plugin unix_socket;
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt
|
||||
|
@ -83,27 +83,11 @@ static struct st_mysql_auth socket_auth_handler=
|
||||
socket_auth
|
||||
};
|
||||
|
||||
mysql_declare_plugin(socket_auth)
|
||||
{
|
||||
MYSQL_AUTHENTICATION_PLUGIN,
|
||||
&socket_auth_handler,
|
||||
"socket_peercred",
|
||||
"Sergei Golubchik",
|
||||
"Unix Socket based authentication",
|
||||
PLUGIN_LICENSE_GPL,
|
||||
NULL,
|
||||
NULL,
|
||||
0x0100,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
}
|
||||
mysql_declare_plugin_end;
|
||||
maria_declare_plugin(socket_auth)
|
||||
{
|
||||
MYSQL_AUTHENTICATION_PLUGIN,
|
||||
&socket_auth_handler,
|
||||
"socket_peercred",
|
||||
"unix_socket",
|
||||
"Sergei Golubchik",
|
||||
"Unix Socket based authentication",
|
||||
PLUGIN_LICENSE_GPL,
|
||||
|
Reference in New Issue
Block a user