aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-03-23 02:21:56 +0100
committerBrian Behlendorf <[email protected]>2022-04-01 18:02:54 -0700
commitff0fc5af12bc4c702664d1e9e48d158ba42ebc2e (patch)
treeb8c3db05d51b82e3d4e11e9f85f3550eb70b9089 /tests
parent7b6c4cbb1f4c308490b701d4ba181310d7d4d290 (diff)
tests: pam: use absolute path to module .so
This is a valid configuration and both (a) skips the tests if it's unbuilt/not installed and (b) makes it work even if installed outside the system directory (like in /u/l/l/s instead of /l/s) Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: John Kennedy <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #13259
Diffstat (limited to 'tests')
-rw-r--r--tests/zfs-tests/tests/functional/pam/.gitignore1
-rw-r--r--tests/zfs-tests/tests/functional/pam/Makefile.am3
-rwxr-xr-xtests/zfs-tests/tests/functional/pam/cleanup.ksh6
-rwxr-xr-xtests/zfs-tests/tests/functional/pam/setup.ksh1
-rw-r--r--tests/zfs-tests/tests/functional/pam/utilities.kshlib.in (renamed from tests/zfs-tests/tests/functional/pam/utilities.kshlib)13
5 files changed, 13 insertions, 11 deletions
diff --git a/tests/zfs-tests/tests/functional/pam/.gitignore b/tests/zfs-tests/tests/functional/pam/.gitignore
new file mode 100644
index 000000000..ae55292b0
--- /dev/null
+++ b/tests/zfs-tests/tests/functional/pam/.gitignore
@@ -0,0 +1 @@
+/utilities.kshlib
diff --git a/tests/zfs-tests/tests/functional/pam/Makefile.am b/tests/zfs-tests/tests/functional/pam/Makefile.am
index be881facc..2ae5f8ff0 100644
--- a/tests/zfs-tests/tests/functional/pam/Makefile.am
+++ b/tests/zfs-tests/tests/functional/pam/Makefile.am
@@ -6,3 +6,6 @@ dist_pkgdata_SCRIPTS = \
pam_nounmount.ksh \
pam_short_password.ksh \
utilities.kshlib
+
+% : %.in
+ sed 's|@pammoduledir[@]|@pammoduledir@|g' $< > $@
diff --git a/tests/zfs-tests/tests/functional/pam/cleanup.ksh b/tests/zfs-tests/tests/functional/pam/cleanup.ksh
index e41622d77..8ea9c848b 100755
--- a/tests/zfs-tests/tests/functional/pam/cleanup.ksh
+++ b/tests/zfs-tests/tests/functional/pam/cleanup.ksh
@@ -26,8 +26,4 @@ rmconfig
destroy_pool $TESTPOOL
del_user ${username}
del_group pamtestgroup
-
-rm -rf "$runstatedir"
-for dir in $TESTDIRS; do
- rm -rf $dir
-done
+log_must rm -rf "$runstatedir" $TESTDIRS
diff --git a/tests/zfs-tests/tests/functional/pam/setup.ksh b/tests/zfs-tests/tests/functional/pam/setup.ksh
index 8ef9fbe0f..82370a211 100755
--- a/tests/zfs-tests/tests/functional/pam/setup.ksh
+++ b/tests/zfs-tests/tests/functional/pam/setup.ksh
@@ -23,6 +23,7 @@
. $STF_SUITE/tests/functional/pam/utilities.kshlib
command -v pamtester > /dev/null || log_unsupported "pam tests require the pamtester utility to be installed"
+[ -f "$pammodule" ] || log_unsupported "$pammodule missing"
DISK=${DISKS%% *}
create_pool $TESTPOOL "$DISK"
diff --git a/tests/zfs-tests/tests/functional/pam/utilities.kshlib b/tests/zfs-tests/tests/functional/pam/utilities.kshlib.in
index 6e9f90091..29c6ada3d 100644
--- a/tests/zfs-tests/tests/functional/pam/utilities.kshlib
+++ b/tests/zfs-tests/tests/functional/pam/utilities.kshlib.in
@@ -24,24 +24,25 @@
username="pamtestuser"
runstatedir="${TESTDIR}_run"
+pammodule="@pammoduledir@/pam_zfs_key.so"
pamservice="pam_zfs_key_test"
pamconfig="/etc/pam.d/${pamservice}"
function keystatus {
- log_must [ "$(zfs list -Ho keystatus "$TESTPOOL/pam/${username}")" = "$1" ]
+ log_must [ "$(get_prop keystatus "$TESTPOOL/pam/${username}")" = "$1" ]
}
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 > "${pamconfig}"
+ printf '%s\trequired\tpam_permit.so\n%s\toptional\t%s\t%s\n' \
+ password password "$pammodule" "$1" \
+ auth auth "$pammodule" "$1" \
+ session session "$pammodule" "$1" > "${pamconfig}"
}
function rmconfig {
- log_must rm "${pamconfig}"
+ log_must rm -f "${pamconfig}"
}
function references {
log_must [ "$(<"${runstatedir}/$(id -u ${username})")" = "$1" ]
}
-