Commit 83de75d6 authored by Sergei Golubchik's avatar Sergei Golubchik

try harder to link unix_socket plugin statically

fix unix_socket tests to work if unix_socket is a built-in
parent 38bf9319
...@@ -97,20 +97,20 @@ ELSEIF(RPM) ...@@ -97,20 +97,20 @@ ELSEIF(RPM)
SET(CHECKMODULE /usr/bin/checkmodule CACHE STRING "") SET(CHECKMODULE /usr/bin/checkmodule CACHE STRING "")
SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE STRING "") SET(SEMODULE_PACKAGE /usr/bin/semodule_package CACHE STRING "")
SET(WITH_LIBARCHIVE ON CACHE STRING "") SET(WITH_LIBARCHIVE ON CACHE STRING "")
SET(PLUGIN_AUTH_SOCKET YES) SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "")
ELSEIF(DEB) ELSEIF(DEB)
SET(WITH_SSL system CACHE STRING "") SET(WITH_SSL system CACHE STRING "")
SET(WITH_ZLIB system CACHE STRING "") SET(WITH_ZLIB system CACHE STRING "")
SET(WITH_LIBWRAP ON) SET(WITH_LIBWRAP ON)
SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON) SET(HAVE_EMBEDDED_PRIVILEGE_CONTROL ON)
SET(WITH_LIBARCHIVE ON CACHE STRING "") SET(WITH_LIBARCHIVE ON CACHE STRING "")
SET(PLUGIN_AUTH_SOCKET YES) SET(PLUGIN_AUTH_SOCKET YES CACHE STRING "")
ELSE() ELSE()
SET(WITH_SSL bundled CACHE STRING "") SET(WITH_SSL bundled CACHE STRING "")
SET(WITH_ZLIB bundled CACHE STRING "") SET(WITH_ZLIB bundled CACHE STRING "")
SET(WITH_JEMALLOC static CACHE STRING "") SET(WITH_JEMALLOC static CACHE STRING "")
SET(WITH_LIBARCHIVE STATIC CACHE STRING "") SET(WITH_LIBARCHIVE STATIC CACHE STRING "")
SET(PLUGIN_AUTH_SOCKET STATIC) SET(PLUGIN_AUTH_SOCKET STATIC CACHE STRING "")
ENDIF() ENDIF()
IF(NOT COMPILATION_COMMENT) IF(NOT COMPILATION_COMMENT)
......
...@@ -40,7 +40,6 @@ usr/lib/mysql/plugin/auth_ed25519.so ...@@ -40,7 +40,6 @@ usr/lib/mysql/plugin/auth_ed25519.so
usr/lib/mysql/plugin/auth_pam.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_tool_dir/auth_pam_tool
usr/lib/mysql/plugin/auth_pam_v1.so 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/disks.so
usr/lib/mysql/plugin/file_key_management.so usr/lib/mysql/plugin/file_key_management.so
usr/lib/mysql/plugin/ha_archive.so usr/lib/mysql/plugin/ha_archive.so
......
--source include/not_embedded.inc --source include/not_embedded.inc
if (!$AUTH_SOCKET_SO) { if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'unix_socket' and plugin_status='active'`)
skip No unix_socket plugin; {
--skip Needs unix_socket plugin
} }
if (!$USER) { if (!$USER) {
......
--plugin-load-add=$AUTH_SOCKET_SO --loose-enable-unix-socket
update mysql.global_priv set priv=json_insert(priv, '$.plugin', 'unix_socket'); update mysql.global_priv set priv=json_insert(priv, '$.plugin', 'unix_socket');
flush privileges; flush privileges;
connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET); 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'
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')); update mysql.global_priv set priv=json_compact(json_remove(priv, '$.plugin'));
flush privileges; flush privileges;
uninstall plugin unix_socket;
...@@ -11,20 +11,6 @@ flush privileges; ...@@ -11,20 +11,6 @@ flush privileges;
# that matches other parts of the error message. # that matches other parts of the error message.
let $replace=Access denied for user '$USER'; 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); --echo connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET);
--replace_result $replace "Access denied for user 'USER'" --replace_result $replace "Access denied for user 'USER'"
--disable_query_log --disable_query_log
...@@ -32,11 +18,9 @@ flush privileges; ...@@ -32,11 +18,9 @@ flush privileges;
connect (fail,localhost,$USER); connect (fail,localhost,$USER);
--enable_query_log --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 --error ER_ACCESS_DENIED_NO_PASSWORD_ERROR
change_user $USER; change_user $USER;
update mysql.global_priv set priv=json_compact(json_remove(priv, '$.plugin')); update mysql.global_priv set priv=json_compact(json_remove(priv, '$.plugin'));
flush privileges; flush privileges;
uninstall plugin unix_socket;
install soname 'auth_socket';
install soname 'auth_ed25519'; install soname 'auth_ed25519';
create user USER identified via unix_socket OR mysql_native_password as password("GOOD"); 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"); create user mysqltest1 identified via unix_socket OR mysql_native_password as password("good");
...@@ -190,5 +189,4 @@ select user(), current_user(), database(); ...@@ -190,5 +189,4 @@ select user(), current_user(), database();
user() current_user() database() user() current_user() database()
mysqltest1@localhost mysqltest1@% test mysqltest1@localhost mysqltest1@% test
drop user mysqltest1; drop user mysqltest1;
uninstall soname 'auth_socket';
uninstall soname 'auth_ed25519'; uninstall soname 'auth_ed25519';
install plugin unix_socket soname 'auth_socket.so';
# #
# with named user # with named user
# #
...@@ -28,4 +27,3 @@ USER@localhost @% test ...@@ -28,4 +27,3 @@ USER@localhost @% test
# #
delete from mysql.user where user=''; delete from mysql.user where user='';
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
uninstall plugin unix_socket;
...@@ -10,7 +10,6 @@ if (!$AUTH_ED25519_SO) { ...@@ -10,7 +10,6 @@ if (!$AUTH_ED25519_SO) {
} }
--let $plugindir=`SELECT @@global.plugin_dir` --let $plugindir=`SELECT @@global.plugin_dir`
install soname 'auth_socket';
install soname 'auth_ed25519'; install soname 'auth_ed25519';
--let $try_auth=$MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/peercred_test.txt 2>&1 --let $try_auth=$MYSQL_TEST < $MYSQLTEST_VARDIR/tmp/peercred_test.txt 2>&1
...@@ -192,6 +191,5 @@ show create user mysqltest1; ...@@ -192,6 +191,5 @@ show create user mysqltest1;
--exec $try_auth -u mysqltest1 -pworks --plugin-dir=$plugindir/no --exec $try_auth -u mysqltest1 -pworks --plugin-dir=$plugindir/no
drop user mysqltest1; drop user mysqltest1;
uninstall soname 'auth_socket';
uninstall soname 'auth_ed25519'; uninstall soname 'auth_ed25519';
--remove_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt --remove_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt
--source include/have_unix_socket.inc --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 #
--echo # with named user --echo # with named user
--echo # --echo #
...@@ -26,13 +18,13 @@ EOF ...@@ -26,13 +18,13 @@ EOF
--echo # --echo #
--echo # name match = ok --echo # name match = ok
--echo # --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 #
--echo # name does not match = failure --echo # name does not match = failure
--echo # --echo #
--error 1 --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 --let $replace=drop user $USER
--replace_result $replace "drop user USER" --replace_result $replace "drop user USER"
...@@ -45,16 +37,15 @@ grant SELECT ON test.* TO '' identified via unix_socket; ...@@ -45,16 +37,15 @@ grant SELECT ON test.* TO '' identified via unix_socket;
--echo # --echo #
--echo # name match = ok --echo # name match = ok
--echo # --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 #
--echo # name does not match = failure --echo # name does not match = failure
--echo # --echo #
--error 1 --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. # restoring mysql.user to the original state.
delete from mysql.user where user=''; delete from mysql.user where user='';
FLUSH PRIVILEGES; FLUSH PRIVILEGES;
uninstall plugin unix_socket;
--remove_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt --remove_file $MYSQLTEST_VARDIR/tmp/peercred_test.txt
...@@ -65,5 +65,5 @@ ENDIF() ...@@ -65,5 +65,5 @@ ENDIF()
ENDIF() ENDIF()
IF(ok) IF(ok)
MYSQL_ADD_PLUGIN(auth_socket auth_socket.c) MYSQL_ADD_PLUGIN(auth_socket auth_socket.c DEFAULT)
ENDIF() ENDIF()
...@@ -345,7 +345,7 @@ then ...@@ -345,7 +345,7 @@ then
cannot_find_file fill_help_tables.sql @pkgdata_locations@ cannot_find_file fill_help_tables.sql @pkgdata_locations@
exit 1 exit 1
fi 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 pamtooldir=$plugindir
# relative from where the script was run for a relocatable install # 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" elif test -n "$dirname0" -a -x "$rel_mysqld" -a ! "$rel_mysqld" -ef "@sbindir@/mysqld"
......
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