From 6683a553f2d9b4b68808ad1076e6cc5515a2b1fb Mon Sep 17 00:00:00 2001 From: Love Hornquist Astrand Date: Sun, 6 Sep 2009 23:16:03 -0700 Subject: [PATCH] externlize env-setup --- tests/bin/setup-env.in | 2 +- tests/kdc/Makefile.am | 12 +++++------ tests/kdc/check-kdc-weak.in | 40 +++++++++++++++++++++++++++++++++++++ tests/kdc/check-kdc.in | 21 ++++++++++--------- tests/kdc/check-keys.in | 3 ++- 5 files changed, 58 insertions(+), 20 deletions(-) create mode 100644 tests/kdc/check-kdc-weak.in diff --git a/tests/bin/setup-env.in b/tests/bin/setup-env.in index 864874632..acc110579 100644 --- a/tests/bin/setup-env.in +++ b/tests/bin/setup-env.in @@ -29,4 +29,4 @@ leaks_kill="${top_srcdir}/tests/kdc/leaks-kill.sh" have_db="${top_builddir}/tests/db/have-db" # data -hx509_data="${top_srcdir}/../../lib/hx509/data" \ No newline at end of file +hx509_data="${top_srcdir}/lib/hx509/data" \ No newline at end of file diff --git a/tests/kdc/Makefile.am b/tests/kdc/Makefile.am index f1c501cff..c0d685cb6 100644 --- a/tests/kdc/Makefile.am +++ b/tests/kdc/Makefile.am @@ -39,6 +39,7 @@ do_dlopen = -e 's,[@]DLOPEN[@],false,g' endif do_subst = sed $(do_dlopen) \ + -e 's,[@]env_setup[@],$(top_builddir)/tests/bin/setup-env,g' \ -e 's,[@]srcdir[@],$(srcdir),g' \ -e 's,[@]port[@],$(port),g' \ -e 's,[@]admport[@],$(admport),g' \ @@ -65,16 +66,12 @@ check-des: check-des.in Makefile krb5.conf mv check-des.tmp check-des check-kdc: check-kdc.in Makefile - $(do_subst) \ - -e 's,[@]KDCCONF[@],krb5.conf,g' \ - < $(srcdir)/check-kdc.in > check-kdc.tmp + $(do_subst) < $(srcdir)/check-kdc.in > check-kdc.tmp chmod +x check-kdc.tmp mv check-kdc.tmp check-kdc -check-kdc-weak: check-kdc.in Makefile - $(do_subst) \ - -e 's,[@]KDCCONF[@],krb5-weak.conf,g' \ - < $(srcdir)/check-kdc.in > check-kdc-weak.tmp +check-kdc-weak: check-kdc-weak.in Makefile + $(do_subst) < $(srcdir)/check-kdc-weak.in > check-kdc-weak.tmp chmod +x check-kdc-weak.tmp mv check-kdc-weak.tmp check-kdc-weak @@ -200,6 +197,7 @@ EXTRA_DIST = \ check-iprop.in \ check-kadmin.in \ check-kdc.in \ + check-kdc-weak.in \ check-keys.in \ check-kpasswdd.in \ check-pkinit.in \ diff --git a/tests/kdc/check-kdc-weak.in b/tests/kdc/check-kdc-weak.in new file mode 100644 index 000000000..12fda2482 --- /dev/null +++ b/tests/kdc/check-kdc-weak.in @@ -0,0 +1,40 @@ +#!/bin/sh +# +# Copyright (c) 2009 Kungliga Tekniska Högskolan +# (Royal Institute of Technology, Stockholm, Sweden). +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# 3. Neither the name of the Institute nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $Id$ +# + +top_builddir="@top_builddir@" +objdir="@objdir@" + +exec ${top_builddir}/tests/kdc/check-kdc ${objdir}/krb5-weak.conf diff --git a/tests/kdc/check-kdc.in b/tests/kdc/check-kdc.in index 9c9f75789..bd51d8f72 100644 --- a/tests/kdc/check-kdc.in +++ b/tests/kdc/check-kdc.in @@ -35,11 +35,15 @@ # top_builddir="@top_builddir@" +env_setup="@env_setup@" objdir="@objdir@" +KRB5_CONFIG="${1-${objdir}/krb5.conf}" +export KRB5_CONFIG + testfailed="echo test failed; cat messages.log; exit 1" -. ${top_builddir}/tests/bin/setup-env +. ${env_setup} # If there is no useful db support compile in, disable test ${have_db} || exit 77 @@ -76,9 +80,6 @@ kgetcred_imp="${kgetcred} -c $cache --out-cache=${ocache}" kdestroy="${kdestroy} -c $cache --no-unlog" kimpersonate="${kimpersonate} -k ${keytab} --ccache=${ocache}" -KRB5_CONFIG="${objdir}/@KDCCONF@" -export KRB5_CONFIG - rm -f ${keytabfile} rm -f current-db* rm -f out-* @@ -387,8 +388,6 @@ fi # If we support pkinit and have RSA, lets try that if test "$pkinit" = yes -a "$rsa" = yes ; then - base="${hx509_data}" - echo "try anonymous pkinit"; > messages.log ${kinit} --anonymous ${R} || \ { ec=1 ; eval "${testfailed}"; } @@ -397,26 +396,26 @@ if test "$pkinit" = yes -a "$rsa" = yes ; then for type in "" "--pk-use-enckey"; do echo "Trying pk-init (principal in certificate) $type"; > messages.log - ${kinit} $type -C FILE:${base}/pkinit.crt,${base}/pkinit.key bar@${R} || \ + ${kinit} $type -C FILE:${hx509_data}/pkinit.crt,${hx509_data}/pkinit.key bar@${R} || \ { ec=1 ; eval "${testfailed}"; } ${kgetcred} ${server}@${R} || { ec=1 ; eval "${testfailed}"; } ${kdestroy} echo "Trying pk-init (principal in pki-mapping) $type"; > messages.log - ${kinit} $type -C FILE:${base}/pkinit.crt,${base}/pkinit.key foo@${R} || \ + ${kinit} $type -C FILE:${hx509_data}/pkinit.crt,${hx509_data}/pkinit.key foo@${R} || \ { ec=1 ; eval "${testfailed}"; } ${kgetcred} ${server}@${R} || { ec=1 ; eval "${testfailed}"; } ${kdestroy} echo "Trying pk-init (password protected key) $type"; > messages.log - ${kinit} $type -C FILE:${base}/pkinit.crt,${base}/pkinit-pw.key --password-file=${objdir}/foopassword foo@${R} || \ + ${kinit} $type -C FILE:${hx509_data}/pkinit.crt,${hx509_data}/pkinit-pw.key --password-file=${objdir}/foopassword foo@${R} || \ { ec=1 ; eval "${testfailed}"; } ${kgetcred} ${server}@${R} || \ { ec=1 ; eval "${testfailed}"; } ${kdestroy} echo "Trying pk-init (proxy cert) $type"; > messages.log - ${kinit} $type -C FILE:${base}/pkinit-proxy-chain.crt,${base}/pkinit-proxy.key foo@${R} || \ + ${kinit} $type -C FILE:${hx509_data}/pkinit-proxy-chain.crt,${hx509_data}/pkinit-proxy.key foo@${R} || \ { ec=1 ; eval "${testfailed}"; } ${kgetcred} ${server}@${R} || { ec=1 ; eval "${testfailed}"; } ${kdestroy} @@ -426,7 +425,7 @@ if test "$pkinit" = yes -a "$rsa" = yes ; then if test "$ecdsa" = yes > /dev/null ; then echo "Trying pk-init (ec certificate)" > messages.log - ${kinit} -C FILE:${base}/pkinit-ec.crt,${base}/pkinit-ec.key bar@${R} || \ + ${kinit} -C FILE:${hx509_data}/pkinit-ec.crt,${hx509_data}/pkinit-ec.key bar@${R} || \ { ec=1 ; eval "${testfailed}"; } ${kgetcred} ${server}@${R} || { ec=1 ; eval "${testfailed}"; } ${kdestroy} diff --git a/tests/kdc/check-keys.in b/tests/kdc/check-keys.in index 721183f50..fc0225513 100644 --- a/tests/kdc/check-keys.in +++ b/tests/kdc/check-keys.in @@ -35,9 +35,10 @@ # top_builddir="@top_builddir@" +env_setup="@env_setup@" objdir="." -. ${top_builddir}/tests/bin/setup-env +. ${env_setup} srcdir="${top_srcdir}/tests/kdc"