geom_gate userland utility improvements
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

54 lines
975 B

  1. #!/bin/sh
  2. # Written by Simon Josefsson.
  3. # Start sshd, invoke parameters, saving exit code, kill sshd, and
  4. # return exit code.
  5. srcdir="@SSHD_TEST_CONFIG_DIR@"
  6. SSHD="@SSHD_EXECUTABLE@"
  7. cmd="\"$1\""
  8. PRIVKEY=$srcdir/etc/user
  9. export PRIVKEY
  10. PUBKEY=$srcdir/etc/user.pub
  11. export PUBKEY
  12. if test -n "$DEBUG"; then
  13. libssh2_sshd_params="-d -d"
  14. fi
  15. chmod go-rwx "$srcdir"/etc/host*
  16. "$SSHD" -f /dev/null -h "$srcdir/etc/host" \
  17. -o 'Port 4711' \
  18. -o 'Protocol 2' \
  19. -o "AuthorizedKeysFile \"$srcdir/etc/user.pub\"" \
  20. -o 'UsePrivilegeSeparation no' \
  21. -o 'StrictModes no' \
  22. -D \
  23. $libssh2_sshd_params &
  24. sshdpid=$!
  25. trap "kill ${sshdpid}; echo signal killing sshd; exit 1;" EXIT
  26. : "started sshd (${sshdpid})"
  27. sleep 3
  28. if ! kill -0 ${sshdpid}
  29. then
  30. echo "SSHD exited before test started"
  31. exit 1
  32. fi
  33. : Invoking $cmd...
  34. eval "$cmd"
  35. ec=$?
  36. : Self-test exit code $ec
  37. : "killing sshd (${sshdpid})"
  38. kill "${sshdpid}" > /dev/null 2>&1
  39. trap "" EXIT
  40. exit $ec