fix old typo (s/SYSVINITSTOPT/SYSVINITSTOP/)
[openssh.git] / sshd-debug.sh
blob86a9b37bd15ce9129c8292d3a074ce853f5eca51
1 #!/bin/sh
3 # ssh-debug
5 # A wrapper script around sshd to invoke when debugging to debug the
6 # work-in-progress versions of sshd-auth and sshd-session, instead
7 # of debugging the installed ones that probably don't have the change
8 # you are working on.
10 # Placed in the Public Domain.
12 unset DIR SSHD SSHD_AUTH SSHD_SESSION
14 fatal() {
15 echo >&2 $@
16 exit 1
19 case "$0" in
20 /*) DIR="`dirname $0`" ;;
21 ./sshd-debug.sh) DIR="`pwd`" ;;
22 *) echo "Need full path or working directory."; exit 1 ;;
23 esac
25 for i in sshd/obj/sshd sshd/sshd sshd; do
26 if [ -f "${DIR}/$i" ] && [ -x "${DIR}/$i" ]; then
27 SSHD="${DIR}/$i"
29 done
30 [ -z "${SSHD}" ] && fatal "Could not find sshd"
32 for i in sshd-auth/obj/sshd-auth sshd-auth/sshd-auth sshd-auth; do
33 if [ -f "${DIR}/$i" ] && [ -x "${DIR}/$i" ]; then
34 SSHD_AUTH="${DIR}/$i"
36 done
37 [ -z "${SSHD_AUTH}" ] && fatal "Could not find sshd-auth"
39 for i in sshd-session/obj/sshd-session sshd-session/sshd-session sshd-session; do
40 if [ -f "${DIR}/$i" ] && [ -x "${DIR}/$i" ]; then
41 SSHD_SESSION="${DIR}/$i"
43 done
44 [ -z "${SSHD_SESSION}" ] && fatal "Could not find sshd-session"
46 echo >&2 Debugging ${SSHD} auth ${SSHD_AUTH} session ${SSHD_SESSION}
48 # Append SshdSessionPath and SshdAuthPath pointing to the build directory.
49 # If you explicitly specify these in the command line, the first-match
50 # keyword semantics will override these.
51 exec "${SSHD}" $@ \
52 -oSshdAuthPath="${SSHD_AUTH}" -oSshdSessionPath="${SSHD_SESSION}"