Commit b8b7b4eb authored by Sergei Golubchik's avatar Sergei Golubchik

plugin renamed socket_peercred -> unix_socket.

test added.
parent 1417606b
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;
--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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment