diff --git a/tests/zfs-tests/tests/functional/pam/cleanup.ksh b/tests/zfs-tests/tests/functional/pam/cleanup.ksh index 62131c6d6..e41622d77 100755 --- a/tests/zfs-tests/tests/functional/pam/cleanup.ksh +++ b/tests/zfs-tests/tests/functional/pam/cleanup.ksh @@ -22,6 +22,7 @@ . $STF_SUITE/tests/functional/pam/utilities.kshlib +rmconfig destroy_pool $TESTPOOL del_user ${username} del_group pamtestgroup diff --git a/tests/zfs-tests/tests/functional/pam/pam_basic.ksh b/tests/zfs-tests/tests/functional/pam/pam_basic.ksh index 96ac59453..f146a6e5f 100755 --- a/tests/zfs-tests/tests/functional/pam/pam_basic.ksh +++ b/tests/zfs-tests/tests/functional/pam/pam_basic.ksh @@ -26,22 +26,22 @@ log_mustnot ismounted "$TESTPOOL/pam/${username}" keystatus unavailable genconfig "homes=$TESTPOOL/pam runstatedir=${runstatedir}" -echo "testpass" | pamtester pam_zfs_key_test ${username} open_session +echo "testpass" | pamtester ${pamservice} ${username} open_session references 1 log_must ismounted "$TESTPOOL/pam/${username}" keystatus available -echo "testpass" | pamtester pam_zfs_key_test ${username} open_session +echo "testpass" | pamtester ${pamservice} ${username} open_session references 2 log_must ismounted "$TESTPOOL/pam/${username}" keystatus available -log_must pamtester pam_zfs_key_test ${username} close_session +log_must pamtester ${pamservice} ${username} close_session references 1 log_must ismounted "$TESTPOOL/pam/${username}" keystatus available -log_must pamtester pam_zfs_key_test ${username} close_session +log_must pamtester ${pamservice} ${username} close_session references 0 log_mustnot ismounted "$TESTPOOL/pam/${username}" keystatus unavailable diff --git a/tests/zfs-tests/tests/functional/pam/pam_nounmount.ksh b/tests/zfs-tests/tests/functional/pam/pam_nounmount.ksh index 8179f398d..eb9976f2f 100755 --- a/tests/zfs-tests/tests/functional/pam/pam_nounmount.ksh +++ b/tests/zfs-tests/tests/functional/pam/pam_nounmount.ksh @@ -26,22 +26,22 @@ log_mustnot ismounted "$TESTPOOL/pam/${username}" keystatus unavailable genconfig "homes=$TESTPOOL/pam runstatedir=${runstatedir} nounmount" -echo "testpass" | pamtester pam_zfs_key_test ${username} open_session +echo "testpass" | pamtester ${pamservice} ${username} open_session references 1 log_must ismounted "$TESTPOOL/pam/${username}" keystatus available -echo "testpass" | pamtester pam_zfs_key_test ${username} open_session +echo "testpass" | pamtester ${pamservice} ${username} open_session references 2 keystatus available log_must ismounted "$TESTPOOL/pam/${username}" -log_must pamtester pam_zfs_key_test ${username} close_session +log_must pamtester ${pamservice} ${username} close_session references 1 keystatus available log_must ismounted "$TESTPOOL/pam/${username}" -log_must pamtester pam_zfs_key_test ${username} close_session +log_must pamtester ${pamservice} ${username} close_session references 0 keystatus available log_must ismounted "$TESTPOOL/pam/${username}" diff --git a/tests/zfs-tests/tests/functional/pam/utilities.kshlib b/tests/zfs-tests/tests/functional/pam/utilities.kshlib index ef80f5a4f..d32803430 100644 --- a/tests/zfs-tests/tests/functional/pam/utilities.kshlib +++ b/tests/zfs-tests/tests/functional/pam/utilities.kshlib @@ -24,6 +24,9 @@ username="pamtestuser" runstatedir="${TESTDIR}_run" +pamservice="pam_zfs_key_test" +pamconfig="/etc/pam.d/${pamservice}" + function keystatus { log_must [ "$(zfs list -Ho keystatus "$TESTPOOL/pam/${username}")" == "$1" ] } @@ -31,7 +34,11 @@ function keystatus { function genconfig { for i in password auth session; do printf "%s\trequired\tpam_permit.so\n%s\toptional\tpam_zfs_key.so\t%s\n" "$i" "$i" "$1" - done > /etc/pam.d/pam_zfs_key_test + done > "${pamconfig}" +} + +function rmconfig { + log_must rm "${pamconfig}" } function references {