]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
tests/ocsp-tests/ocsp-must-staple-connection: grep for specific...
authorAlexander Sosedkin <asosedkin@redhat.com>
Thu, 12 Mar 2026 09:42:49 +0000 (10:42 +0100)
committerAlexander Sosedkin <asosedkin@redhat.com>
Wed, 29 Apr 2026 13:35:03 +0000 (15:35 +0200)
... error message: 'Got OCSP response with an unrelated certificate'.

Signed-off-by: Alexander Sosedkin <asosedkin@redhat.com>
tests/ocsp-tests/ocsp-must-staple-connection.sh

index 5e100b9d90d5ec8d2a70e3295337b9f69b4c67a1..568aece2e1f03228f4cd54148da9354eebac92b3 100755 (executable)
@@ -292,21 +292,31 @@ wait_server $TLS_SERVER_PID
 
 wait_for_port "${TLS_SERVER_PORT}"
 
-echo "test 123456" | \
-       "${CLI}" --attime "${TESTDATE}" --ocsp --x509cafile="${srcdir}/ocsp-tests/certs/ca.pem" \
-                --port="${TLS_SERVER_PORT}" localhost
+out=$(
+    echo "test 123456" | \
+        "${CLI}" --attime "${TESTDATE}" --ocsp \
+             --x509cafile="${srcdir}/ocsp-tests/certs/ca.pem" \
+             --port="${TLS_SERVER_PORT}" localhost \
+             2>&1
+)
 rc=$?
+printf '%s\n' "$out"
 
 if test "${rc}" = "0"; then
     echo "Connecting to server with valid certificate and invalid staple succeeded"
     exit 1
 fi
 
+if ! echo "${out}" | grep "Got OCSP response with an unrelated certificate" > /dev/null
+then
+    echo '"Got OCSP response with an unrelated certificate" not found in output'
+    exit 1
+fi
+
 kill "${TLS_SERVER_PID}"
 wait "${TLS_SERVER_PID}"
 unset TLS_SERVER_PID
 
-
 echo "=== Test 5: Server with valid certificate - expired staple ==="
 
 rm -f "${OCSP_RESPONSE_FILE}"