#!/bin/sh

# inetd mode

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

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

  accept = 127.0.0.1:${https1}
  exec = ${script_path}/execute
  execArgs = execute 042_inetd
  cert = ${script_path}/certs/server_cert.pem
  [server]
EOT
}

start_inetd() {
  ../../src/stunnel -fd 9 9<<EOT
  debug = debug
  syslog = no
  output = ${result_path}/stunnel_inetd.log
  service = inetd client
  client = yes
  connect = 127.0.0.1:${https1}
EOT
}

test_log_for "042_inetd" "inetd" "0" "$1" "$2" "$3" 2>> "stderr.log"
exit $?
