summaryrefslogtreecommitdiff
path: root/tests/ocsp-tests/ocsp-tls-connection
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ocsp-tests/ocsp-tls-connection')
-rwxr-xr-xtests/ocsp-tests/ocsp-tls-connection35
1 files changed, 17 insertions, 18 deletions
diff --git a/tests/ocsp-tests/ocsp-tls-connection b/tests/ocsp-tests/ocsp-tls-connection
index fba9a6eb1c..84eda22b27 100755
--- a/tests/ocsp-tests/ocsp-tls-connection
+++ b/tests/ocsp-tests/ocsp-tls-connection
@@ -21,13 +21,12 @@
# along with GnuTLS; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-srcdir="${srcdir:-.}"
-CERTTOOL="${CERTTOOL:-../src/certtool${EXEEXT}}"
-OCSPTOOL="${OCSPTOOL:-../src/ocsptool${EXEEXT}}"
-GNUTLS_SERV="${SERV:-../src/gnutls-serv${EXEEXT}}"
-unset SERV
-GNUTLS_CLI="${GNUTLS_CLI:-../src/gnutls-cli${EXEEXT}}"
-DIFF="${DIFF:-diff}"
+: ${srcdir=.}
+: ${CERTTOOL=../src/certtool${EXEEXT}}
+: ${OCSPTOOL=../src/ocsptool${EXEEXT}}
+: ${SERV=../src/gnutls-serv${EXEEXT}}
+: ${CLI=../src/gnutls-cli${EXEEXT}}
+: ${DIFF=diff}
TEMPLATE_FILE="out.$$.tmpl.tmp"
SERVER_CERT_FILE="cert.$$.pem.tmp"
@@ -39,11 +38,11 @@ if ! test -x "${OCSPTOOL}"; then
exit 77
fi
-if ! test -x "${GNUTLS_SERV}"; then
+if ! test -x "${SERV}"; then
exit 77
fi
-if ! test -x "${GNUTLS_CLI}"; then
+if ! test -x "${CLI}"; then
exit 77
fi
@@ -70,8 +69,8 @@ OCSP_PORT=$PORT
SERVER_START_TIMEOUT=10
# Check for OpenSSL
-OPENSSL=`which openssl`
-if ! test -x "${OPENSSL}"; then
+: ${OPENSSL=openssl}
+if ! ("$OPENSSL" version) > /dev/null 2>&1; then
echo "You need openssl to run this test."
exit 77
fi
@@ -112,7 +111,7 @@ echo "=== Bringing OCSP server up ==="
# if started repeatedly in a short time, probably a lack of
# SO_REUSEADDR usage.
PORT=${OCSP_PORT}
-launch_bare_server $$ \
+launch_bare_server \
datefudge "${TESTDATE}" \
"${OPENSSL}" ocsp -index "${srcdir}/ocsp-tests/certs/ocsp_index.txt" -text \
-port "${OCSP_PORT}" \
@@ -150,9 +149,9 @@ fi
echo "=== Test 1: Server with valid certificate ==="
PORT=${TLS_SERVER_PORT}
-launch_bare_server $$ \
+launch_bare_server \
datefudge "${TESTDATE}" \
- "${GNUTLS_SERV}" --echo --disable-client-cert \
+ "${SERV}" --echo --disable-client-cert \
--x509keyfile="${srcdir}/ocsp-tests/certs/server_good.key" \
--x509certfile="${SERVER_CERT_FILE}" \
--port="${TLS_SERVER_PORT}"
@@ -163,7 +162,7 @@ wait_for_port "${TLS_SERVER_PORT}"
echo "test 123456" | \
datefudge -s "${TESTDATE}" \
- "${GNUTLS_CLI}" --ocsp --x509cafile="${srcdir}/ocsp-tests/certs/ca.pem" \
+ "${CLI}" --ocsp --x509cafile="${srcdir}/ocsp-tests/certs/ca.pem" \
--port="${TLS_SERVER_PORT}" localhost
rc=$?
@@ -195,9 +194,9 @@ echo "=== Test 2: Server with revoked certificate ==="
eval "${GETPORT}"
TLS_SERVER_PORT=$PORT
-launch_bare_server $$ \
+launch_bare_server \
datefudge "${TESTDATE}" \
- "${GNUTLS_SERV}" --echo --disable-client-cert \
+ "${SERV}" --echo --disable-client-cert \
--x509keyfile="${srcdir}/ocsp-tests/certs/server_bad.key" \
--x509certfile="${SERVER_CERT_FILE}" \
--port="${TLS_SERVER_PORT}"
@@ -207,7 +206,7 @@ wait_for_port "${TLS_SERVER_PORT}"
echo "test 123456" | \
datefudge -s "${TESTDATE}" \
- "${GNUTLS_CLI}" --ocsp --x509cafile="${srcdir}/ocsp-tests/certs/ca.pem" \
+ "${CLI}" --ocsp --x509cafile="${srcdir}/ocsp-tests/certs/ca.pem" \
--port="${TLS_SERVER_PORT}" localhost
rc=$?