mirror_zfs/tests/zfs-tests/tests/functional/pam/utilities.kshlib.in
Tino Reichardt 1d3ba0bf01
Replace dead opensolaris.org license link
The commit replaces all findings of the link:
http://www.opensolaris.org/os/licensing with this one:
https://opensource.org/licenses/CDDL-1.0

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tino Reichardt <milky-zfs@mcmilk.de>
Closes #13619
2022-07-11 14:16:13 -07:00

49 lines
1.5 KiB
Bash

#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or https://opensource.org/licenses/CDDL-1.0.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
. $STF_SUITE/include/libtest.shlib
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 [ "$(get_prop keystatus "$TESTPOOL/pam/${username}")" = "$1" ]
}
function genconfig {
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 -f "${pamconfig}"
}
function references {
log_must [ "$(<"${runstatedir}/$(id -u ${username})")" = "$1" ]
}