#!/bin/sh
. $(dirname $0)/../test_library

start() {
  ../../src/stunnel -fd 0 <<EOT
  debug = debug
  log = overwrite
  syslog = no
  pid = ${result_path}/stunnel.pid
  output = ${result_path}/stunnel.log

  [https client]
  client = yes
  accept = 127.0.0.1:${http1}
  connect = 127.0.0.1:${https}
  verifyChain = yes
  CAfile = ${script_path}/certs/CACert.pem
  CRLfile = ${script_path}/certs/CACertCRL.pem

  [https server]
  accept = 127.0.0.1:${https}
  connect = 127.0.0.1:${http2}
  cert = ${script_path}/certs/revoked_cert.pem
EOT
}

check_ports "113_failure_CRL_file"
start 2> "error.log"
test_log_for "113_failure_CRL_file" "failure" 2>> "stderr.log"
exit $?
