mirror of
https://gitlab.com/openconnect/ocserv.git
synced 2026-02-10 00:37:00 +08:00
tests: clean-up pam server initiation
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
# along with this file; if not, write to the Free Software Foundation,
|
||||
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
#this test can only be run as root
|
||||
builddir=${builddir:-.}
|
||||
|
||||
OPENCONNECT=${OPENCONNECT:-/usr/sbin/openconnect}
|
||||
|
||||
@@ -116,16 +116,23 @@ launch_sr_server() {
|
||||
}
|
||||
|
||||
launch_sr_pam_server() {
|
||||
mkdir -p "data/$PAMDIR/"
|
||||
test -f "${srcdir}/data/$PAMDIR/users.oath.templ" && cp "${srcdir}/data/$PAMDIR/users.oath.templ" "data/$PAMDIR/users.oath"
|
||||
test -f "${srcdir}/data/$PAMDIR/passdb.templ" && cp "${srcdir}/data/$PAMDIR/passdb.templ" "data/$PAMDIR/passdb"
|
||||
export PAM_WRAPPER_SERVICE_DIR=pam.$$.tmp
|
||||
export NSS_WRAPPER_PASSWD=${srcdir}/data/pam/nss-passwd
|
||||
export NSS_WRAPPER_GROUP=${srcdir}/data/pam/nss-group
|
||||
test -z "${TEST_PAMDIR}" && exit 2
|
||||
export PAM_WRAPPER_DEBUGLEVEL=3
|
||||
export PAM_WRAPPER_SERVICE_DIR="${builddir}/pam.$$.tmp/"
|
||||
mkdir -p "${PAM_WRAPPER_SERVICE_DIR}"
|
||||
test -f "${srcdir}/${TEST_PAMDIR}/users.oath.templ" && cp "${srcdir}/${TEST_PAMDIR}/users.oath.templ" "${PAM_WRAPPER_SERVICE_DIR}/users.oath"
|
||||
test -f "${srcdir}/${TEST_PAMDIR}/passdb.templ" && cp "${srcdir}/${TEST_PAMDIR}/passdb.templ" "${PAM_WRAPPER_SERVICE_DIR}/passdb"
|
||||
test -f "${builddir}/${TEST_PAMDIR}/ocserv" && cp "${builddir}/${TEST_PAMDIR}/ocserv" "${PAM_WRAPPER_SERVICE_DIR}/"
|
||||
sed -i -e 's|%PAM_WRAPPER_SERVICE_DIR%|'${PAM_WRAPPER_SERVICE_DIR}'|g' "${PAM_WRAPPER_SERVICE_DIR}/ocserv"
|
||||
|
||||
cp "${builddir}/data/pam/nss-passwd" "${PAM_WRAPPER_SERVICE_DIR}/"
|
||||
cp "${builddir}/data/pam/nss-group" "${PAM_WRAPPER_SERVICE_DIR}/"
|
||||
export NSS_WRAPPER_PASSWD=${PAM_WRAPPER_SERVICE_DIR}/nss-passwd
|
||||
export NSS_WRAPPER_GROUP=${PAM_WRAPPER_SERVICE_DIR}/nss-group
|
||||
if test -n "${VERBOSE}" && test "${VERBOSE}" -ge 1;then
|
||||
LD_PRELOAD=libnss_wrapper.so:libpam_wrapper.so:libsocket_wrapper.so:libuid_wrapper.so PAM_WRAPPER_SERVICE_DIR="data/$PAMDIR" PAM_WRAPPER=1 UID_WRAPPER=1 UID_WRAPPER_ROOT=1 $SERV $* &
|
||||
LD_PRELOAD=libnss_wrapper.so:libpam_wrapper.so:libsocket_wrapper.so:libuid_wrapper.so PAM_WRAPPER=1 UID_WRAPPER=1 UID_WRAPPER_ROOT=1 $SERV $* &
|
||||
else
|
||||
LD_PRELOAD=libnss_wrapper.so:libpam_wrapper.so:libsocket_wrapper.so:libuid_wrapper.so PAM_WRAPPER_SERVICE_DIR="data/$PAMDIR" PAM_WRAPPER=1 UID_WRAPPER=1 UID_WRAPPER_ROOT=1 $SERV $* >/dev/null 2>&1 &
|
||||
LD_PRELOAD=libnss_wrapper.so:libpam_wrapper.so:libsocket_wrapper.so:libuid_wrapper.so PAM_WRAPPER=1 UID_WRAPPER=1 UID_WRAPPER_ROOT=1 $SERV $* >/dev/null 2>&1 &
|
||||
fi
|
||||
LOCALPID="$!";
|
||||
unset NSS_WRAPPER_PASSWD
|
||||
@@ -179,7 +186,8 @@ cleanup() {
|
||||
ret=1
|
||||
fi
|
||||
wait
|
||||
test -n "$SOCKDIR" && rm -rf $SOCKDIR
|
||||
test -n "${PAM_WRAPPER_SERVICE_DIR}" && rm -rf ${PAM_WRAPPER_SERVICE_DIR}
|
||||
test -n "${SOCKDIR}" && rm -rf ${SOCKDIR}
|
||||
rm -f ${CONFIG}
|
||||
return $ret
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user