try harder to link unix_socket plugin statically

fix unix_socket tests to work if unix_socket is a built-in
This commit is contained in:
Sergei Golubchik 2019-02-19 01:04:56 +01:00
parent 38bf9319a4
commit 83de75d66d
12 changed files with 14 additions and 50 deletions

View file

@ -97,20 +97,20 @@ ELSEIF(RPM)
SET(CHECKMODULE /usr/bin/checkmodule CACHE STRING "")
SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE STRING "")
SET(WITH_LIBARCHIVE ON CACHE STRING "")
SET(PLUGIN_AUTH_SOCKET YES)
SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "")
ELSEIF(DEB)
SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "")
SET(WITH_LIBWRAP ON)
SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON)
SET(WITH_LIBARCHIVE ON CACHE STRING "")
SET(PLUGIN_AUTH_SOCKET YES)
SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "")
ELSE()
SET(WITH_SSL bundled CACHE STRING "")
SET(WITH_ZLIB bundled CACHE STRING "")
SET(WITH_JEMALLOC static CACHE STRING "")
SET(WITH_LIBARCHIVE STATIC CACHE STRING "")
SET(PLUGIN_AUTH_SOCKET STATIC)
SET(PLUGIN_AUTH_SOCKET STATIC CACHE STRING "")
ENDIF()
IF(NOT COMPILATION_COMMENT)

View file

@ -40,7 +40,6 @@ usr/lib/mysql/plugin/auth_ed25519.so
usr/lib/mysql/plugin/auth_pam.so
usr/lib/mysql/plugin/auth_pam_tool_dir/auth_pam_tool
usr/lib/mysql/plugin/auth_pam_v1.so
usr/lib/mysql/plugin/auth_socket.so
usr/lib/mysql/plugin/disks.so
usr/lib/mysql/plugin/file_key_management.so
usr/lib/mysql/plugin/ha_archive.so

View file

@ -1,7 +1,8 @@
--source include/not_embedded.inc
if (!$AUTH_SOCKET_SO) {
skip No unix_socket plugin;
if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'unix_socket' and plugin_status='active'`)
{
--skip Needs unix_socket plugin
}
if (!$USER) {

View file

@ -0,0 +1 @@
--plugin-load-add=$AUTH_SOCKET_SO --loose-enable-unix-socket

View file

@ -1,13 +1,7 @@
update mysql.global_priv set priv=json_insert(priv, '$.plugin', 'unix_socket');
flush privileges;
connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET);
ERROR HY000: Plugin 'unix_socket' is not loaded
ERROR HY000: Plugin 'unix_socket' is not loaded
install plugin unix_socket soname 'auth_socket.so';
flush privileges;
connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET);
ERROR 28000: Access denied for user 'USER'@'localhost'
ERROR 28000: Access denied for user 'USER'@'localhost'
update mysql.global_priv set priv=json_compact(json_remove(priv, '$.plugin'));
flush privileges;
uninstall plugin unix_socket;

View file

@ -11,20 +11,6 @@ flush privileges;
# that matches other parts of the error message.
let $replace=Access denied for user '$USER';
--echo connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET);
--replace_result $replace "Access denied for user 'USER'"
--disable_query_log
--error ER_PLUGIN_IS_NOT_LOADED
connect (fail,localhost,$USER);
--enable_query_log
--replace_result $replace "Access denied for user 'USER'"
--error ER_PLUGIN_IS_NOT_LOADED
change_user $USER;
eval install plugin unix_socket soname '$AUTH_SOCKET_SO';
flush privileges;
--echo connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET);
--replace_result $replace "Access denied for user 'USER'"
--disable_query_log
@ -32,11 +18,9 @@ flush privileges;
connect (fail,localhost,$USER);
--enable_query_log
--replace_result $replace "Access denied for user 'USER'"
--replace_result $replace "Access denied for user 'USER'"
--error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
change_user $USER;
update mysql.global_priv set priv=json_compact(json_remove(priv, '$.plugin'));
flush privileges;
uninstall plugin unix_socket;

View file

@ -1,4 +1,3 @@
install soname 'auth_socket';
install soname 'auth_ed25519';
create user USER identified via unix_socket OR mysql_native_password as password("GOOD");
create user mysqltest1 identified via unix_socket OR mysql_native_password as password("good");
@ -190,5 +189,4 @@ select user(), current_user(), database();
user() current_user() database()
mysqltest1@localhost mysqltest1@% test
drop user mysqltest1;
uninstall soname 'auth_socket';
uninstall soname 'auth_ed25519';

View file

@ -1,4 +1,3 @@
install plugin unix_socket soname 'auth_socket.so';
#
# with named user
#
@ -28,4 +27,3 @@ USER@localhost @% test
#
delete from mysql.user where user='';
FLUSH PRIVILEGES;
uninstall plugin unix_socket;

View file

@ -10,7 +10,6 @@ if (!$AUTH_ED25519_SO) {
}
--let $plugindir=`SELECT @@global.plugin_dir`
install soname 'auth_socket';
install soname 'auth_ed25519';
--let $try_auth=$MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/peercred_test.txt 2>&1
@ -192,6 +191,5 @@ show create user mysqltest1;
--exec $try_auth -u mysqltest1 -pworks --plugin-dir=$plugindir/no
drop user mysqltest1;
uninstall soname 'auth_socket';
uninstall soname 'auth_ed25519';
--remove_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt

View file

@ -1,13 +1,5 @@
--source include/have_unix_socket.inc
if (!$USER) {
skip USER variable is undefined;
}
let $plugindir=`SELECT @@global.plugin_dir`;
eval install plugin unix_socket soname '$AUTH_SOCKET_SO';
--echo #
--echo # with named user
--echo #
@ -26,13 +18,13 @@ EOF
--echo #
--echo # name match = ok
--echo #
--exec $MYSQL_TEST -u $USER --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/peercred_test.txt
--exec $MYSQL_TEST -u $USER < $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
--exec $MYSQL_TEST -u foobar < $MYSQLTEST_VARDIR/tmp/peercred_test.txt
--let $replace=drop user $USER
--replace_result $replace "drop user USER"
@ -45,16 +37,15 @@ 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
--exec $MYSQL_TEST -u $USER < $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
--exec $MYSQL_TEST -u foobar < $MYSQLTEST_VARDIR/tmp/peercred_test.txt
# restoring mysql.user to the original state.
delete from mysql.user where user='';
FLUSH PRIVILEGES;
uninstall plugin unix_socket;
--remove_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt

View file

@ -65,5 +65,5 @@ ENDIF()
ENDIF()
IF(ok)
MYSQL_ADD_PLUGIN(auth_socket auth_socket.c)
MYSQL_ADD_PLUGIN(auth_socket auth_socket.c DEFAULT)
ENDIF()

View file

@ -345,7 +345,7 @@ then
cannot_find_file fill_help_tables.sql @pkgdata_locations@
exit 1
fi
plugindir=`find_in_dirs --dir auth_socket.so $basedir/lib*/plugin $basedir/lib*/mysql/plugin`
plugindir=`find_in_dirs --dir auth_pam.so $basedir/lib*/plugin $basedir/lib*/mysql/plugin`
pamtooldir=$plugindir
# relative from where the script was run for a relocatable install
elif test -n "$dirname0" -a -x "$rel_mysqld" -a ! "$rel_mysqld" -ef "@sbindir@/mysqld"