#!/bin/sh

# Checking if the requireCert option requires a client certificate.
# The success is expected because the client presents a certificate.

. $(dirname $0)/../test_library

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

  [client]
  client = yes
  accept = 127.0.0.1:${http1}
  connect = 127.0.0.1:${https1}
  cert = ${script_path}/certs/client_cert.pem

  [server]
  accept = 127.0.0.1:${https1}
  connect = 127.0.0.1:${http_nc}
  cert = ${script_path}/certs/server_cert.pem
EOT
}

test_log_for "010_require_cert" "success" "0" "$1" "$2" "$3" 2>> "stderr.log"
exit $?
