1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or https://opensource.org/licenses/CDDL-1.0. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23. $STF_SUITE/tests/functional/pam/utilities.kshlib 24 25if [ -n "$ASAN_OPTIONS" ]; then 26 export LD_PRELOAD=$(ldd "$(command -v zfs)" | awk '/libasan\.so/ {print $3}') 27fi 28 29username="${username}rec" 30 31# Set up a deeper hierarchy, a mountpoint that doesn't interfere with other tests, 32# and a user which references that mountpoint 33log_must zfs create "$TESTPOOL/pampam" 34log_must zfs create -o mountpoint="$TESTDIR/rec" "$TESTPOOL/pampam/pam" 35echo "recurpass" | zfs create -o encryption=aes-256-gcm -o keyformat=passphrase \ 36 -o keylocation=prompt "$TESTPOOL/pampam/pam/${username}" 37log_must zfs unmount "$TESTPOOL/pampam/pam/${username}" 38log_must zfs unload-key "$TESTPOOL/pampam/pam/${username}" 39log_must add_user pamtestgroup ${username} "$TESTDIR/rec" 40 41function keystatus { 42 log_must [ "$(get_prop keystatus "$TESTPOOL/pampam/pam/${username}")" = "$1" ] 43} 44 45log_mustnot ismounted "$TESTPOOL/pampam/pam/${username}" 46keystatus unavailable 47 48function test_session { 49 echo "recurpass" | pamtester ${pamservice} ${username} open_session 50 references 1 51 log_must ismounted "$TESTPOOL/pampam/pam/${username}" 52 keystatus available 53 54 log_must pamtester ${pamservice} ${username} close_session 55 references 0 56 log_mustnot ismounted "$TESTPOOL/pampam/pam/${username}" 57 keystatus unavailable 58} 59 60genconfig "homes=$TESTPOOL/pampam/pam prop_mountpoint runstatedir=${runstatedir}" 61test_session 62 63genconfig "homes=$TESTPOOL/pampam recursive_homes prop_mountpoint runstatedir=${runstatedir}" 64test_session 65 66genconfig "homes=$TESTPOOL recursive_homes prop_mountpoint runstatedir=${runstatedir}" 67test_session 68 69genconfig "homes=* recursive_homes prop_mountpoint runstatedir=${runstatedir}" 70test_session 71 72log_pass "done." 73