blob: f797ab68d3dd792523fa7d94a745035eaf243c55 [file] [log] [blame]
Darren Tuckerdfea3bc2013-05-17 09:31:39 +10001# $OpenBSD: test-exec.sh,v 1.40 2013/04/07 02:16:03 dtucker Exp $
Damien Miller38cd4352002-05-01 13:17:33 +10002# Placed in the Public Domain.
3
Damien Miller38cd4352002-05-01 13:17:33 +10004#SUDO=sudo
5
Darren Tuckerfeb6f7f2005-02-08 20:17:17 +11006# Unbreak GNU head(1)
7_POSIX2_VERSION=199209
8export _POSIX2_VERSION
9
Darren Tucker50c7db92005-03-09 10:02:55 +110010case `uname -s 2>/dev/null` in
11OSF1*)
12 BIN_SH=xpg4
13 export BIN_SH
14 ;;
Darren Tucker6ea5dc62012-07-03 01:11:28 +100015CYGWIN_NT-5.0)
Darren Tuckerec1e15d2012-07-03 01:06:49 +100016 os=cygwin
17 TEST_SSH_IPV6=no
18 ;;
19CYGWIN*)
20 os=cygwin
21 ;;
Darren Tucker50c7db92005-03-09 10:02:55 +110022esac
23
Darren Tucker3b9c0ad2004-06-23 09:28:20 +100024if [ ! -z "$TEST_SSH_PORT" ]; then
25 PORT="$TEST_SSH_PORT"
26else
27 PORT=4242
28fi
29
Darren Tucker6d3921f2003-09-04 15:35:48 +100030if [ -x /usr/ucb/whoami ]; then
31 USER=`/usr/ucb/whoami`
Tim Rice23ee3592003-09-11 22:32:17 -070032elif whoami >/dev/null 2>&1; then
Darren Tucker6d3921f2003-09-04 15:35:48 +100033 USER=`whoami`
Damien Millere682cb02006-02-01 11:21:01 +110034elif logname >/dev/null 2>&1; then
35 USER=`logname`
Darren Tucker6d3921f2003-09-04 15:35:48 +100036else
37 USER=`id -un`
38fi
39
Damien Miller38cd4352002-05-01 13:17:33 +100040OBJ=$1
41if [ "x$OBJ" = "x" ]; then
42 echo '$OBJ not defined'
43 exit 2
44fi
45if [ ! -d $OBJ ]; then
46 echo "not a directory: $OBJ"
47 exit 2
48fi
49SCRIPT=$2
50if [ "x$SCRIPT" = "x" ]; then
51 echo '$SCRIPT not defined'
52 exit 2
53fi
54if [ ! -f $SCRIPT ]; then
55 echo "not a file: $SCRIPT"
56 exit 2
57fi
Tim Rice9ad7e0e2004-02-12 07:17:10 -080058if $TEST_SHELL -n $SCRIPT; then
Damien Miller38cd4352002-05-01 13:17:33 +100059 true
60else
61 echo "syntax error in $SCRIPT"
62 exit 2
63fi
64unset SSH_AUTH_SOCK
65
Darren Tuckera0f3ba72005-03-07 18:33:02 +110066SRC=`dirname ${SCRIPT}`
67
Damien Miller38cd4352002-05-01 13:17:33 +100068# defaults
69SSH=ssh
70SSHD=sshd
71SSHAGENT=ssh-agent
72SSHADD=ssh-add
73SSHKEYGEN=ssh-keygen
74SSHKEYSCAN=ssh-keyscan
75SFTP=sftp
76SFTPSERVER=/usr/libexec/openssh/sftp-server
Darren Tucker50433a92004-06-16 20:15:59 +100077SCP=scp
Damien Miller38cd4352002-05-01 13:17:33 +100078
Damien Milleraf784932008-03-13 00:17:00 +110079# Interop testing
Damien Millera766cea2008-06-30 08:12:37 +100080PLINK=plink
81PUTTYGEN=puttygen
82CONCH=conch
Damien Milleraf784932008-03-13 00:17:00 +110083
Damien Miller38cd4352002-05-01 13:17:33 +100084if [ "x$TEST_SSH_SSH" != "x" ]; then
Darren Tucker03c907a2004-02-29 20:31:08 +110085 SSH="${TEST_SSH_SSH}"
Damien Miller38cd4352002-05-01 13:17:33 +100086fi
87if [ "x$TEST_SSH_SSHD" != "x" ]; then
Darren Tucker03c907a2004-02-29 20:31:08 +110088 SSHD="${TEST_SSH_SSHD}"
Damien Miller38cd4352002-05-01 13:17:33 +100089fi
90if [ "x$TEST_SSH_SSHAGENT" != "x" ]; then
Darren Tucker03c907a2004-02-29 20:31:08 +110091 SSHAGENT="${TEST_SSH_SSHAGENT}"
Damien Miller38cd4352002-05-01 13:17:33 +100092fi
93if [ "x$TEST_SSH_SSHADD" != "x" ]; then
Darren Tucker03c907a2004-02-29 20:31:08 +110094 SSHADD="${TEST_SSH_SSHADD}"
Damien Miller38cd4352002-05-01 13:17:33 +100095fi
96if [ "x$TEST_SSH_SSHKEYGEN" != "x" ]; then
Darren Tucker03c907a2004-02-29 20:31:08 +110097 SSHKEYGEN="${TEST_SSH_SSHKEYGEN}"
Damien Miller38cd4352002-05-01 13:17:33 +100098fi
99if [ "x$TEST_SSH_SSHKEYSCAN" != "x" ]; then
Darren Tucker03c907a2004-02-29 20:31:08 +1100100 SSHKEYSCAN="${TEST_SSH_SSHKEYSCAN}"
Damien Miller38cd4352002-05-01 13:17:33 +1000101fi
102if [ "x$TEST_SSH_SFTP" != "x" ]; then
Darren Tucker03c907a2004-02-29 20:31:08 +1100103 SFTP="${TEST_SSH_SFTP}"
Damien Miller38cd4352002-05-01 13:17:33 +1000104fi
105if [ "x$TEST_SSH_SFTPSERVER" != "x" ]; then
Darren Tucker03c907a2004-02-29 20:31:08 +1100106 SFTPSERVER="${TEST_SSH_SFTPSERVER}"
Damien Miller38cd4352002-05-01 13:17:33 +1000107fi
Darren Tucker50433a92004-06-16 20:15:59 +1000108if [ "x$TEST_SSH_SCP" != "x" ]; then
109 SCP="${TEST_SSH_SCP}"
110fi
Damien Milleraf784932008-03-13 00:17:00 +1100111if [ "x$TEST_SSH_PLINK" != "x" ]; then
Damien Millerc2cefb02008-03-13 12:41:31 +1100112 # Find real binary, if it exists
113 case "${TEST_SSH_PLINK}" in
114 /*) PLINK="${TEST_SSH_PLINK}" ;;
Damien Miller8f8b1562008-03-15 09:25:54 +1100115 *) PLINK=`which ${TEST_SSH_PLINK} 2>/dev/null` ;;
Damien Millerc2cefb02008-03-13 12:41:31 +1100116 esac
Damien Milleraf784932008-03-13 00:17:00 +1100117fi
118if [ "x$TEST_SSH_PUTTYGEN" != "x" ]; then
Damien Millerc2cefb02008-03-13 12:41:31 +1100119 # Find real binary, if it exists
120 case "${TEST_SSH_PUTTYGEN}" in
121 /*) PUTTYGEN="${TEST_SSH_PUTTYGEN}" ;;
Damien Miller8f8b1562008-03-15 09:25:54 +1100122 *) PUTTYGEN=`which ${TEST_SSH_PUTTYGEN} 2>/dev/null` ;;
Damien Millerc2cefb02008-03-13 12:41:31 +1100123 esac
Damien Milleraf784932008-03-13 00:17:00 +1100124fi
Damien Miller4268a132008-06-30 08:07:56 +1000125if [ "x$TEST_SSH_CONCH" != "x" ]; then
Damien Millera766cea2008-06-30 08:12:37 +1000126 # Find real binary, if it exists
127 case "${TEST_SSH_CONCH}" in
128 /*) CONCH="${TEST_SSH_CONCH}" ;;
129 *) CONCH=`which ${TEST_SSH_CONCH} 2>/dev/null` ;;
130 esac
Damien Miller4268a132008-06-30 08:07:56 +1000131fi
Damien Miller38cd4352002-05-01 13:17:33 +1000132
Darren Tucker977a9d22004-06-25 13:45:18 +1000133# Path to sshd must be absolute for rexec
Darren Tucker114572f2005-08-23 23:32:05 +1000134case "$SSHD" in
135/*) ;;
136*) SSHD=`which sshd` ;;
137esac
Darren Tucker977a9d22004-06-25 13:45:18 +1000138
Darren Tucker75129022013-05-17 09:19:10 +1000139# Logfiles.
140# SSH_LOGFILE should be the debug output of ssh(1) only
141# SSHD_LOGFILE should be the debug output of sshd(8) only
142# REGRESS_LOGFILE is the output of the test itself stdout and stderr
Darren Tuckera0f3ba72005-03-07 18:33:02 +1100143if [ "x$TEST_SSH_LOGFILE" = "x" ]; then
Darren Tucker75129022013-05-17 09:19:10 +1000144 TEST_SSH_LOGFILE=$OBJ/ssh.log
Darren Tuckera0f3ba72005-03-07 18:33:02 +1100145fi
Darren Tucker75129022013-05-17 09:19:10 +1000146if [ "x$TEST_SSHD_LOGFILE" = "x" ]; then
147 TEST_SSHD_LOGFILE=$OBJ/sshd.log
148fi
149if [ "x$TEST_REGRESS_LOGFILE" = "x" ]; then
150 TEST_REGRESS_LOGFILE=$OBJ/regress.log
151fi
152
153# truncate logfiles
154>$TEST_SSH_LOGFILE
155>$TEST_SSHD_LOGFILE
156>$TEST_REGRESS_LOGFILE
Darren Tuckera0f3ba72005-03-07 18:33:02 +1100157
Darren Tuckerfe10a282013-03-12 11:19:40 +1100158# Some data for test copies
159DATA=$OBJ/testdata
160cat $SSHD${EXEEXT} $SSHD${EXEEXT} $SSHD${EXEEXT} $SSHD${EXEEXT} >$DATA
161
Darren Tuckerdfea3bc2013-05-17 09:31:39 +1000162# Create wrapper ssh with logging. We can't just specify "SSH=ssh -E..."
163# because sftp and scp don't handle spaces in arguments.
164SSHLOGWRAP=$OBJ/ssh-log-wrapper.sh
165echo "#!/bin/sh" > $SSHLOGWRAP
166echo "exec ${SSH} -E${TEST_SSH_LOGFILE} "'"$@"' >>$SSHLOGWRAP
167
168chmod a+rx $OBJ/ssh-log-wrapper.sh
169SSH="$SSHLOGWRAP"
170
Damien Miller38cd4352002-05-01 13:17:33 +1000171# these should be used in tests
Darren Tucker50433a92004-06-16 20:15:59 +1000172export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP
173#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP
Damien Miller38cd4352002-05-01 13:17:33 +1000174
175# helper
Darren Tucker53c55f42003-09-04 15:16:56 +1000176echon()
177{
178 if [ "x`echo -n`" = "x" ]; then
179 echo -n "$@"
180 elif [ "x`echo '\c'`" = "x" ]; then
181 echo "$@\c"
182 else
183 fatal "Don't know how to echo without newline."
184 fi
185}
186
Tim Rice23ee3592003-09-11 22:32:17 -0700187have_prog()
188{
189 saved_IFS="$IFS"
190 IFS=":"
191 for i in $PATH
192 do
193 if [ -x $i/$1 ]; then
194 IFS="$saved_IFS"
195 return 0
196 fi
197 done
198 IFS="$saved_IFS"
199 return 1
200}
201
Damien Miller38cd4352002-05-01 13:17:33 +1000202cleanup ()
203{
204 if [ -f $PIDFILE ]; then
Tim Rice722b8d12010-08-12 09:43:13 -0700205 pid=`$SUDO cat $PIDFILE`
Damien Miller38cd4352002-05-01 13:17:33 +1000206 if [ "X$pid" = "X" ]; then
207 echo no sshd running
208 else
209 if [ $pid -lt 2 ]; then
Damien Millerc1739212010-02-24 17:29:34 +1100210 echo bad pid for ssh: $pid
Damien Miller38cd4352002-05-01 13:17:33 +1000211 else
212 $SUDO kill $pid
Damien Millerc1739212010-02-24 17:29:34 +1100213 trace "wait for sshd to exit"
214 i=0;
215 while [ -f $PIDFILE -a $i -lt 5 ]; do
216 i=`expr $i + 1`
217 sleep $i
218 done
219 test -f $PIDFILE && \
220 fatal "sshd didn't exit port $PORT pid $pid"
Damien Miller38cd4352002-05-01 13:17:33 +1000221 fi
222 fi
223 fi
224}
225
Darren Tuckerdfea3bc2013-05-17 09:31:39 +1000226start_debug_log ()
227{
228 echo "trace: $@" >$TEST_REGRESS_LOGFILE
229 echo "trace: $@" >$TEST_SSH_LOGFILE
230 echo "trace: $@" >$TEST_SSHD_LOGFILE
231}
232
233save_debug_log ()
234{
235 echo $@ >>$TEST_REGRESS_LOGFILE
236 echo $@ >>$TEST_SSH_LOGFILE
237 echo $@ >>$TEST_SSHD_LOGFILE
238 (cat $TEST_REGRESS_LOGFILE; echo) >>$OBJ/failed-regress.log
239 (cat $TEST_SSH_LOGFILE; echo) >>$OBJ/failed-ssh.log
240 (cat $TEST_SSHD_LOGFILE; echo) >>$OBJ/failed-sshd.log
241}
242
Damien Miller38cd4352002-05-01 13:17:33 +1000243trace ()
244{
Darren Tuckerdfea3bc2013-05-17 09:31:39 +1000245 start_debug_log $@
Damien Miller38cd4352002-05-01 13:17:33 +1000246 if [ "X$TEST_SSH_TRACE" = "Xyes" ]; then
Damien Millerda1e4bd2007-10-26 15:35:54 +1000247 echo "$@"
Damien Miller38cd4352002-05-01 13:17:33 +1000248 fi
249}
250
251verbose ()
252{
Darren Tuckerdfea3bc2013-05-17 09:31:39 +1000253 start_debug_log $@
Damien Miller38cd4352002-05-01 13:17:33 +1000254 if [ "X$TEST_SSH_QUIET" != "Xyes" ]; then
Damien Millerda1e4bd2007-10-26 15:35:54 +1000255 echo "$@"
Damien Miller38cd4352002-05-01 13:17:33 +1000256 fi
257}
258
Damien Miller6efd94f2011-09-04 19:04:16 +1000259warn ()
260{
261 echo "WARNING: $@" >>$TEST_SSH_LOGFILE
262 echo "WARNING: $@"
263}
Damien Miller38cd4352002-05-01 13:17:33 +1000264
265fail ()
266{
Darren Tuckerdfea3bc2013-05-17 09:31:39 +1000267 save_debug_log "FAIL: $@"
Damien Miller38cd4352002-05-01 13:17:33 +1000268 RESULT=1
Damien Millerda1e4bd2007-10-26 15:35:54 +1000269 echo "$@"
Darren Tuckerdfea3bc2013-05-17 09:31:39 +1000270
Damien Miller38cd4352002-05-01 13:17:33 +1000271}
272
273fatal ()
274{
Darren Tuckerdfea3bc2013-05-17 09:31:39 +1000275 save_debug_log "FATAL: $@"
276 echo -n "FATAL: "
Damien Miller38cd4352002-05-01 13:17:33 +1000277 fail "$@"
278 cleanup
279 exit $RESULT
280}
281
Damien Miller58497782011-01-17 16:17:09 +1100282# Check whether preprocessor symbols are defined in config.h.
283config_defined ()
284{
285 str=$1
286 while test "x$2" != "x" ; do
287 str="$str|$2"
288 shift
289 done
290 egrep "^#define.*($str)" ${BUILDDIR}/config.h >/dev/null 2>&1
291}
292
Damien Miller38cd4352002-05-01 13:17:33 +1000293RESULT=0
294PIDFILE=$OBJ/pidfile
295
296trap fatal 3 2
297
298# create server config
299cat << EOF > $OBJ/sshd_config
Darren Tucker0e6868e2004-06-16 20:36:16 +1000300 StrictModes no
Damien Miller38cd4352002-05-01 13:17:33 +1000301 Port $PORT
Darren Tuckere23a79c2009-10-12 09:37:22 +1100302 Protocol 2,1
Damien Miller76be6b82006-01-31 21:59:01 +1100303 AddressFamily inet
Damien Miller38cd4352002-05-01 13:17:33 +1000304 ListenAddress 127.0.0.1
305 #ListenAddress ::1
306 PidFile $PIDFILE
307 AuthorizedKeysFile $OBJ/authorized_keys_%u
Darren Tuckerdfea3bc2013-05-17 09:31:39 +1000308 LogLevel DEBUG3
Darren Tucker4c37ef02004-06-16 20:08:56 +1000309 AcceptEnv _XXX_TEST_*
310 AcceptEnv _XXX_TEST
Darren Tuckere7d05832004-06-16 20:22:22 +1000311 Subsystem sftp $SFTPSERVER
Damien Miller38cd4352002-05-01 13:17:33 +1000312EOF
313
Darren Tucker6223eea2004-06-23 09:25:02 +1000314if [ ! -z "$TEST_SSH_SSHD_CONFOPTS" ]; then
315 trace "adding sshd_config option $TEST_SSH_SSHD_CONFOPTS"
316 echo "$TEST_SSH_SSHD_CONFOPTS" >> $OBJ/sshd_config
317fi
318
Damien Miller38cd4352002-05-01 13:17:33 +1000319# server config for proxy connects
320cp $OBJ/sshd_config $OBJ/sshd_proxy
321
322# allow group-writable directories in proxy-mode
323echo 'StrictModes no' >> $OBJ/sshd_proxy
324
325# create client config
326cat << EOF > $OBJ/ssh_config
327Host *
Darren Tuckere23a79c2009-10-12 09:37:22 +1100328 Protocol 2,1
Damien Miller38cd4352002-05-01 13:17:33 +1000329 Hostname 127.0.0.1
330 HostKeyAlias localhost-with-alias
331 Port $PORT
332 User $USER
333 GlobalKnownHostsFile $OBJ/known_hosts
334 UserKnownHostsFile $OBJ/known_hosts
335 RSAAuthentication yes
336 PubkeyAuthentication yes
337 ChallengeResponseAuthentication no
338 HostbasedAuthentication no
339 PasswordAuthentication no
Damien Miller38cd4352002-05-01 13:17:33 +1000340 BatchMode yes
341 StrictHostKeyChecking yes
Darren Tuckerdfea3bc2013-05-17 09:31:39 +1000342 LogLevel DEBUG3
Damien Miller38cd4352002-05-01 13:17:33 +1000343EOF
344
Darren Tucker6223eea2004-06-23 09:25:02 +1000345if [ ! -z "$TEST_SSH_SSH_CONFOPTS" ]; then
346 trace "adding ssh_config option $TEST_SSH_SSHD_CONFOPTS"
347 echo "$TEST_SSH_SSH_CONFOPTS" >> $OBJ/ssh_config
348fi
349
Damien Miller38cd4352002-05-01 13:17:33 +1000350rm -f $OBJ/known_hosts $OBJ/authorized_keys_$USER
351
352trace "generate keys"
353for t in rsa rsa1; do
354 # generate user key
Darren Tucker7c8b1e72013-05-17 09:10:20 +1000355 if [ ! -f $OBJ/$t ] || [ ${SSHKEYGEN} -nt $OBJ/$t ]; then
356 rm -f $OBJ/$t
357 ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t ||\
358 fail "ssh-keygen for $t failed"
359 fi
Damien Miller38cd4352002-05-01 13:17:33 +1000360
361 # known hosts file for client
362 (
Darren Tucker53c55f42003-09-04 15:16:56 +1000363 echon 'localhost-with-alias,127.0.0.1,::1 '
Damien Miller38cd4352002-05-01 13:17:33 +1000364 cat $OBJ/$t.pub
365 ) >> $OBJ/known_hosts
366
367 # setup authorized keys
368 cat $OBJ/$t.pub >> $OBJ/authorized_keys_$USER
369 echo IdentityFile $OBJ/$t >> $OBJ/ssh_config
370
371 # use key as host key, too
372 $SUDO cp $OBJ/$t $OBJ/host.$t
373 echo HostKey $OBJ/host.$t >> $OBJ/sshd_config
374
375 # don't use SUDO for proxy connect
376 echo HostKey $OBJ/$t >> $OBJ/sshd_proxy
377done
378chmod 644 $OBJ/authorized_keys_$USER
379
Damien Miller4268a132008-06-30 08:07:56 +1000380# Activate Twisted Conch tests if the binary is present
381REGRESS_INTEROP_CONCH=no
382if test -x "$CONCH" ; then
383 REGRESS_INTEROP_CONCH=yes
384fi
385
Darren Tuckerd788b7c2008-06-10 23:15:54 +1000386# If PuTTY is present and we are running a PuTTY test, prepare keys and
387# configuration
Damien Milleraf784932008-03-13 00:17:00 +1100388REGRESS_INTEROP_PUTTY=no
Darren Tuckerd8bafea2008-06-11 01:39:38 +1000389if test -x "$PUTTYGEN" -a -x "$PLINK" ; then
Darren Tucker5f346642008-06-11 01:38:52 +1000390 REGRESS_INTEROP_PUTTY=yes
391fi
392case "$SCRIPT" in
393*putty*) ;;
394*) REGRESS_INTEROP_PUTTY=no ;;
395esac
396
397if test "$REGRESS_INTEROP_PUTTY" = "yes" ; then
Damien Milleraf784932008-03-13 00:17:00 +1100398 mkdir -p ${OBJ}/.putty
399
400 # Add a PuTTY key to authorized_keys
401 rm -f ${OBJ}/putty.rsa2
402 puttygen -t rsa -o ${OBJ}/putty.rsa2 < /dev/null > /dev/null
403 puttygen -O public-openssh ${OBJ}/putty.rsa2 \
404 >> $OBJ/authorized_keys_$USER
405
406 # Convert rsa2 host key to PuTTY format
407 ${SRC}/ssh2putty.sh 127.0.0.1 $PORT $OBJ/rsa > \
408 ${OBJ}/.putty/sshhostkeys
409 ${SRC}/ssh2putty.sh 127.0.0.1 22 $OBJ/rsa >> \
410 ${OBJ}/.putty/sshhostkeys
411
412 # Setup proxied session
413 mkdir -p ${OBJ}/.putty/sessions
414 rm -f ${OBJ}/.putty/sessions/localhost_proxy
415 echo "Hostname=127.0.0.1" >> ${OBJ}/.putty/sessions/localhost_proxy
416 echo "PortNumber=$PORT" >> ${OBJ}/.putty/sessions/localhost_proxy
417 echo "ProxyMethod=5" >> ${OBJ}/.putty/sessions/localhost_proxy
Darren Tucker75129022013-05-17 09:19:10 +1000418 echo "ProxyTelnetCommand=sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSHD_LOGFILE} -i -f $OBJ/sshd_proxy" >> ${OBJ}/.putty/sessions/localhost_proxy
Damien Milleraf784932008-03-13 00:17:00 +1100419
420 REGRESS_INTEROP_PUTTY=yes
421fi
422
Damien Miller38cd4352002-05-01 13:17:33 +1000423# create a proxy version of the client config
424(
425 cat $OBJ/ssh_config
Darren Tucker75129022013-05-17 09:19:10 +1000426 echo proxycommand ${SUDO} sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSHD_LOGFILE} -i -f $OBJ/sshd_proxy
Damien Miller38cd4352002-05-01 13:17:33 +1000427) > $OBJ/ssh_proxy
428
429# check proxy config
430${SSHD} -t -f $OBJ/sshd_proxy || fatal "sshd_proxy broken"
431
432start_sshd ()
433{
434 # start sshd
Damien Milleraf784932008-03-13 00:17:00 +1100435 $SUDO ${SSHD} -f $OBJ/sshd_config "$@" -t || fatal "sshd_config broken"
Darren Tuckerdfea3bc2013-05-17 09:31:39 +1000436 $SUDO ${SSHD} -f $OBJ/sshd_config "$@" -E$TEST_SSHD_LOGFILE
Damien Miller38cd4352002-05-01 13:17:33 +1000437
438 trace "wait for sshd"
439 i=0;
Darren Tucker6d3921f2003-09-04 15:35:48 +1000440 while [ ! -f $PIDFILE -a $i -lt 10 ]; do
Damien Miller38cd4352002-05-01 13:17:33 +1000441 i=`expr $i + 1`
442 sleep $i
443 done
444
445 test -f $PIDFILE || fatal "no sshd running on port $PORT"
446}
447
Damien Miller38cd4352002-05-01 13:17:33 +1000448# source test body
449. $SCRIPT
450
451# kill sshd
452cleanup
453if [ $RESULT -eq 0 ]; then
454 verbose ok $tid
455else
456 echo failed $tid
457fi
458exit $RESULT