1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-19878 pam v2: pam password authentication doesn't work at all

* wait() for the child process to die, let it rest in peace
* fix incorrect parentheses
* if there was no password on the command line or in .cnf file,
  pkt will be "", and we need to request the user to enter the password
* make sure that auth->salt is always allocated on a permanent memroot.
  when called from set_user_salt_if_needed(), user_copy and its auth_str
  are on the thd memroot, but auth_copy->salt is then copied to auth->salt
* adjust service files so that systemd wouldn't interfere with our
  setuid executables

also
* print the pam error message in debug mode
This commit is contained in:
Sergei Golubchik
2019-06-30 20:41:26 +02:00
parent ec494cb1fa
commit dd93028dae
8 changed files with 76 additions and 21 deletions

View File

@ -7,9 +7,9 @@ grant proxy on pam_test to test_pam;
# note that current_user() differs from user()
#
Challenge input first.
Enter: not very secret challenge
Enter: *************************
Now, the magic number!
PIN: ****
PIN: 9225
select user(), current_user(), database();
user() current_user() database()
test_pam@localhost pam_test@% test
@ -17,16 +17,29 @@ test_pam@localhost pam_test@% test
# athentication is unsuccessful
#
Challenge input first.
Enter: not very secret challenge
Enter: *************************
Now, the magic number!
PIN: ****
PIN: 9224
#
# athentication is unsuccessful
#
Challenge input first.
Enter: crash pam module
Enter: ****************
Now, the magic number!
PIN: ***
PIN: 616
#
# athentication is successful
#
Now, the magic number!
PIN: 9212
select user(), current_user(), database();
user() current_user() database()
test_pam@localhost pam_test@% test
#
# athentication is unsuccessful
#
Now, the magic number!
PIN: 9212
drop user test_pam;
drop user pam_test;
create user PAM_TEST identified via pam using 'mariadb_mtr';
@ -34,17 +47,17 @@ create user PAM_TEST identified via pam using 'mariadb_mtr';
# athentication is unsuccessful
#
Challenge input first.
Enter: not very secret challenge
Enter: *************************
Now, the magic number!
PIN: ****
PIN: 9225
set global pam_winbind_workaround=1;
#
# athentication is successful
#
Challenge input first.
Enter: not very secret challenge
Enter: *************************
Now, the magic number!
PIN: ****
PIN: 9225
select user(), current_user(), database();
user() current_user() database()
PAM_TEST@localhost PAM_TEST@% test

View File

@ -15,7 +15,12 @@ EOF
--write_file $MYSQLTEST_VARDIR/tmp/pam_ugly.txt
crash pam module
666
616
select user(), current_user(), database();
EOF
--write_file $MYSQLTEST_VARDIR/tmp/pam_good2.txt
9212
select user(), current_user(), database();
EOF
@ -37,6 +42,18 @@ EOF
--error 1
--exec $MYSQL_TEST -u test_pam --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/pam_ugly.txt
--echo #
--echo # athentication is successful
--echo #
--error 0
--exec $MYSQL_TEST -u test_pam -pgoodpassword --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/pam_good2.txt
--echo #
--echo # athentication is unsuccessful
--echo #
--error 1
--exec $MYSQL_TEST -u test_pam -pbadpassword --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/pam_good2.txt
drop user test_pam;
drop user pam_test;
create user PAM_TEST identified via pam using 'mariadb_mtr';
@ -54,6 +71,7 @@ set global pam_winbind_workaround=1;
--exec $MYSQL_TEST -u PAM_TEST < $MYSQLTEST_VARDIR/tmp/pam_good.txt
--remove_file $MYSQLTEST_VARDIR/tmp/pam_good.txt
--remove_file $MYSQLTEST_VARDIR/tmp/pam_good2.txt
--remove_file $MYSQLTEST_VARDIR/tmp/pam_bad.txt
--remove_file $MYSQLTEST_VARDIR/tmp/pam_ugly.txt
drop user PAM_TEST;