summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2013-09-14 23:42:11 +0100
committerColin Watson <cjwatson@debian.org>2013-09-14 23:42:11 +0100
commit327155e6824b3ee13837bdde04e4eb47e147ff46 (patch)
tree8f8743122403c7a2e6ed919156711fb1520c657f /regress
parent0334ce32304e9ba2a10ee5ca49ca6e8ff3ba6cf4 (diff)
parent74e339b8f8936bc0d985e053a076d0c9b5e9ea51 (diff)
* New upstream release (http://www.openssh.com/txt/release-6.3).
- sftp(1): add support for resuming partial downloads using the "reget" command and on the sftp commandline or on the "get" commandline using the "-a" (append) option (closes: #158590). - ssh(1): add an "IgnoreUnknown" configuration option to selectively suppress errors arising from unknown configuration directives (closes: #436052). - sftp(1): update progressmeter when data is acknowledged, not when it's sent (partially addresses #708372). - ssh(1): do not fatally exit when attempting to cleanup multiplexing- created channels that are incompletely opened (closes: #651357).
Diffstat (limited to 'regress')
-rw-r--r--regress/Makefile13
-rw-r--r--regress/agent-getpeereid.sh3
-rw-r--r--regress/agent-timeout.sh2
-rw-r--r--regress/agent.sh4
-rw-r--r--regress/bsd.regress.mk79
-rw-r--r--regress/cert-hostkey.sh48
-rw-r--r--regress/cert-userkey.sh10
-rw-r--r--regress/cfgmatch.sh17
-rw-r--r--regress/cipher-speed.sh2
-rw-r--r--regress/conch-ciphers.sh5
-rw-r--r--regress/dynamic-forward.sh4
-rw-r--r--regress/forcecommand.sh10
-rw-r--r--regress/forwarding.sh28
-rw-r--r--regress/integrity.sh22
-rw-r--r--regress/keytype.sh4
-rw-r--r--regress/krl.sh4
-rw-r--r--regress/localcommand.sh2
-rw-r--r--regress/login-timeout.sh2
-rwxr-xr-xregress/modpipe.c4
-rw-r--r--regress/multiplex.sh55
-rw-r--r--regress/portnum.sh2
-rw-r--r--regress/proto-version.sh4
-rw-r--r--regress/proxy-connect.sh10
-rw-r--r--regress/putty-ciphers.sh5
-rw-r--r--regress/putty-kex.sh5
-rw-r--r--regress/putty-transfer.sh5
-rw-r--r--regress/reexec.sh8
-rw-r--r--regress/rekey.sh103
-rwxr-xr-xregress/runtests.sh13
-rw-r--r--regress/scp.sh4
-rw-r--r--regress/sftp-badcmds.sh4
-rw-r--r--regress/sftp-batch.sh4
-rw-r--r--regress/sftp-chroot.sh25
-rw-r--r--regress/sftp-cmds.sh12
-rw-r--r--regress/sftp.sh5
-rw-r--r--regress/ssh-com-client.sh6
-rw-r--r--regress/ssh-com-sftp.sh4
-rw-r--r--regress/ssh-com.sh4
-rw-r--r--regress/sshd-log-wrapper.sh4
-rw-r--r--regress/stderr-after-eof.sh20
-rw-r--r--regress/stderr-data.sh6
-rw-r--r--regress/test-exec.sh143
-rw-r--r--regress/transfer.sh5
-rw-r--r--regress/try-ciphers.sh2
44 files changed, 392 insertions, 329 deletions
diff --git a/regress/Makefile b/regress/Makefile
index 6ef5d9cce..ab2a6ae7b 100644
--- a/regress/Makefile
+++ b/regress/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.62 2013/01/18 00:45:29 djm Exp $ 1# $OpenBSD: Makefile,v 1.65 2013/04/18 02:46:12 djm Exp $
2 2
3REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t-exec 3REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t-exec
4tests: $(REGRESS_TARGETS) 4tests: $(REGRESS_TARGETS)
@@ -8,6 +8,7 @@ interop interop-tests: t-exec-interop
8 8
9clean: 9clean:
10 for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done 10 for F in $(CLEANFILES); do rm -f $(OBJ)$$F; done
11 test -z "${SUDO}" || ${SUDO} rm -f ${SUDO_CLEAN}
11 rm -rf $(OBJ).putty 12 rm -rf $(OBJ).putty
12 13
13distclean: clean 14distclean: clean
@@ -38,6 +39,7 @@ LTESTS= connect \
38 key-options \ 39 key-options \
39 scp \ 40 scp \
40 sftp \ 41 sftp \
42 sftp-chroot \
41 sftp-cmds \ 43 sftp-cmds \
42 sftp-badcmds \ 44 sftp-badcmds \
43 sftp-batch \ 45 sftp-batch \
@@ -82,8 +84,11 @@ CLEANFILES= t2.out t3.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
82 putty.rsa2 sshd_proxy_orig ssh_proxy_bak \ 84 putty.rsa2 sshd_proxy_orig ssh_proxy_bak \
83 key.rsa-* key.dsa-* key.ecdsa-* \ 85 key.rsa-* key.dsa-* key.ecdsa-* \
84 authorized_principals_${USER} expect actual ready \ 86 authorized_principals_${USER} expect actual ready \
85 sshd_proxy.* authorized_keys_${USER}.* modpipe revoked-* krl-* 87 sshd_proxy.* authorized_keys_${USER}.* modpipe revoked-* krl-* \
88 ssh.log failed-ssh.log sshd.log failed-sshd.log \
89 regress.log failed-regress.log ssh-log-wrapper.sh
86 90
91SUDO_CLEAN+= /var/run/testdata_${USER} /var/run/keycommand_${USER}
87 92
88# Enable all malloc(3) randomisations and checks 93# Enable all malloc(3) randomisations and checks
89TEST_ENV= "MALLOC_OPTIONS=AFGJPRX" 94TEST_ENV= "MALLOC_OPTIONS=AFGJPRX"
@@ -150,14 +155,14 @@ t-exec: ${LTESTS:=.sh}
150 @if [ "x$?" = "x" ]; then exit 0; fi; \ 155 @if [ "x$?" = "x" ]; then exit 0; fi; \
151 for TEST in ""$?; do \ 156 for TEST in ""$?; do \
152 echo "run test $${TEST}" ... 1>&2; \ 157 echo "run test $${TEST}" ... 1>&2; \
153 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \ 158 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
154 done 159 done
155 160
156t-exec-interop: ${INTEROP_TESTS:=.sh} 161t-exec-interop: ${INTEROP_TESTS:=.sh}
157 @if [ "x$?" = "x" ]; then exit 0; fi; \ 162 @if [ "x$?" = "x" ]; then exit 0; fi; \
158 for TEST in ""$?; do \ 163 for TEST in ""$?; do \
159 echo "run test $${TEST}" ... 1>&2; \ 164 echo "run test $${TEST}" ... 1>&2; \
160 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \ 165 (env SUDO="${SUDO}" TEST_ENV=${TEST_ENV} ${TEST_SHELL} ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
161 done 166 done
162 167
163# Not run by default 168# Not run by default
diff --git a/regress/agent-getpeereid.sh b/regress/agent-getpeereid.sh
index faf654c04..d5ae2d6e2 100644
--- a/regress/agent-getpeereid.sh
+++ b/regress/agent-getpeereid.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: agent-getpeereid.sh,v 1.4 2007/11/25 15:35:09 jmc Exp $ 1# $OpenBSD: agent-getpeereid.sh,v 1.5 2013/05/17 10:33:09 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="disallow agent attach from other uid" 4tid="disallow agent attach from other uid"
@@ -18,7 +18,6 @@ if [ -z "$SUDO" ]; then
18 exit 0 18 exit 0
19fi 19fi
20 20
21
22trace "start agent" 21trace "start agent"
23eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null 22eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null
24r=$? 23r=$?
diff --git a/regress/agent-timeout.sh b/regress/agent-timeout.sh
index 3a40e7af8..68826594e 100644
--- a/regress/agent-timeout.sh
+++ b/regress/agent-timeout.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: agent-timeout.sh,v 1.1 2002/06/06 00:38:40 markus Exp $ 1# $OpenBSD: agent-timeout.sh,v 1.2 2013/05/17 01:16:09 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="agent timeout test" 4tid="agent timeout test"
diff --git a/regress/agent.sh b/regress/agent.sh
index 094cf694b..be7d91334 100644
--- a/regress/agent.sh
+++ b/regress/agent.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: agent.sh,v 1.7 2007/11/25 15:35:09 jmc Exp $ 1# $OpenBSD: agent.sh,v 1.8 2013/05/17 00:37:40 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="simple agent test" 4tid="simple agent test"
@@ -19,7 +19,7 @@ else
19 fail "ssh-add -l did not fail with exit code 1" 19 fail "ssh-add -l did not fail with exit code 1"
20 fi 20 fi
21 trace "overwrite authorized keys" 21 trace "overwrite authorized keys"
22 echon > $OBJ/authorized_keys_$USER 22 printf '' > $OBJ/authorized_keys_$USER
23 for t in rsa rsa1; do 23 for t in rsa rsa1; do
24 # generate user key for agent 24 # generate user key for agent
25 rm -f $OBJ/$t-agent 25 rm -f $OBJ/$t-agent
diff --git a/regress/bsd.regress.mk b/regress/bsd.regress.mk
deleted file mode 100644
index 9b8011a01..000000000
--- a/regress/bsd.regress.mk
+++ /dev/null
@@ -1,79 +0,0 @@
1# $OpenBSD: bsd.regress.mk,v 1.9 2002/02/17 01:10:15 marc Exp $
2# No man pages for regression tests.
3NOMAN=
4
5# No installation.
6install:
7
8# If REGRESSTARGETS is defined and PROG is not defined, set NOPROG
9.if defined(REGRESSTARGETS) && !defined(PROG)
10NOPROG=
11.endif
12
13.include <bsd.prog.mk>
14
15.MAIN: all
16all: regress
17
18# XXX - Need full path to REGRESSLOG, otherwise there will be much pain.
19
20REGRESSLOG?=/dev/null
21REGRESSNAME=${.CURDIR:S/${BSDSRCDIR}\/regress\///}
22
23.if defined(PROG) && !empty(PROG)
24run-regress-${PROG}: ${PROG}
25 ./${PROG}
26.endif
27
28.if !defined(REGRESSTARGETS)
29REGRESSTARGETS=run-regress-${PROG}
30. if defined(REGRESSSKIP)
31REGRESSSKIPTARGETS=run-regress-${PROG}
32. endif
33.endif
34
35REGRESSSKIPSLOW?=no
36
37#.if (${REGRESSSKIPSLOW:L} == "yes") && defined(REGRESSSLOWTARGETS)
38
39.if (${REGRESSSKIPSLOW} == "yes") && defined(REGRESSSLOWTARGETS)
40REGRESSSKIPTARGETS+=${REGRESSSLOWTARGETS}
41.endif
42
43.if defined(REGRESSROOTTARGETS)
44ROOTUSER!=id -g
45SUDO?=
46. if (${ROOTUSER} != 0) && empty(SUDO)
47REGRESSSKIPTARGETS+=${REGRESSROOTTARGETS}
48. endif
49.endif
50
51REGRESSSKIPTARGETS?=
52
53regress:
54.for RT in ${REGRESSTARGETS}
55. if ${REGRESSSKIPTARGETS:M${RT}}
56 @echo -n "SKIP " >> ${REGRESSLOG}
57. else
58# XXX - we need a better method to see if a test fails due to timeout or just
59# normal failure.
60. if !defined(REGRESSMAXTIME)
61 @if cd ${.CURDIR} && ${MAKE} ${RT}; then \
62 echo -n "SUCCESS " >> ${REGRESSLOG} ; \
63 else \
64 echo -n "FAIL " >> ${REGRESSLOG} ; \
65 echo FAILED ; \
66 fi
67. else
68 @if cd ${.CURDIR} && (ulimit -t ${REGRESSMAXTIME} ; ${MAKE} ${RT}); then \
69 echo -n "SUCCESS " >> ${REGRESSLOG} ; \
70 else \
71 echo -n "FAIL (possible timeout) " >> ${REGRESSLOG} ; \
72 echo FAILED ; \
73 fi
74. endif
75. endif
76 @echo ${REGRESSNAME}/${RT:S/^run-regress-//} >> ${REGRESSLOG}
77.endfor
78
79.PHONY: regress
diff --git a/regress/cert-hostkey.sh b/regress/cert-hostkey.sh
index 6216abd87..35cd39293 100644
--- a/regress/cert-hostkey.sh
+++ b/regress/cert-hostkey.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: cert-hostkey.sh,v 1.6 2011/05/20 02:43:36 djm Exp $ 1# $OpenBSD: cert-hostkey.sh,v 1.7 2013/05/17 00:37:40 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="certified host keys" 4tid="certified host keys"
@@ -18,8 +18,8 @@ HOSTS='localhost-with-alias,127.0.0.1,::1'
18${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/host_ca_key ||\ 18${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/host_ca_key ||\
19 fail "ssh-keygen of host_ca_key failed" 19 fail "ssh-keygen of host_ca_key failed"
20( 20(
21 echon '@cert-authority ' 21 printf '@cert-authority '
22 echon "$HOSTS " 22 printf "$HOSTS "
23 cat $OBJ/host_ca_key.pub 23 cat $OBJ/host_ca_key.pub
24) > $OBJ/known_hosts-cert 24) > $OBJ/known_hosts-cert
25 25
@@ -66,25 +66,25 @@ done
66 66
67# Revoked certificates with key present 67# Revoked certificates with key present
68( 68(
69 echon '@cert-authority ' 69 printf '@cert-authority '
70 echon "$HOSTS " 70 printf "$HOSTS "
71 cat $OBJ/host_ca_key.pub 71 cat $OBJ/host_ca_key.pub
72 echon '@revoked ' 72 printf '@revoked '
73 echon "* " 73 printf "* "
74 cat $OBJ/cert_host_key_rsa.pub 74 cat $OBJ/cert_host_key_rsa.pub
75 if test "x$TEST_SSH_ECC" = "xyes"; then 75 if test "x$TEST_SSH_ECC" = "xyes"; then
76 echon '@revoked ' 76 printf '@revoked '
77 echon "* " 77 printf "* "
78 cat $OBJ/cert_host_key_ecdsa.pub 78 cat $OBJ/cert_host_key_ecdsa.pub
79 fi 79 fi
80 echon '@revoked ' 80 printf '@revoked '
81 echon "* " 81 printf "* "
82 cat $OBJ/cert_host_key_dsa.pub 82 cat $OBJ/cert_host_key_dsa.pub
83 echon '@revoked ' 83 printf '@revoked '
84 echon "* " 84 printf "* "
85 cat $OBJ/cert_host_key_rsa_v00.pub 85 cat $OBJ/cert_host_key_rsa_v00.pub
86 echon '@revoked ' 86 printf '@revoked '
87 echon "* " 87 printf "* "
88 cat $OBJ/cert_host_key_dsa_v00.pub 88 cat $OBJ/cert_host_key_dsa_v00.pub
89) > $OBJ/known_hosts-cert 89) > $OBJ/known_hosts-cert
90for privsep in yes no ; do 90for privsep in yes no ; do
@@ -108,11 +108,11 @@ done
108 108
109# Revoked CA 109# Revoked CA
110( 110(
111 echon '@cert-authority ' 111 printf '@cert-authority '
112 echon "$HOSTS " 112 printf "$HOSTS "
113 cat $OBJ/host_ca_key.pub 113 cat $OBJ/host_ca_key.pub
114 echon '@revoked ' 114 printf '@revoked '
115 echon "* " 115 printf "* "
116 cat $OBJ/host_ca_key.pub 116 cat $OBJ/host_ca_key.pub
117) > $OBJ/known_hosts-cert 117) > $OBJ/known_hosts-cert
118for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00 ; do 118for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00 ; do
@@ -132,8 +132,8 @@ done
132 132
133# Create a CA key and add it to known hosts 133# Create a CA key and add it to known hosts
134( 134(
135 echon '@cert-authority ' 135 printf '@cert-authority '
136 echon "$HOSTS " 136 printf "$HOSTS "
137 cat $OBJ/host_ca_key.pub 137 cat $OBJ/host_ca_key.pub
138) > $OBJ/known_hosts-cert 138) > $OBJ/known_hosts-cert
139 139
@@ -200,7 +200,7 @@ for v in v01 v00 ; do
200 -n $HOSTS $OBJ/cert_host_key_${ktype} || 200 -n $HOSTS $OBJ/cert_host_key_${ktype} ||
201 fail "couldn't sign cert_host_key_${ktype}" 201 fail "couldn't sign cert_host_key_${ktype}"
202 ( 202 (
203 echon "$HOSTS " 203 printf "$HOSTS "
204 cat $OBJ/cert_host_key_${ktype}.pub 204 cat $OBJ/cert_host_key_${ktype}.pub
205 ) > $OBJ/known_hosts-cert 205 ) > $OBJ/known_hosts-cert
206 ( 206 (
@@ -220,8 +220,8 @@ done
220 220
221# Wrong certificate 221# Wrong certificate
222( 222(
223 echon '@cert-authority ' 223 printf '@cert-authority '
224 echon "$HOSTS " 224 printf "$HOSTS "
225 cat $OBJ/host_ca_key.pub 225 cat $OBJ/host_ca_key.pub
226) > $OBJ/known_hosts-cert 226) > $OBJ/known_hosts-cert
227for v in v01 v00 ; do 227for v in v01 v00 ; do
diff --git a/regress/cert-userkey.sh b/regress/cert-userkey.sh
index 3bba9f8f2..6018b38f4 100644
--- a/regress/cert-userkey.sh
+++ b/regress/cert-userkey.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: cert-userkey.sh,v 1.10 2013/01/18 00:45:29 djm Exp $ 1# $OpenBSD: cert-userkey.sh,v 1.11 2013/05/17 00:37:40 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="certified user keys" 4tid="certified user keys"
@@ -126,7 +126,7 @@ for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00 ; do
126 # Wrong principals list 126 # Wrong principals list
127 verbose "$tid: ${_prefix} wrong principals key option" 127 verbose "$tid: ${_prefix} wrong principals key option"
128 ( 128 (
129 echon 'cert-authority,principals="gregorsamsa" ' 129 printf 'cert-authority,principals="gregorsamsa" '
130 cat $OBJ/user_ca_key.pub 130 cat $OBJ/user_ca_key.pub
131 ) > $OBJ/authorized_keys_$USER 131 ) > $OBJ/authorized_keys_$USER
132 ${SSH} -2i $OBJ/cert_user_key_${ktype} \ 132 ${SSH} -2i $OBJ/cert_user_key_${ktype} \
@@ -138,7 +138,7 @@ for ktype in rsa dsa $ecdsa rsa_v00 dsa_v00 ; do
138 # Correct principals list 138 # Correct principals list
139 verbose "$tid: ${_prefix} correct principals key option" 139 verbose "$tid: ${_prefix} correct principals key option"
140 ( 140 (
141 echon 'cert-authority,principals="mekmitasdigoat" ' 141 printf 'cert-authority,principals="mekmitasdigoat" '
142 cat $OBJ/user_ca_key.pub 142 cat $OBJ/user_ca_key.pub
143 ) > $OBJ/authorized_keys_$USER 143 ) > $OBJ/authorized_keys_$USER
144 ${SSH} -2i $OBJ/cert_user_key_${ktype} \ 144 ${SSH} -2i $OBJ/cert_user_key_${ktype} \
@@ -154,7 +154,7 @@ basic_tests() {
154 if test "x$auth" = "xauthorized_keys" ; then 154 if test "x$auth" = "xauthorized_keys" ; then
155 # Add CA to authorized_keys 155 # Add CA to authorized_keys
156 ( 156 (
157 echon 'cert-authority ' 157 printf 'cert-authority '
158 cat $OBJ/user_ca_key.pub 158 cat $OBJ/user_ca_key.pub
159 ) > $OBJ/authorized_keys_$USER 159 ) > $OBJ/authorized_keys_$USER
160 else 160 else
@@ -264,7 +264,7 @@ test_one() {
264 if test "x$auth" = "xauthorized_keys" ; then 264 if test "x$auth" = "xauthorized_keys" ; then
265 # Add CA to authorized_keys 265 # Add CA to authorized_keys
266 ( 266 (
267 echon "cert-authority${auth_opt} " 267 printf "cert-authority${auth_opt} "
268 cat $OBJ/user_ca_key.pub 268 cat $OBJ/user_ca_key.pub
269 ) > $OBJ/authorized_keys_$USER 269 ) > $OBJ/authorized_keys_$USER
270 else 270 else
diff --git a/regress/cfgmatch.sh b/regress/cfgmatch.sh
index 0603fab64..80cf22930 100644
--- a/regress/cfgmatch.sh
+++ b/regress/cfgmatch.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: cfgmatch.sh,v 1.6 2011/06/03 05:35:10 dtucker Exp $ 1# $OpenBSD: cfgmatch.sh,v 1.8 2013/05/17 00:37:40 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="sshd_config match" 4tid="sshd_config match"
@@ -15,7 +15,7 @@ start_client()
15 rm -f $pidfile 15 rm -f $pidfile
16 ${SSH} -q -$p $fwd "$@" somehost \ 16 ${SSH} -q -$p $fwd "$@" somehost \
17 exec sh -c \'"echo \$\$ > $pidfile; exec sleep 100"\' \ 17 exec sh -c \'"echo \$\$ > $pidfile; exec sleep 100"\' \
18 >>$TEST_SSH_LOGFILE 2>&1 & 18 >>$TEST_REGRESS_LOGFILE 2>&1 &
19 client_pid=$! 19 client_pid=$!
20 # Wait for remote end 20 # Wait for remote end
21 n=0 21 n=0
@@ -34,21 +34,20 @@ stop_client()
34 pid=`cat $pidfile` 34 pid=`cat $pidfile`
35 if [ ! -z "$pid" ]; then 35 if [ ! -z "$pid" ]; then
36 kill $pid 36 kill $pid
37 sleep 1
38 fi 37 fi
39 wait 38 wait
40} 39}
41 40
42cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak 41cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
43grep -v AuthorizedKeysFile $OBJ/sshd_proxy_bak > $OBJ/sshd_proxy
44echo "AuthorizedKeysFile /dev/null" >>$OBJ/sshd_proxy
45echo "PermitOpen 127.0.0.1:1" >>$OBJ/sshd_config 42echo "PermitOpen 127.0.0.1:1" >>$OBJ/sshd_config
46echo "Match user $USER" >>$OBJ/sshd_proxy
47echo "AuthorizedKeysFile /dev/null $OBJ/authorized_keys_%u" >>$OBJ/sshd_proxy
48echo "Match Address 127.0.0.1" >>$OBJ/sshd_config 43echo "Match Address 127.0.0.1" >>$OBJ/sshd_config
49echo "PermitOpen 127.0.0.1:$PORT" >>$OBJ/sshd_config 44echo "PermitOpen 127.0.0.1:$PORT" >>$OBJ/sshd_config
50 45
46grep -v AuthorizedKeysFile $OBJ/sshd_proxy_bak > $OBJ/sshd_proxy
47echo "AuthorizedKeysFile /dev/null" >>$OBJ/sshd_proxy
51echo "PermitOpen 127.0.0.1:1" >>$OBJ/sshd_proxy 48echo "PermitOpen 127.0.0.1:1" >>$OBJ/sshd_proxy
49echo "Match user $USER" >>$OBJ/sshd_proxy
50echo "AuthorizedKeysFile /dev/null $OBJ/authorized_keys_%u" >>$OBJ/sshd_proxy
52echo "Match Address 127.0.0.1" >>$OBJ/sshd_proxy 51echo "Match Address 127.0.0.1" >>$OBJ/sshd_proxy
53echo "PermitOpen 127.0.0.1:$PORT" >>$OBJ/sshd_proxy 52echo "PermitOpen 127.0.0.1:$PORT" >>$OBJ/sshd_proxy
54 53
@@ -75,9 +74,9 @@ for p in 1 2; do
75done 74done
76 75
77# Retry previous with key option, should also be denied. 76# Retry previous with key option, should also be denied.
78echon 'permitopen="127.0.0.1:'$PORT'" ' >$OBJ/authorized_keys_$USER 77printf 'permitopen="127.0.0.1:'$PORT'" ' >$OBJ/authorized_keys_$USER
79cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER 78cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER
80echon 'permitopen="127.0.0.1:'$PORT'" ' >>$OBJ/authorized_keys_$USER 79printf 'permitopen="127.0.0.1:'$PORT'" ' >>$OBJ/authorized_keys_$USER
81cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER 80cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER
82for p in 1 2; do 81for p in 1 2; do
83 trace "match permitopen proxy w/key opts proto $p" 82 trace "match permitopen proxy w/key opts proto $p"
diff --git a/regress/cipher-speed.sh b/regress/cipher-speed.sh
index 65e5f35ec..489d9f5fa 100644
--- a/regress/cipher-speed.sh
+++ b/regress/cipher-speed.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: cipher-speed.sh,v 1.7 2013/01/12 11:23:53 djm Exp $ 1# $OpenBSD: cipher-speed.sh,v 1.9 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="cipher speed" 4tid="cipher speed"
diff --git a/regress/conch-ciphers.sh b/regress/conch-ciphers.sh
index 5b65cd993..199d863a0 100644
--- a/regress/conch-ciphers.sh
+++ b/regress/conch-ciphers.sh
@@ -1,11 +1,8 @@
1# $OpenBSD: conch-ciphers.sh,v 1.2 2008/06/30 10:43:03 djm Exp $ 1# $OpenBSD: conch-ciphers.sh,v 1.3 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="conch ciphers" 4tid="conch ciphers"
5 5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8
9if test "x$REGRESS_INTEROP_CONCH" != "xyes" ; then 6if test "x$REGRESS_INTEROP_CONCH" != "xyes" ; then
10 echo "conch interop tests not enabled" 7 echo "conch interop tests not enabled"
11 exit 0 8 exit 0
diff --git a/regress/dynamic-forward.sh b/regress/dynamic-forward.sh
index d1ab8059b..42fa8acdc 100644
--- a/regress/dynamic-forward.sh
+++ b/regress/dynamic-forward.sh
@@ -1,12 +1,10 @@
1# $OpenBSD: dynamic-forward.sh,v 1.9 2011/06/03 00:29:52 dtucker Exp $ 1# $OpenBSD: dynamic-forward.sh,v 1.10 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="dynamic forwarding" 4tid="dynamic forwarding"
5 5
6FWDPORT=`expr $PORT + 1` 6FWDPORT=`expr $PORT + 1`
7 7
8DATA=/bin/ls${EXEEXT}
9
10if have_prog nc && nc -h 2>&1 | grep "proxy address" >/dev/null; then 8if have_prog nc && nc -h 2>&1 | grep "proxy address" >/dev/null; then
11 proxycmd="nc -x 127.0.0.1:$FWDPORT -X" 9 proxycmd="nc -x 127.0.0.1:$FWDPORT -X"
12elif have_prog connect; then 10elif have_prog connect; then
diff --git a/regress/forcecommand.sh b/regress/forcecommand.sh
index 99e51a60f..44d2b7ffd 100644
--- a/regress/forcecommand.sh
+++ b/regress/forcecommand.sh
@@ -1,13 +1,13 @@
1# $OpenBSD: forcecommand.sh,v 1.1 2006/07/19 13:09:28 dtucker Exp $ 1# $OpenBSD: forcecommand.sh,v 1.2 2013/05/17 00:37:40 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="forced command" 4tid="forced command"
5 5
6cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak 6cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
7 7
8echon 'command="true" ' >$OBJ/authorized_keys_$USER 8printf 'command="true" ' >$OBJ/authorized_keys_$USER
9cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER 9cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER
10echon 'command="true" ' >>$OBJ/authorized_keys_$USER 10printf 'command="true" ' >>$OBJ/authorized_keys_$USER
11cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER 11cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER
12 12
13for p in 1 2; do 13for p in 1 2; do
@@ -16,9 +16,9 @@ for p in 1 2; do
16 fail "forced command in key proto $p" 16 fail "forced command in key proto $p"
17done 17done
18 18
19echon 'command="false" ' >$OBJ/authorized_keys_$USER 19printf 'command="false" ' >$OBJ/authorized_keys_$USER
20cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER 20cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER
21echon 'command="false" ' >>$OBJ/authorized_keys_$USER 21printf 'command="false" ' >>$OBJ/authorized_keys_$USER
22cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER 22cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER
23 23
24cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy 24cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
diff --git a/regress/forwarding.sh b/regress/forwarding.sh
index f9c367beb..94873f22c 100644
--- a/regress/forwarding.sh
+++ b/regress/forwarding.sh
@@ -1,7 +1,8 @@
1# $OpenBSD: forwarding.sh,v 1.8 2012/06/01 00:47:35 djm Exp $ 1# $OpenBSD: forwarding.sh,v 1.11 2013/06/10 21:56:43 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="local and remote forwarding" 4tid="local and remote forwarding"
5
5DATA=/bin/ls${EXEEXT} 6DATA=/bin/ls${EXEEXT}
6 7
7start_sshd 8start_sshd
@@ -26,9 +27,9 @@ for p in 1 2; do
26 27
27 trace "transfer over forwarded channels and check result" 28 trace "transfer over forwarded channels and check result"
28 ${SSH} -$q -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \ 29 ${SSH} -$q -F $OBJ/ssh_config -p$last -o 'ConnectionAttempts=4' \
29 somehost cat $DATA > $OBJ/ls.copy 30 somehost cat ${DATA} > ${COPY}
30 test -f $OBJ/ls.copy || fail "failed copy $DATA" 31 test -f ${COPY} || fail "failed copy of ${DATA}"
31 cmp $DATA $OBJ/ls.copy || fail "corrupted copy of $DATA" 32 cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}"
32 33
33 sleep 10 34 sleep 10
34done 35done
@@ -75,7 +76,7 @@ for p in 1 2; do
75 else 76 else
76 # this one should fail 77 # this one should fail
77 ${SSH} -$p -F $OBJ/ssh_config -p ${base}01 true \ 78 ${SSH} -$p -F $OBJ/ssh_config -p ${base}01 true \
78 2>>$TEST_SSH_LOGFILE && \ 79 >>$TEST_REGRESS_LOGFILE 2>&1 && \
79 fail "local forwarding not cleared" 80 fail "local forwarding not cleared"
80 fi 81 fi
81 sleep 10 82 sleep 10
@@ -88,7 +89,7 @@ for p in 1 2; do
88 else 89 else
89 # this one should fail 90 # this one should fail
90 ${SSH} -$p -F $OBJ/ssh_config -p ${base}01 true \ 91 ${SSH} -$p -F $OBJ/ssh_config -p ${base}01 true \
91 2>>$TEST_SSH_LOGFILE && \ 92 >>$TEST_REGRESS_LOGFILE 2>&1 && \
92 fail "remote forwarding not cleared" 93 fail "remote forwarding not cleared"
93 fi 94 fi
94 sleep 10 95 sleep 10
@@ -103,3 +104,18 @@ for p in 2; do
103 fail "stdio forwarding proto $p" 104 fail "stdio forwarding proto $p"
104 fi 105 fi
105done 106done
107
108echo "LocalForward ${base}01 127.0.0.1:$PORT" >> $OBJ/ssh_config
109echo "RemoteForward ${base}02 127.0.0.1:${base}01" >> $OBJ/ssh_config
110for p in 1 2; do
111 trace "config file: start forwarding, fork to background"
112 ${SSH} -$p -F $OBJ/ssh_config -f somehost sleep 10
113
114 trace "config file: transfer over forwarded channels and check result"
115 ${SSH} -F $OBJ/ssh_config -p${base}02 -o 'ConnectionAttempts=4' \
116 somehost cat ${DATA} > ${COPY}
117 test -f ${COPY} || fail "failed copy of ${DATA}"
118 cmp ${DATA} ${COPY} || fail "corrupted copy of ${DATA}"
119
120 wait
121done
diff --git a/regress/integrity.sh b/regress/integrity.sh
index 4d46926d5..1d17fe10a 100644
--- a/regress/integrity.sh
+++ b/regress/integrity.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: integrity.sh,v 1.7 2013/02/20 08:27:50 djm Exp $ 1# $OpenBSD: integrity.sh,v 1.10 2013/05/17 01:32:11 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="integrity" 4tid="integrity"
@@ -21,12 +21,13 @@ config_defined HAVE_EVP_SHA256 &&
21config_defined OPENSSL_HAVE_EVPGCM && \ 21config_defined OPENSSL_HAVE_EVPGCM && \
22 macs="$macs aes128-gcm@openssh.com aes256-gcm@openssh.com" 22 macs="$macs aes128-gcm@openssh.com aes256-gcm@openssh.com"
23 23
24# sshd-command for proxy (see test-exec.sh) 24# avoid DH group exchange as the extra traffic makes it harder to get the
25cmd="$SUDO sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSH_LOGFILE} -i -f $OBJ/sshd_proxy" 25# offset into the stream right.
26echo "KexAlgorithms diffie-hellman-group14-sha1,diffie-hellman-group1-sha1" \
27 >> $OBJ/ssh_proxy
26 28
27jot() { 29# sshd-command for proxy (see test-exec.sh)
28 awk "BEGIN { for (i = $2; i < $2 + $1; i++) { printf \"%d\n\", i } exit }" 30cmd="$SUDO sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSHD_LOGFILE} -i -f $OBJ/sshd_proxy"
29}
30 31
31for m in $macs; do 32for m in $macs; do
32 trace "test $tid: mac $m" 33 trace "test $tid: mac $m"
@@ -47,14 +48,15 @@ for m in $macs; do
47 aes*gcm*) macopt="-c $m";; 48 aes*gcm*) macopt="-c $m";;
48 *) macopt="-m $m";; 49 *) macopt="-m $m";;
49 esac 50 esac
50 output=`${SSH} $macopt -2F $OBJ/ssh_proxy -o "$pxy" \ 51 verbose "test $tid: $m @$off"
51 999.999.999.999 'printf "%4096s" " "' 2>&1` 52 ${SSH} $macopt -2F $OBJ/ssh_proxy -o "$pxy" \
53 999.999.999.999 'printf "%4096s" " "' >/dev/null
52 if [ $? -eq 0 ]; then 54 if [ $? -eq 0 ]; then
53 fail "ssh -m $m succeeds with bit-flip at $off" 55 fail "ssh -m $m succeeds with bit-flip at $off"
54 fi 56 fi
55 ecnt=`expr $ecnt + 1` 57 ecnt=`expr $ecnt + 1`
56 output=`echo $output | tr -s '\r\n' '.'` 58 output=$(tail -2 $TEST_SSH_LOGFILE | egrep -v "^debug" | \
57 verbose "test $tid: $m @$off $output" 59 tr -s '\r\n' '.')
58 case "$output" in 60 case "$output" in
59 Bad?packet*) elen=`expr $elen + 1`; skip=3;; 61 Bad?packet*) elen=`expr $elen + 1`; skip=3;;
60 Corrupted?MAC* | Decryption?integrity?check?failed*) 62 Corrupted?MAC* | Decryption?integrity?check?failed*)
diff --git a/regress/keytype.sh b/regress/keytype.sh
index cb40c6864..59586bf0d 100644
--- a/regress/keytype.sh
+++ b/regress/keytype.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: keytype.sh,v 1.1 2010/09/02 16:12:55 markus Exp $ 1# $OpenBSD: keytype.sh,v 1.2 2013/05/17 00:37:40 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="login with different key types" 4tid="login with different key types"
@@ -40,7 +40,7 @@ for ut in $ktypes; do
40 echo IdentityFile $OBJ/key.$ut 40 echo IdentityFile $OBJ/key.$ut
41 ) > $OBJ/ssh_proxy 41 ) > $OBJ/ssh_proxy
42 ( 42 (
43 echon 'localhost-with-alias,127.0.0.1,::1 ' 43 printf 'localhost-with-alias,127.0.0.1,::1 '
44 cat $OBJ/key.$ht.pub 44 cat $OBJ/key.$ht.pub
45 ) > $OBJ/known_hosts 45 ) > $OBJ/known_hosts
46 cat $OBJ/key.$ut.pub > $OBJ/authorized_keys_$USER 46 cat $OBJ/key.$ut.pub > $OBJ/authorized_keys_$USER
diff --git a/regress/krl.sh b/regress/krl.sh
index 62a239c38..de9cc8764 100644
--- a/regress/krl.sh
+++ b/regress/krl.sh
@@ -39,10 +39,6 @@ serial: 799
39serial: 599-701 39serial: 599-701
40EOF 40EOF
41 41
42jot() {
43 awk "BEGIN { for (i = $2; i < $2 + $1; i++) { printf \"%d\n\", i } exit }"
44}
45
46# A specification that revokes some certificated by key ID. 42# A specification that revokes some certificated by key ID.
47touch $OBJ/revoked-keyid 43touch $OBJ/revoked-keyid
48for n in 1 2 3 4 10 15 30 50 `jot 500 300` 999 1000 1001 1002; do 44for n in 1 2 3 4 10 15 30 50 `jot 500 300` 999 1000 1001 1002; do
diff --git a/regress/localcommand.sh b/regress/localcommand.sh
index feade7a9d..8a9b56971 100644
--- a/regress/localcommand.sh
+++ b/regress/localcommand.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: localcommand.sh,v 1.1 2007/10/29 06:57:13 dtucker Exp $ 1# $OpenBSD: localcommand.sh,v 1.2 2013/05/17 10:24:48 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="localcommand" 4tid="localcommand"
diff --git a/regress/login-timeout.sh b/regress/login-timeout.sh
index 55fbb324d..d73923b9c 100644
--- a/regress/login-timeout.sh
+++ b/regress/login-timeout.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: login-timeout.sh,v 1.4 2005/02/27 23:13:36 djm Exp $ 1# $OpenBSD: login-timeout.sh,v 1.5 2013/05/17 10:23:52 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="connect after login grace timeout" 4tid="connect after login grace timeout"
diff --git a/regress/modpipe.c b/regress/modpipe.c
index 9629aa80b..85747cf7d 100755
--- a/regress/modpipe.c
+++ b/regress/modpipe.c
@@ -14,7 +14,7 @@
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */ 15 */
16 16
17/* $OpenBSD: modpipe.c,v 1.4 2013/02/20 08:29:27 djm Exp $ */ 17/* $OpenBSD: modpipe.c,v 1.5 2013/05/10 03:46:14 djm Exp $ */
18 18
19#include "includes.h" 19#include "includes.h"
20 20
@@ -25,7 +25,7 @@
25#include <stdarg.h> 25#include <stdarg.h>
26#include <stdlib.h> 26#include <stdlib.h>
27#include <errno.h> 27#include <errno.h>
28#include "openbsd-compat/getopt.c" 28#include "openbsd-compat/getopt_long.c"
29 29
30static void err(int, const char *, ...) __attribute__((format(printf, 2, 3))); 30static void err(int, const char *, ...) __attribute__((format(printf, 2, 3)));
31static void errx(int, const char *, ...) __attribute__((format(printf, 2, 3))); 31static void errx(int, const char *, ...) __attribute__((format(printf, 2, 3)));
diff --git a/regress/multiplex.sh b/regress/multiplex.sh
index 1e6cc7606..3e697e691 100644
--- a/regress/multiplex.sh
+++ b/regress/multiplex.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: multiplex.sh,v 1.17 2012/10/05 02:05:30 dtucker Exp $ 1# $OpenBSD: multiplex.sh,v 1.21 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4CTL=/tmp/openssh.regress.ctl-sock.$$ 4CTL=/tmp/openssh.regress.ctl-sock.$$
@@ -10,8 +10,7 @@ if config_defined DISABLE_FD_PASSING ; then
10 exit 0 10 exit 0
11fi 11fi
12 12
13DATA=/bin/ls${EXEEXT} 13P=3301 # test port
14COPY=$OBJ/ls.copy
15 14
16wait_for_mux_master_ready() 15wait_for_mux_master_ready()
17{ 16{
@@ -25,10 +24,16 @@ wait_for_mux_master_ready()
25 24
26start_sshd 25start_sshd
27 26
28trace "start master, fork to background" 27start_mux_master()
29${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost & 28{
30MASTER_PID=$! 29 trace "start master, fork to background"
31wait_for_mux_master_ready 30 ${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost \
31 -E $TEST_REGRESS_LOGFILE 2>&1 &
32 MASTER_PID=$!
33 wait_for_mux_master_ready
34}
35
36start_mux_master
32 37
33verbose "test $tid: envpass" 38verbose "test $tid: envpass"
34trace "env passing over multiplexed connection" 39trace "env passing over multiplexed connection"
@@ -55,13 +60,13 @@ cmp ${DATA} ${COPY} || fail "ssh -S ctl: corrupted copy of ${DATA}"
55rm -f ${COPY} 60rm -f ${COPY}
56trace "sftp transfer over multiplexed connection and check result" 61trace "sftp transfer over multiplexed connection and check result"
57echo "get ${DATA} ${COPY}" | \ 62echo "get ${DATA} ${COPY}" | \
58 ${SFTP} -S ${SSH} -F $OBJ/ssh_config -oControlPath=$CTL otherhost >>$TEST_SSH_LOGFILE 2>&1 63 ${SFTP} -S ${SSH} -F $OBJ/ssh_config -oControlPath=$CTL otherhost >>$TEST_REGRESS_LOGFILE 2>&1
59test -f ${COPY} || fail "sftp: failed copy ${DATA}" 64test -f ${COPY} || fail "sftp: failed copy ${DATA}"
60cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}" 65cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}"
61 66
62rm -f ${COPY} 67rm -f ${COPY}
63trace "scp transfer over multiplexed connection and check result" 68trace "scp transfer over multiplexed connection and check result"
64${SCP} -S ${SSH} -F $OBJ/ssh_config -oControlPath=$CTL otherhost:${DATA} ${COPY} >>$TEST_SSH_LOGFILE 2>&1 69${SCP} -S ${SSH} -F $OBJ/ssh_config -oControlPath=$CTL otherhost:${DATA} ${COPY} >>$TEST_REGRESS_LOGFILE 2>&1
65test -f ${COPY} || fail "scp: failed copy ${DATA}" 70test -f ${COPY} || fail "scp: failed copy ${DATA}"
66cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}" 71cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}"
67 72
@@ -87,11 +92,31 @@ for s in 0 1 4 5 44; do
87done 92done
88 93
89verbose "test $tid: cmd check" 94verbose "test $tid: cmd check"
90${SSH} -F $OBJ/ssh_config -S $CTL -Ocheck otherhost >>$TEST_SSH_LOGFILE 2>&1 \ 95${SSH} -F $OBJ/ssh_config -S $CTL -Ocheck otherhost >>$TEST_REGRESS_LOGFILE 2>&1 \
91 || fail "check command failed" 96 || fail "check command failed"
92 97
98verbose "test $tid: cmd forward local"
99${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -L $P:localhost:$PORT otherhost \
100 || fail "request local forward failed"
101${SSH} -F $OBJ/ssh_config -p$P otherhost true \
102 || fail "connect to local forward port failed"
103${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -L $P:localhost:$PORT otherhost \
104 || fail "cancel local forward failed"
105${SSH} -F $OBJ/ssh_config -p$P otherhost true \
106 && fail "local forward port still listening"
107
108verbose "test $tid: cmd forward remote"
109${SSH} -F $OBJ/ssh_config -S $CTL -Oforward -R $P:localhost:$PORT otherhost \
110 || fail "request remote forward failed"
111${SSH} -F $OBJ/ssh_config -p$P otherhost true \
112 || fail "connect to remote forwarded port failed"
113${SSH} -F $OBJ/ssh_config -S $CTL -Ocancel -R $P:localhost:$PORT otherhost \
114 || fail "cancel remote forward failed"
115${SSH} -F $OBJ/ssh_config -p$P otherhost true \
116 && fail "remote forward port still listening"
117
93verbose "test $tid: cmd exit" 118verbose "test $tid: cmd exit"
94${SSH} -F $OBJ/ssh_config -S $CTL -Oexit otherhost >>$TEST_SSH_LOGFILE 2>&1 \ 119${SSH} -F $OBJ/ssh_config -S $CTL -Oexit otherhost >>$TEST_REGRESS_LOGFILE 2>&1 \
95 || fail "send exit command failed" 120 || fail "send exit command failed"
96 121
97# Wait for master to exit 122# Wait for master to exit
@@ -101,15 +126,13 @@ kill -0 $MASTER_PID >/dev/null 2>&1 && fail "exit command failed"
101# Restart master and test -O stop command with master using -N 126# Restart master and test -O stop command with master using -N
102verbose "test $tid: cmd stop" 127verbose "test $tid: cmd stop"
103trace "restart master, fork to background" 128trace "restart master, fork to background"
104${SSH} -Nn2 -MS$CTL -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" somehost & 129start_mux_master
105MASTER_PID=$!
106wait_for_mux_master_ready
107 130
108# start a long-running command then immediately request a stop 131# start a long-running command then immediately request a stop
109${SSH} -F $OBJ/ssh_config -S $CTL otherhost "sleep 10; exit 0" \ 132${SSH} -F $OBJ/ssh_config -S $CTL otherhost "sleep 10; exit 0" \
110 >>$TEST_SSH_LOGFILE 2>&1 & 133 >>$TEST_REGRESS_LOGFILE 2>&1 &
111SLEEP_PID=$! 134SLEEP_PID=$!
112${SSH} -F $OBJ/ssh_config -S $CTL -Ostop otherhost >>$TEST_SSH_LOGFILE 2>&1 \ 135${SSH} -F $OBJ/ssh_config -S $CTL -Ostop otherhost >>$TEST_REGRESS_LOGFILE 2>&1 \
113 || fail "send stop command failed" 136 || fail "send stop command failed"
114 137
115# wait until both long-running command and master have exited. 138# wait until both long-running command and master have exited.
diff --git a/regress/portnum.sh b/regress/portnum.sh
index 1de0680fe..c56b869a3 100644
--- a/regress/portnum.sh
+++ b/regress/portnum.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: portnum.sh,v 1.1 2009/08/13 00:57:17 djm Exp $ 1# $OpenBSD: portnum.sh,v 1.2 2013/05/17 10:34:30 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="port number parsing" 4tid="port number parsing"
diff --git a/regress/proto-version.sh b/regress/proto-version.sh
index 1651a69e1..b876dd7ec 100644
--- a/regress/proto-version.sh
+++ b/regress/proto-version.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: proto-version.sh,v 1.3 2002/03/15 13:08:56 markus Exp $ 1# $OpenBSD: proto-version.sh,v 1.4 2013/05/17 00:37:40 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="sshd version with different protocol combinations" 4tid="sshd version with different protocol combinations"
@@ -8,7 +8,7 @@ check_version ()
8{ 8{
9 version=$1 9 version=$1
10 expect=$2 10 expect=$2
11 banner=`echon | ${SSHD} -o "Protocol=${version}" -i -f ${OBJ}/sshd_proxy` 11 banner=`printf '' | ${SSHD} -o "Protocol=${version}" -i -f ${OBJ}/sshd_proxy`
12 case ${banner} in 12 case ${banner} in
13 SSH-1.99-*) 13 SSH-1.99-*)
14 proto=199 14 proto=199
diff --git a/regress/proxy-connect.sh b/regress/proxy-connect.sh
index 6a36b2513..76e602dd6 100644
--- a/regress/proxy-connect.sh
+++ b/regress/proxy-connect.sh
@@ -1,8 +1,9 @@
1# $OpenBSD: proxy-connect.sh,v 1.5 2002/12/09 15:28:46 markus Exp $ 1# $OpenBSD: proxy-connect.sh,v 1.6 2013/03/07 00:20:34 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="proxy connect" 4tid="proxy connect"
5 5
6verbose "plain username"
6for p in 1 2; do 7for p in 1 2; do
7 ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true 8 ${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 true
8 if [ $? -ne 0 ]; then 9 if [ $? -ne 0 ]; then
@@ -16,3 +17,10 @@ for p in 1 2; do
16 fail "bad SSH_CONNECTION" 17 fail "bad SSH_CONNECTION"
17 fi 18 fi
18done 19done
20
21verbose "username with style"
22for p in 1 2; do
23 ${SSH} -$p -F $OBJ/ssh_proxy ${USER}:style@999.999.999.999 true || \
24 fail "ssh proxyconnect protocol $p failed"
25done
26
diff --git a/regress/putty-ciphers.sh b/regress/putty-ciphers.sh
index 928ea60d2..724a98cc1 100644
--- a/regress/putty-ciphers.sh
+++ b/regress/putty-ciphers.sh
@@ -1,11 +1,8 @@
1# $OpenBSD: putty-ciphers.sh,v 1.3 2008/11/10 02:06:35 djm Exp $ 1# $OpenBSD: putty-ciphers.sh,v 1.4 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="putty ciphers" 4tid="putty ciphers"
5 5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8
9if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then 6if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then
10 echo "putty interop tests not enabled" 7 echo "putty interop tests not enabled"
11 exit 0 8 exit 0
diff --git a/regress/putty-kex.sh b/regress/putty-kex.sh
index 293885a8a..1844d6599 100644
--- a/regress/putty-kex.sh
+++ b/regress/putty-kex.sh
@@ -1,11 +1,8 @@
1# $OpenBSD: putty-kex.sh,v 1.2 2008/06/30 10:31:11 djm Exp $ 1# $OpenBSD: putty-kex.sh,v 1.3 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="putty KEX" 4tid="putty KEX"
5 5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8
9if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then 6if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then
10 echo "putty interop tests not enabled" 7 echo "putty interop tests not enabled"
11 exit 0 8 exit 0
diff --git a/regress/putty-transfer.sh b/regress/putty-transfer.sh
index 9e1e1550a..aec0e04ee 100644
--- a/regress/putty-transfer.sh
+++ b/regress/putty-transfer.sh
@@ -1,11 +1,8 @@
1# $OpenBSD: putty-transfer.sh,v 1.2 2008/06/30 10:31:11 djm Exp $ 1# $OpenBSD: putty-transfer.sh,v 1.3 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="putty transfer data" 4tid="putty transfer data"
5 5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8
9if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then 6if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then
10 echo "putty interop tests not enabled" 7 echo "putty interop tests not enabled"
11 exit 0 8 exit 0
diff --git a/regress/reexec.sh b/regress/reexec.sh
index 9464eb699..433573f06 100644
--- a/regress/reexec.sh
+++ b/regress/reexec.sh
@@ -1,12 +1,10 @@
1# $OpenBSD: reexec.sh,v 1.5 2004/10/08 02:01:50 djm Exp $ 1# $OpenBSD: reexec.sh,v 1.7 2013/05/17 10:23:52 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="reexec tests" 4tid="reexec tests"
5 5
6DATA=/bin/ls${EXEEXT} 6SSHD_ORIG=$SSHD
7COPY=${OBJ}/copy 7SSHD_COPY=$OBJ/sshd
8SSHD_ORIG=$SSHD${EXEEXT}
9SSHD_COPY=$OBJ/sshd${EXEEXT}
10 8
11# Start a sshd and then delete it 9# Start a sshd and then delete it
12start_sshd_copy () 10start_sshd_copy ()
diff --git a/regress/rekey.sh b/regress/rekey.sh
index 3c5f266fc..8eb7efaf9 100644
--- a/regress/rekey.sh
+++ b/regress/rekey.sh
@@ -1,23 +1,18 @@
1# $OpenBSD: rekey.sh,v 1.1 2003/03/28 13:58:28 markus Exp $ 1# $OpenBSD: rekey.sh,v 1.8 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="rekey during transfer data" 4tid="rekey"
5 5
6DATA=${OBJ}/data 6LOG=${TEST_SSH_LOGFILE}
7COPY=${OBJ}/copy
8LOG=${OBJ}/log
9 7
10rm -f ${COPY} ${LOG} ${DATA} 8rm -f ${LOG}
11touch ${DATA}
12dd if=/bin/ls${EXEEXT} of=${DATA} bs=1k seek=511 count=1 > /dev/null 2>&1
13 9
14for s in 16 1k 128k 256k; do 10for s in 16 1k 128k 256k; do
15 trace "rekeylimit ${s}" 11 verbose "client rekeylimit ${s}"
16 rm -f ${COPY} 12 rm -f ${COPY} ${LOG}
17 cat $DATA | \ 13 cat $DATA | \
18 ${SSH} -oCompression=no -oRekeyLimit=$s \ 14 ${SSH} -oCompression=no -oRekeyLimit=$s \
19 -v -F $OBJ/ssh_proxy somehost "cat > ${COPY}" \ 15 -v -F $OBJ/ssh_proxy somehost "cat > ${COPY}"
20 2> ${LOG}
21 if [ $? -ne 0 ]; then 16 if [ $? -ne 0 ]; then
22 fail "ssh failed" 17 fail "ssh failed"
23 fi 18 fi
@@ -29,4 +24,86 @@ for s in 16 1k 128k 256k; do
29 fail "no rekeying occured" 24 fail "no rekeying occured"
30 fi 25 fi
31done 26done
32rm -f ${COPY} ${LOG} ${DATA} 27
28for s in 5 10; do
29 verbose "client rekeylimit default ${s}"
30 rm -f ${COPY} ${LOG}
31 cat $DATA | \
32 ${SSH} -oCompression=no -oRekeyLimit="default $s" -F \
33 $OBJ/ssh_proxy somehost "cat >${COPY};sleep $s;sleep 3"
34 if [ $? -ne 0 ]; then
35 fail "ssh failed"
36 fi
37 cmp $DATA ${COPY} || fail "corrupted copy"
38 n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
39 n=`expr $n - 1`
40 trace "$n rekeying(s)"
41 if [ $n -lt 1 ]; then
42 fail "no rekeying occured"
43 fi
44done
45
46for s in 5 10; do
47 verbose "client rekeylimit default ${s} no data"
48 rm -f ${COPY} ${LOG}
49 ${SSH} -oCompression=no -oRekeyLimit="default $s" -F \
50 $OBJ/ssh_proxy somehost "sleep $s;sleep 3"
51 if [ $? -ne 0 ]; then
52 fail "ssh failed"
53 fi
54 n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
55 n=`expr $n - 1`
56 trace "$n rekeying(s)"
57 if [ $n -lt 1 ]; then
58 fail "no rekeying occured"
59 fi
60done
61
62echo "rekeylimit default 5" >>$OBJ/sshd_proxy
63for s in 5 10; do
64 verbose "server rekeylimit default ${s} no data"
65 rm -f ${COPY} ${LOG}
66 ${SSH} -oCompression=no -F $OBJ/ssh_proxy somehost "sleep $s;sleep 3"
67 if [ $? -ne 0 ]; then
68 fail "ssh failed"
69 fi
70 n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
71 n=`expr $n - 1`
72 trace "$n rekeying(s)"
73 if [ $n -lt 1 ]; then
74 fail "no rekeying occured"
75 fi
76done
77
78verbose "rekeylimit parsing"
79for size in 16 1k 1K 1m 1M 1g 1G; do
80 for time in 1 1m 1M 1h 1H 1d 1D 1w 1W; do
81 case $size in
82 16) bytes=16 ;;
83 1k|1K) bytes=1024 ;;
84 1m|1M) bytes=1048576 ;;
85 1g|1G) bytes=1073741824 ;;
86 esac
87 case $time in
88 1) seconds=1 ;;
89 1m|1M) seconds=60 ;;
90 1h|1H) seconds=3600 ;;
91 1d|1D) seconds=86400 ;;
92 1w|1W) seconds=604800 ;;
93 esac
94
95 b=`$SUDO ${SSHD} -T -o "rekeylimit $size $time" -f $OBJ/sshd_proxy | \
96 awk '/rekeylimit/{print $2}'`
97 s=`$SUDO ${SSHD} -T -o "rekeylimit $size $time" -f $OBJ/sshd_proxy | \
98 awk '/rekeylimit/{print $3}'`
99
100 if [ "$bytes" != "$b" ]; then
101 fatal "rekeylimit size: expected $bytes got $b"
102 fi
103 if [ "$seconds" != "$s" ]; then
104 fatal "rekeylimit time: expected $time got $s"
105 fi
106 done
107done
108
109rm -f ${COPY} ${DATA}
diff --git a/regress/runtests.sh b/regress/runtests.sh
deleted file mode 100755
index 9808eb8a7..000000000
--- a/regress/runtests.sh
+++ /dev/null
@@ -1,13 +0,0 @@
1#!/bin/sh
2
3TEST_SSH_SSH=../ssh
4TEST_SSH_SSHD=../sshd
5TEST_SSH_SSHAGENT=../ssh-agent
6TEST_SSH_SSHADD=../ssh-add
7TEST_SSH_SSHKEYGEN=../ssh-keygen
8TEST_SSH_SSHKEYSCAN=../ssh-keyscan
9TEST_SSH_SFTP=../sftp
10TEST_SSH_SFTPSERVER=../sftp-server
11
12pmake
13
diff --git a/regress/scp.sh b/regress/scp.sh
index c5d412dd9..29c5b35d4 100644
--- a/regress/scp.sh
+++ b/regress/scp.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: scp.sh,v 1.7 2006/01/31 10:36:33 djm Exp $ 1# $OpenBSD: scp.sh,v 1.9 2013/05/17 10:35:43 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="scp" 4tid="scp"
@@ -12,8 +12,6 @@ else
12 DIFFOPT="-r" 12 DIFFOPT="-r"
13fi 13fi
14 14
15DATA=/bin/ls${EXEEXT}
16COPY=${OBJ}/copy
17COPY2=${OBJ}/copy2 15COPY2=${OBJ}/copy2
18DIR=${COPY}.dd 16DIR=${COPY}.dd
19DIR2=${COPY}.dd2 17DIR2=${COPY}.dd2
diff --git a/regress/sftp-badcmds.sh b/regress/sftp-badcmds.sh
index 08009f26b..7f85c4f22 100644
--- a/regress/sftp-badcmds.sh
+++ b/regress/sftp-badcmds.sh
@@ -1,12 +1,10 @@
1# $OpenBSD: sftp-badcmds.sh,v 1.4 2009/08/13 01:11:55 djm Exp $ 1# $OpenBSD: sftp-badcmds.sh,v 1.6 2013/05/17 10:26:26 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="sftp invalid commands" 4tid="sftp invalid commands"
5 5
6DATA=/bin/ls${EXEEXT}
7DATA2=/bin/sh${EXEEXT} 6DATA2=/bin/sh${EXEEXT}
8NONEXIST=/NONEXIST.$$ 7NONEXIST=/NONEXIST.$$
9COPY=${OBJ}/copy
10GLOBFILES=`(cd /bin;echo l*)` 8GLOBFILES=`(cd /bin;echo l*)`
11 9
12rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd 10rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd
diff --git a/regress/sftp-batch.sh b/regress/sftp-batch.sh
index a51ef0782..41011549b 100644
--- a/regress/sftp-batch.sh
+++ b/regress/sftp-batch.sh
@@ -1,10 +1,8 @@
1# $OpenBSD: sftp-batch.sh,v 1.4 2009/08/13 01:11:55 djm Exp $ 1# $OpenBSD: sftp-batch.sh,v 1.5 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="sftp batchfile" 4tid="sftp batchfile"
5 5
6DATA=/bin/ls${EXEEXT}
7COPY=${OBJ}/copy
8BATCH=${OBJ}/sftp.bb 6BATCH=${OBJ}/sftp.bb
9 7
10rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* 8rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
diff --git a/regress/sftp-chroot.sh b/regress/sftp-chroot.sh
new file mode 100644
index 000000000..03b9bc6d7
--- /dev/null
+++ b/regress/sftp-chroot.sh
@@ -0,0 +1,25 @@
1# $OpenBSD: sftp-chroot.sh,v 1.2 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain.
3
4tid="sftp in chroot"
5
6CHROOT=/var/run
7FILENAME=testdata_${USER}
8PRIVDATA=${CHROOT}/${FILENAME}
9
10if [ -z "$SUDO" ]; then
11 echo "skipped: need SUDO to create file in /var/run, test won't work without"
12 exit 0
13fi
14
15$SUDO sh -c "echo mekmitastdigoat > $PRIVDATA" || \
16 fatal "create $PRIVDATA failed"
17
18start_sshd -oChrootDirectory=$CHROOT -oForceCommand="internal-sftp -d /"
19
20verbose "test $tid: get"
21${SFTP} -qS "$SSH" -F $OBJ/ssh_config host:/${FILENAME} $COPY || \
22 fatal "Fetch ${FILENAME} failed"
23cmp $PRIVDATA $COPY || fail "$PRIVDATA $COPY differ"
24
25$SUDO rm $PRIVDATA
diff --git a/regress/sftp-cmds.sh b/regress/sftp-cmds.sh
index 2e0300e16..aad7fcac2 100644
--- a/regress/sftp-cmds.sh
+++ b/regress/sftp-cmds.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: sftp-cmds.sh,v 1.12 2012/06/01 00:52:52 djm Exp $ 1# $OpenBSD: sftp-cmds.sh,v 1.14 2013/06/21 02:26:26 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4# XXX - TODO: 4# XXX - TODO:
@@ -7,8 +7,6 @@
7 7
8tid="sftp commands" 8tid="sftp commands"
9 9
10DATA=/bin/ls${EXEEXT}
11COPY=${OBJ}/copy
12# test that these files are readable! 10# test that these files are readable!
13for i in `(cd /bin;echo l*)` 11for i in `(cd /bin;echo l*)`
14do 12do
@@ -108,7 +106,7 @@ rm -f ${COPY}.dd/*
108verbose "$tid: get to directory" 106verbose "$tid: get to directory"
109echo "get $DATA ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \ 107echo "get $DATA ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
110 || fail "get failed" 108 || fail "get failed"
111cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get" 109cmp $DATA ${COPY}.dd/$DATANAME || fail "corrupted copy after get"
112 110
113rm -f ${COPY}.dd/* 111rm -f ${COPY}.dd/*
114verbose "$tid: glob get to directory" 112verbose "$tid: glob get to directory"
@@ -122,7 +120,7 @@ rm -f ${COPY}.dd/*
122verbose "$tid: get to local dir" 120verbose "$tid: get to local dir"
123(echo "lcd ${COPY}.dd"; echo "get $DATA" ) | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \ 121(echo "lcd ${COPY}.dd"; echo "get $DATA" ) | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
124 || fail "get failed" 122 || fail "get failed"
125cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get" 123cmp $DATA ${COPY}.dd/$DATANAME || fail "corrupted copy after get"
126 124
127rm -f ${COPY}.dd/* 125rm -f ${COPY}.dd/*
128verbose "$tid: glob get to local dir" 126verbose "$tid: glob get to local dir"
@@ -156,7 +154,7 @@ rm -f ${COPY}.dd/*
156verbose "$tid: put to directory" 154verbose "$tid: put to directory"
157echo "put $DATA ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \ 155echo "put $DATA ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
158 || fail "put failed" 156 || fail "put failed"
159cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put" 157cmp $DATA ${COPY}.dd/$DATANAME || fail "corrupted copy after put"
160 158
161rm -f ${COPY}.dd/* 159rm -f ${COPY}.dd/*
162verbose "$tid: glob put to directory" 160verbose "$tid: glob put to directory"
@@ -170,7 +168,7 @@ rm -f ${COPY}.dd/*
170verbose "$tid: put to local dir" 168verbose "$tid: put to local dir"
171(echo "cd ${COPY}.dd"; echo "put $DATA") | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \ 169(echo "cd ${COPY}.dd"; echo "put $DATA") | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
172 || fail "put failed" 170 || fail "put failed"
173cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put" 171cmp $DATA ${COPY}.dd/$DATANAME || fail "corrupted copy after put"
174 172
175rm -f ${COPY}.dd/* 173rm -f ${COPY}.dd/*
176verbose "$tid: glob put to local dir" 174verbose "$tid: glob put to local dir"
diff --git a/regress/sftp.sh b/regress/sftp.sh
index f84fa6f4e..b8e9f7527 100644
--- a/regress/sftp.sh
+++ b/regress/sftp.sh
@@ -1,11 +1,8 @@
1# $OpenBSD: sftp.sh,v 1.3 2009/08/13 01:11:55 djm Exp $ 1# $OpenBSD: sftp.sh,v 1.5 2013/05/17 10:28:11 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="basic sftp put/get" 4tid="basic sftp put/get"
5 5
6DATA=/bin/ls${EXEEXT}
7COPY=${OBJ}/copy
8
9SFTPCMDFILE=${OBJ}/batch 6SFTPCMDFILE=${OBJ}/batch
10cat >$SFTPCMDFILE <<EOF 7cat >$SFTPCMDFILE <<EOF
11version 8version
diff --git a/regress/ssh-com-client.sh b/regress/ssh-com-client.sh
index 324a0a723..e4f80cf0a 100644
--- a/regress/ssh-com-client.sh
+++ b/regress/ssh-com-client.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: ssh-com-client.sh,v 1.6 2004/02/24 17:06:52 markus Exp $ 1# $OpenBSD: ssh-com-client.sh,v 1.7 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="connect with ssh.com client" 4tid="connect with ssh.com client"
@@ -67,10 +67,6 @@ EOF
67# we need a real server (no ProxyConnect option) 67# we need a real server (no ProxyConnect option)
68start_sshd 68start_sshd
69 69
70DATA=/bin/ls${EXEEXT}
71COPY=${OBJ}/copy
72rm -f ${COPY}
73
74# go for it 70# go for it
75for v in ${VERSIONS}; do 71for v in ${VERSIONS}; do
76 ssh2=${TEST_COMBASE}/${v}/ssh2 72 ssh2=${TEST_COMBASE}/${v}/ssh2
diff --git a/regress/ssh-com-sftp.sh b/regress/ssh-com-sftp.sh
index be6f4e0dc..fabfa4983 100644
--- a/regress/ssh-com-sftp.sh
+++ b/regress/ssh-com-sftp.sh
@@ -1,10 +1,8 @@
1# $OpenBSD: ssh-com-sftp.sh,v 1.6 2009/08/20 18:43:07 djm Exp $ 1# $OpenBSD: ssh-com-sftp.sh,v 1.7 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="basic sftp put/get with ssh.com server" 4tid="basic sftp put/get with ssh.com server"
5 5
6DATA=/bin/ls${EXEEXT}
7COPY=${OBJ}/copy
8SFTPCMDFILE=${OBJ}/batch 6SFTPCMDFILE=${OBJ}/batch
9 7
10cat >$SFTPCMDFILE <<EOF 8cat >$SFTPCMDFILE <<EOF
diff --git a/regress/ssh-com.sh b/regress/ssh-com.sh
index 7bcd85b65..6c5cfe888 100644
--- a/regress/ssh-com.sh
+++ b/regress/ssh-com.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: ssh-com.sh,v 1.7 2004/02/24 17:06:52 markus Exp $ 1# $OpenBSD: ssh-com.sh,v 1.8 2013/05/17 00:37:40 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="connect to ssh.com server" 4tid="connect to ssh.com server"
@@ -70,7 +70,7 @@ done
70 70
71# convert and append DSA hostkey 71# convert and append DSA hostkey
72( 72(
73 echon 'ssh2-localhost-with-alias,127.0.0.1,::1 ' 73 printf 'ssh2-localhost-with-alias,127.0.0.1,::1 '
74 ${SSHKEYGEN} -if ${SRC}/dsa_ssh2.pub 74 ${SSHKEYGEN} -if ${SRC}/dsa_ssh2.pub
75) >> $OBJ/known_hosts 75) >> $OBJ/known_hosts
76 76
diff --git a/regress/sshd-log-wrapper.sh b/regress/sshd-log-wrapper.sh
index c7a5ef3a6..a9386be4d 100644
--- a/regress/sshd-log-wrapper.sh
+++ b/regress/sshd-log-wrapper.sh
@@ -1,5 +1,5 @@
1#!/bin/sh 1#!/bin/sh
2# $OpenBSD: sshd-log-wrapper.sh,v 1.2 2005/02/27 11:40:30 dtucker Exp $ 2# $OpenBSD: sshd-log-wrapper.sh,v 1.3 2013/04/07 02:16:03 dtucker Exp $
3# Placed in the Public Domain. 3# Placed in the Public Domain.
4# 4#
5# simple wrapper for sshd proxy mode to catch stderr output 5# simple wrapper for sshd proxy mode to catch stderr output
@@ -10,4 +10,4 @@ log=$2
10shift 10shift
11shift 11shift
12 12
13exec $sshd $@ -e 2>>$log 13exec $sshd -E$log $@
diff --git a/regress/stderr-after-eof.sh b/regress/stderr-after-eof.sh
index 05a5ea56d..218ac6b68 100644
--- a/regress/stderr-after-eof.sh
+++ b/regress/stderr-after-eof.sh
@@ -1,29 +1,13 @@
1# $OpenBSD: stderr-after-eof.sh,v 1.1 2002/03/23 16:38:09 markus Exp $ 1# $OpenBSD: stderr-after-eof.sh,v 1.2 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="stderr data after eof" 4tid="stderr data after eof"
5 5
6DATA=/etc/motd
7DATA=${OBJ}/data
8COPY=${OBJ}/copy
9
10if have_prog md5sum; then
11 CHECKSUM=md5sum
12elif have_prog openssl; then
13 CHECKSUM="openssl md5"
14elif have_prog cksum; then
15 CHECKSUM=cksum
16elif have_prog sum; then
17 CHECKSUM=sum
18else
19 fatal "No checksum program available, aborting $tid test"
20fi
21
22# setup data 6# setup data
23rm -f ${DATA} ${COPY} 7rm -f ${DATA} ${COPY}
24cp /dev/null ${DATA} 8cp /dev/null ${DATA}
25for i in 1 2 3 4 5 6; do 9for i in 1 2 3 4 5 6; do
26 (date;echo $i) | $CHECKSUM >> ${DATA} 10 (date;echo $i) | md5 >> ${DATA}
27done 11done
28 12
29${SSH} -2 -F $OBJ/ssh_proxy otherhost \ 13${SSH} -2 -F $OBJ/ssh_proxy otherhost \
diff --git a/regress/stderr-data.sh b/regress/stderr-data.sh
index 1daf79bb5..b0bd2355c 100644
--- a/regress/stderr-data.sh
+++ b/regress/stderr-data.sh
@@ -1,12 +1,8 @@
1# $OpenBSD: stderr-data.sh,v 1.2 2002/03/27 22:39:52 markus Exp $ 1# $OpenBSD: stderr-data.sh,v 1.3 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="stderr data transfer" 4tid="stderr data transfer"
5 5
6DATA=/bin/ls${EXEEXT}
7COPY=${OBJ}/copy
8rm -f ${COPY}
9
10for n in '' -n; do 6for n in '' -n; do
11for p in 1 2; do 7for p in 1 2; do
12 verbose "test $tid: proto $p ($n)" 8 verbose "test $tid: proto $p ($n)"
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index aa4e6e5c0..eee446264 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: test-exec.sh,v 1.37 2010/02/24 06:21:56 djm Exp $ 1# $OpenBSD: test-exec.sh,v 1.46 2013/06/21 02:26:26 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4#SUDO=sudo 4#SUDO=sudo
@@ -136,30 +136,49 @@ case "$SSHD" in
136*) SSHD=`which sshd` ;; 136*) SSHD=`which sshd` ;;
137esac 137esac
138 138
139# 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
139if [ "x$TEST_SSH_LOGFILE" = "x" ]; then 143if [ "x$TEST_SSH_LOGFILE" = "x" ]; then
140 TEST_SSH_LOGFILE=/dev/null 144 TEST_SSH_LOGFILE=$OBJ/ssh.log
145fi
146if [ "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
141fi 151fi
142 152
143# Some data for test copies 153# truncate logfiles
144DATA=$OBJ/testdata 154>$TEST_SSH_LOGFILE
145cat $SSHD${EXEEXT} $SSHD${EXEEXT} $SSHD${EXEEXT} $SSHD${EXEEXT} >$DATA 155>$TEST_SSHD_LOGFILE
156>$TEST_REGRESS_LOGFILE
157
158# Create wrapper ssh with logging. We can't just specify "SSH=ssh -E..."
159# because sftp and scp don't handle spaces in arguments.
160SSHLOGWRAP=$OBJ/ssh-log-wrapper.sh
161echo "#!/bin/sh" > $SSHLOGWRAP
162echo "exec ${SSH} -E${TEST_SSH_LOGFILE} "'"$@"' >>$SSHLOGWRAP
163
164chmod a+rx $OBJ/ssh-log-wrapper.sh
165SSH="$SSHLOGWRAP"
166
167# Some test data. We make a copy because some tests will overwrite it.
168# The tests may assume that $DATA exists and is writable and $COPY does
169# not exist.
170DATANAME=data
171DATA=$OBJ/${DATANAME}
172cat $SSHD $SSHD $SSHD $SSHD >${DATA}
173chmod u+w ${DATA}
174COPY=$OBJ/copy
175rm -f ${COPY}
146 176
147# these should be used in tests 177# these should be used in tests
148export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP 178export SSH SSHD SSHAGENT SSHADD SSHKEYGEN SSHKEYSCAN SFTP SFTPSERVER SCP
149#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP 179#echo $SSH $SSHD $SSHAGENT $SSHADD $SSHKEYGEN $SSHKEYSCAN $SFTP $SFTPSERVER $SCP
150 180
151# helper 181# Portable specific functions
152echon()
153{
154 if [ "x`echo -n`" = "x" ]; then
155 echo -n "$@"
156 elif [ "x`echo '\c'`" = "x" ]; then
157 echo "$@\c"
158 else
159 fatal "Don't know how to echo without newline."
160 fi
161}
162
163have_prog() 182have_prog()
164{ 183{
165 saved_IFS="$IFS" 184 saved_IFS="$IFS"
@@ -175,6 +194,37 @@ have_prog()
175 return 1 194 return 1
176} 195}
177 196
197jot() {
198 awk "BEGIN { for (i = $2; i < $2 + $1; i++) { printf \"%d\n\", i } exit }"
199}
200
201# Check whether preprocessor symbols are defined in config.h.
202config_defined ()
203{
204 str=$1
205 while test "x$2" != "x" ; do
206 str="$str|$2"
207 shift
208 done
209 egrep "^#define.*($str)" ${BUILDDIR}/config.h >/dev/null 2>&1
210}
211
212md5 () {
213 if have_prog md5sum; then
214 md5sum
215 elif have_prog openssl; then
216 openssl md5
217 elif have_prog cksum; then
218 cksum
219 elif have_prog sum; then
220 sum
221 else
222 wc -c
223 fi
224}
225# End of portable specific functions
226
227# helper
178cleanup () 228cleanup ()
179{ 229{
180 if [ -f $PIDFILE ]; then 230 if [ -f $PIDFILE ]; then
@@ -199,9 +249,26 @@ cleanup ()
199 fi 249 fi
200} 250}
201 251
252start_debug_log ()
253{
254 echo "trace: $@" >$TEST_REGRESS_LOGFILE
255 echo "trace: $@" >$TEST_SSH_LOGFILE
256 echo "trace: $@" >$TEST_SSHD_LOGFILE
257}
258
259save_debug_log ()
260{
261 echo $@ >>$TEST_REGRESS_LOGFILE
262 echo $@ >>$TEST_SSH_LOGFILE
263 echo $@ >>$TEST_SSHD_LOGFILE
264 (cat $TEST_REGRESS_LOGFILE; echo) >>$OBJ/failed-regress.log
265 (cat $TEST_SSH_LOGFILE; echo) >>$OBJ/failed-ssh.log
266 (cat $TEST_SSHD_LOGFILE; echo) >>$OBJ/failed-sshd.log
267}
268
202trace () 269trace ()
203{ 270{
204 echo "trace: $@" >>$TEST_SSH_LOGFILE 271 start_debug_log $@
205 if [ "X$TEST_SSH_TRACE" = "Xyes" ]; then 272 if [ "X$TEST_SSH_TRACE" = "Xyes" ]; then
206 echo "$@" 273 echo "$@"
207 fi 274 fi
@@ -209,7 +276,7 @@ trace ()
209 276
210verbose () 277verbose ()
211{ 278{
212 echo "verbose: $@" >>$TEST_SSH_LOGFILE 279 start_debug_log $@
213 if [ "X$TEST_SSH_QUIET" != "Xyes" ]; then 280 if [ "X$TEST_SSH_QUIET" != "Xyes" ]; then
214 echo "$@" 281 echo "$@"
215 fi 282 fi
@@ -223,31 +290,21 @@ warn ()
223 290
224fail () 291fail ()
225{ 292{
226 echo "FAIL: $@" >>$TEST_SSH_LOGFILE 293 save_debug_log "FAIL: $@"
227 RESULT=1 294 RESULT=1
228 echo "$@" 295 echo "$@"
296
229} 297}
230 298
231fatal () 299fatal ()
232{ 300{
233 echo "FATAL: $@" >>$TEST_SSH_LOGFILE 301 save_debug_log "FATAL: $@"
234 echon "FATAL: " 302 printf "FATAL: "
235 fail "$@" 303 fail "$@"
236 cleanup 304 cleanup
237 exit $RESULT 305 exit $RESULT
238} 306}
239 307
240# Check whether preprocessor symbols are defined in config.h.
241config_defined ()
242{
243 str=$1
244 while test "x$2" != "x" ; do
245 str="$str|$2"
246 shift
247 done
248 egrep "^#define.*($str)" ${BUILDDIR}/config.h >/dev/null 2>&1
249}
250
251RESULT=0 308RESULT=0
252PIDFILE=$OBJ/pidfile 309PIDFILE=$OBJ/pidfile
253 310
@@ -263,7 +320,7 @@ cat << EOF > $OBJ/sshd_config
263 #ListenAddress ::1 320 #ListenAddress ::1
264 PidFile $PIDFILE 321 PidFile $PIDFILE
265 AuthorizedKeysFile $OBJ/authorized_keys_%u 322 AuthorizedKeysFile $OBJ/authorized_keys_%u
266 LogLevel VERBOSE 323 LogLevel DEBUG3
267 AcceptEnv _XXX_TEST_* 324 AcceptEnv _XXX_TEST_*
268 AcceptEnv _XXX_TEST 325 AcceptEnv _XXX_TEST
269 Subsystem sftp $SFTPSERVER 326 Subsystem sftp $SFTPSERVER
@@ -295,8 +352,10 @@ Host *
295 ChallengeResponseAuthentication no 352 ChallengeResponseAuthentication no
296 HostbasedAuthentication no 353 HostbasedAuthentication no
297 PasswordAuthentication no 354 PasswordAuthentication no
355 RhostsRSAAuthentication no
298 BatchMode yes 356 BatchMode yes
299 StrictHostKeyChecking yes 357 StrictHostKeyChecking yes
358 LogLevel DEBUG3
300EOF 359EOF
301 360
302if [ ! -z "$TEST_SSH_SSH_CONFOPTS" ]; then 361if [ ! -z "$TEST_SSH_SSH_CONFOPTS" ]; then
@@ -309,13 +368,15 @@ rm -f $OBJ/known_hosts $OBJ/authorized_keys_$USER
309trace "generate keys" 368trace "generate keys"
310for t in rsa rsa1; do 369for t in rsa rsa1; do
311 # generate user key 370 # generate user key
312 rm -f $OBJ/$t 371 if [ ! -f $OBJ/$t ] || [ ${SSHKEYGEN} -nt $OBJ/$t ]; then
313 ${SSHKEYGEN} -b 1024 -q -N '' -t $t -f $OBJ/$t ||\ 372 rm -f $OBJ/$t
314 fail "ssh-keygen for $t failed" 373 ${SSHKEYGEN} -q -N '' -t $t -f $OBJ/$t ||\
374 fail "ssh-keygen for $t failed"
375 fi
315 376
316 # known hosts file for client 377 # known hosts file for client
317 ( 378 (
318 echon 'localhost-with-alias,127.0.0.1,::1 ' 379 printf 'localhost-with-alias,127.0.0.1,::1 '
319 cat $OBJ/$t.pub 380 cat $OBJ/$t.pub
320 ) >> $OBJ/known_hosts 381 ) >> $OBJ/known_hosts
321 382
@@ -370,7 +431,7 @@ if test "$REGRESS_INTEROP_PUTTY" = "yes" ; then
370 echo "Hostname=127.0.0.1" >> ${OBJ}/.putty/sessions/localhost_proxy 431 echo "Hostname=127.0.0.1" >> ${OBJ}/.putty/sessions/localhost_proxy
371 echo "PortNumber=$PORT" >> ${OBJ}/.putty/sessions/localhost_proxy 432 echo "PortNumber=$PORT" >> ${OBJ}/.putty/sessions/localhost_proxy
372 echo "ProxyMethod=5" >> ${OBJ}/.putty/sessions/localhost_proxy 433 echo "ProxyMethod=5" >> ${OBJ}/.putty/sessions/localhost_proxy
373 echo "ProxyTelnetCommand=sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSH_LOGFILE} -i -f $OBJ/sshd_proxy" >> ${OBJ}/.putty/sessions/localhost_proxy 434 echo "ProxyTelnetCommand=sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSHD_LOGFILE} -i -f $OBJ/sshd_proxy" >> ${OBJ}/.putty/sessions/localhost_proxy
374 435
375 REGRESS_INTEROP_PUTTY=yes 436 REGRESS_INTEROP_PUTTY=yes
376fi 437fi
@@ -378,7 +439,7 @@ fi
378# create a proxy version of the client config 439# create a proxy version of the client config
379( 440(
380 cat $OBJ/ssh_config 441 cat $OBJ/ssh_config
381 echo proxycommand ${SUDO} sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSH_LOGFILE} -i -f $OBJ/sshd_proxy 442 echo proxycommand ${SUDO} sh ${SRC}/sshd-log-wrapper.sh ${SSHD} ${TEST_SSHD_LOGFILE} -i -f $OBJ/sshd_proxy
382) > $OBJ/ssh_proxy 443) > $OBJ/ssh_proxy
383 444
384# check proxy config 445# check proxy config
@@ -388,7 +449,7 @@ start_sshd ()
388{ 449{
389 # start sshd 450 # start sshd
390 $SUDO ${SSHD} -f $OBJ/sshd_config "$@" -t || fatal "sshd_config broken" 451 $SUDO ${SSHD} -f $OBJ/sshd_config "$@" -t || fatal "sshd_config broken"
391 $SUDO ${SSHD} -f $OBJ/sshd_config -e "$@" >>$TEST_SSH_LOGFILE 2>&1 452 $SUDO ${SSHD} -f $OBJ/sshd_config "$@" -E$TEST_SSHD_LOGFILE
392 453
393 trace "wait for sshd" 454 trace "wait for sshd"
394 i=0; 455 i=0;
diff --git a/regress/transfer.sh b/regress/transfer.sh
index 13ea367d5..1ae3ef5bf 100644
--- a/regress/transfer.sh
+++ b/regress/transfer.sh
@@ -1,11 +1,8 @@
1# $OpenBSD: transfer.sh,v 1.1 2002/03/27 00:03:37 markus Exp $ 1# $OpenBSD: transfer.sh,v 1.2 2013/05/17 04:29:14 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="transfer data" 4tid="transfer data"
5 5
6DATA=/bin/ls${EXEEXT}
7COPY=${OBJ}/copy
8
9for p in 1 2; do 6for p in 1 2; do
10 verbose "$tid: proto $p" 7 verbose "$tid: proto $p"
11 rm -f ${COPY} 8 rm -f ${COPY}
diff --git a/regress/try-ciphers.sh b/regress/try-ciphers.sh
index 084a1457a..e17c9f5e9 100644
--- a/regress/try-ciphers.sh
+++ b/regress/try-ciphers.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: try-ciphers.sh,v 1.19 2013/02/11 23:58:51 djm Exp $ 1# $OpenBSD: try-ciphers.sh,v 1.20 2013/05/17 10:16:26 dtucker Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="try ciphers" 4tid="try ciphers"