summaryrefslogtreecommitdiff
path: root/regress/test-exec.sh
diff options
context:
space:
mode:
Diffstat (limited to 'regress/test-exec.sh')
-rw-r--r--regress/test-exec.sh75
1 files changed, 72 insertions, 3 deletions
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index 59ae33c08..b54448912 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: test-exec.sh,v 1.28 2005/05/20 23:14:15 djm Exp $ 1# $OpenBSD: test-exec.sh,v 1.35 2008/06/28 13:57:25 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4#SUDO=sudo 4#SUDO=sudo
@@ -69,6 +69,11 @@ SFTP=sftp
69SFTPSERVER=/usr/libexec/openssh/sftp-server 69SFTPSERVER=/usr/libexec/openssh/sftp-server
70SCP=scp 70SCP=scp
71 71
72# Interop testing
73PLINK=plink
74PUTTYGEN=puttygen
75CONCH=conch
76
72if [ "x$TEST_SSH_SSH" != "x" ]; then 77if [ "x$TEST_SSH_SSH" != "x" ]; then
73 SSH="${TEST_SSH_SSH}" 78 SSH="${TEST_SSH_SSH}"
74fi 79fi
@@ -96,6 +101,27 @@ fi
96if [ "x$TEST_SSH_SCP" != "x" ]; then 101if [ "x$TEST_SSH_SCP" != "x" ]; then
97 SCP="${TEST_SSH_SCP}" 102 SCP="${TEST_SSH_SCP}"
98fi 103fi
104if [ "x$TEST_SSH_PLINK" != "x" ]; then
105 # Find real binary, if it exists
106 case "${TEST_SSH_PLINK}" in
107 /*) PLINK="${TEST_SSH_PLINK}" ;;
108 *) PLINK=`which ${TEST_SSH_PLINK} 2>/dev/null` ;;
109 esac
110fi
111if [ "x$TEST_SSH_PUTTYGEN" != "x" ]; then
112 # Find real binary, if it exists
113 case "${TEST_SSH_PUTTYGEN}" in
114 /*) PUTTYGEN="${TEST_SSH_PUTTYGEN}" ;;
115 *) PUTTYGEN=`which ${TEST_SSH_PUTTYGEN} 2>/dev/null` ;;
116 esac
117fi
118if [ "x$TEST_SSH_CONCH" != "x" ]; then
119 # Find real binary, if it exists
120 case "${TEST_SSH_CONCH}" in
121 /*) CONCH="${TEST_SSH_CONCH}" ;;
122 *) CONCH=`which ${TEST_SSH_CONCH} 2>/dev/null` ;;
123 esac
124fi
99 125
100# Path to sshd must be absolute for rexec 126# Path to sshd must be absolute for rexec
101case "$SSHD" in 127case "$SSHD" in
@@ -269,6 +295,49 @@ for t in rsa rsa1; do
269done 295done
270chmod 644 $OBJ/authorized_keys_$USER 296chmod 644 $OBJ/authorized_keys_$USER
271 297
298# Activate Twisted Conch tests if the binary is present
299REGRESS_INTEROP_CONCH=no
300if test -x "$CONCH" ; then
301 REGRESS_INTEROP_CONCH=yes
302fi
303
304# If PuTTY is present and we are running a PuTTY test, prepare keys and
305# configuration
306REGRESS_INTEROP_PUTTY=no
307if test -x "$PUTTYGEN" -a -x "$PLINK" ; then
308 REGRESS_INTEROP_PUTTY=yes
309fi
310case "$SCRIPT" in
311*putty*) ;;
312*) REGRESS_INTEROP_PUTTY=no ;;
313esac
314
315if test "$REGRESS_INTEROP_PUTTY" = "yes" ; then
316 mkdir -p ${OBJ}/.putty
317
318 # Add a PuTTY key to authorized_keys
319 rm -f ${OBJ}/putty.rsa2
320 puttygen -t rsa -o ${OBJ}/putty.rsa2 < /dev/null > /dev/null
321 puttygen -O public-openssh ${OBJ}/putty.rsa2 \
322 >> $OBJ/authorized_keys_$USER
323
324 # Convert rsa2 host key to PuTTY format
325 ${SRC}/ssh2putty.sh 127.0.0.1 $PORT $OBJ/rsa > \
326 ${OBJ}/.putty/sshhostkeys
327 ${SRC}/ssh2putty.sh 127.0.0.1 22 $OBJ/rsa >> \
328 ${OBJ}/.putty/sshhostkeys
329
330 # Setup proxied session
331 mkdir -p ${OBJ}/.putty/sessions
332 rm -f ${OBJ}/.putty/sessions/localhost_proxy
333 echo "Hostname=127.0.0.1" >> ${OBJ}/.putty/sessions/localhost_proxy
334 echo "PortNumber=$PORT" >> ${OBJ}/.putty/sessions/localhost_proxy
335 echo "ProxyMethod=5" >> ${OBJ}/.putty/sessions/localhost_proxy
336 echo "ProxyTelnetCommand=sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSH_LOGFILE} -i -f $OBJ/sshd_proxy" >> ${OBJ}/.putty/sessions/localhost_proxy
337
338 REGRESS_INTEROP_PUTTY=yes
339fi
340
272# create a proxy version of the client config 341# create a proxy version of the client config
273( 342(
274 cat $OBJ/ssh_config 343 cat $OBJ/ssh_config
@@ -281,8 +350,8 @@ ${SSHD} -t -f $OBJ/sshd_proxy || fatal "sshd_proxy broken"
281start_sshd () 350start_sshd ()
282{ 351{
283 # start sshd 352 # start sshd
284 $SUDO ${SSHD} -f $OBJ/sshd_config -t || fatal "sshd_config broken" 353 $SUDO ${SSHD} -f $OBJ/sshd_config "$@" -t || fatal "sshd_config broken"
285 $SUDO ${SSHD} -f $OBJ/sshd_config -e >>$TEST_SSH_LOGFILE 2>&1 354 $SUDO ${SSHD} -f $OBJ/sshd_config -e "$@" >>$TEST_SSH_LOGFILE 2>&1
286 355
287 trace "wait for sshd" 356 trace "wait for sshd"
288 i=0; 357 i=0;