mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
PAM plugin with test
This commit is contained in:
46
mysql-test/suite/plugins/t/pam.test
Normal file
46
mysql-test/suite/plugins/t/pam.test
Normal file
@ -0,0 +1,46 @@
|
||||
|
||||
--source include/not_embedded.inc
|
||||
|
||||
if (!$AUTH_PAM_SO) {
|
||||
skip No pam auth plugin;
|
||||
}
|
||||
|
||||
if (!$PAM_SETUP_FOR_MTR) {
|
||||
skip No pam setup for mtr;
|
||||
}
|
||||
|
||||
--replace_result .dll .so
|
||||
eval install plugin pam soname '$AUTH_PAM_SO';
|
||||
create user test_pam identified via pam using 'mariadb_mtr';
|
||||
|
||||
let $plugindir=`SELECT @@global.plugin_dir`;
|
||||
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/pam_good.txt
|
||||
not very secret challenge
|
||||
9225
|
||||
select user(), current_user(), database();
|
||||
EOF
|
||||
|
||||
--write_file $MYSQLTEST_VARDIR/tmp/pam_bad.txt
|
||||
not very secret challenge
|
||||
9224
|
||||
select user(), current_user(), database();
|
||||
EOF
|
||||
|
||||
--echo #
|
||||
--echo # athentication is successful, challenge/pin are ok
|
||||
--echo # note that current_user() differts from user()
|
||||
--echo #
|
||||
--exec $MYSQL_TEST -u test_pam --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/pam_good.txt
|
||||
|
||||
--echo #
|
||||
--echo # athentication is unsuccessful
|
||||
--echo #
|
||||
--error 1
|
||||
--exec $MYSQL_TEST -u test_pam --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/pam_bad.txt
|
||||
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/pam_good.txt
|
||||
--remove_file $MYSQLTEST_VARDIR/tmp/pam_bad.txt
|
||||
drop user test_pam;
|
||||
uninstall plugin pam;
|
||||
|
Reference in New Issue
Block a user