summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
Diffstat (limited to 'regress')
-rw-r--r--regress/Makefile18
-rw-r--r--regress/addrmatch.sh11
-rw-r--r--regress/agent-pkcs11.sh69
-rw-r--r--regress/cert-hostkey.sh211
-rw-r--r--regress/cert-userkey.sh176
-rw-r--r--regress/cfgmatch.sh4
-rw-r--r--regress/cipher-speed.sh4
-rw-r--r--regress/forwarding.sh12
-rw-r--r--regress/keygen-convert.sh33
-rw-r--r--regress/multiplex.sh20
-rw-r--r--regress/portnum.sh34
-rw-r--r--regress/sftp-badcmds.sh16
-rw-r--r--regress/sftp-batch.sh10
-rw-r--r--regress/sftp-cmds.sh73
-rw-r--r--regress/sftp-glob.sh4
-rw-r--r--regress/sftp.sh6
-rw-r--r--regress/ssh-com-sftp.sh4
-rwxr-xr-xregress/ssh2putty.sh1
-rw-r--r--regress/test-exec.sh14
19 files changed, 638 insertions, 82 deletions
diff --git a/regress/Makefile b/regress/Makefile
index 3b8ea245b..d25a64555 100644
--- a/regress/Makefile
+++ b/regress/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.48 2008/06/28 13:57:25 djm Exp $ 1# $OpenBSD: Makefile,v 1.52 2010/02/26 20:33:21 djm Exp $
2 2
3REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec 3REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7 t-exec
4tests: $(REGRESS_TARGETS) 4tests: $(REGRESS_TARGETS)
@@ -34,6 +34,7 @@ LTESTS= connect \
34 agent-ptrace \ 34 agent-ptrace \
35 keyscan \ 35 keyscan \
36 keygen-change \ 36 keygen-change \
37 keygen-convert \
37 key-options \ 38 key-options \
38 scp \ 39 scp \
39 sftp \ 40 sftp \
@@ -50,7 +51,10 @@ LTESTS= connect \
50 cfgmatch \ 51 cfgmatch \
51 addrmatch \ 52 addrmatch \
52 localcommand \ 53 localcommand \
53 forcecommand 54 forcecommand \
55 portnum \
56 cert-hostkey \
57 cert-userkey
54 58
55INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers 59INTEROP_TESTS= putty-transfer putty-ciphers putty-kex conch-ciphers
56#INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp 60#INTEROP_TESTS+=ssh-com ssh-com-client ssh-com-keygen ssh-com-sftp
@@ -64,7 +68,11 @@ CLEANFILES= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2 \
64 ls.copy banner.in banner.out empty.in \ 68 ls.copy banner.in banner.out empty.in \
65 scp-ssh-wrapper.scp ssh_proxy_envpass remote_pid \ 69 scp-ssh-wrapper.scp ssh_proxy_envpass remote_pid \
66 sshd_proxy_bak rsa_ssh2_cr.prv rsa_ssh2_crnl.prv \ 70 sshd_proxy_bak rsa_ssh2_cr.prv rsa_ssh2_crnl.prv \
67 putty.rsa2 71 known_hosts-cert host_ca_key* cert_host_key* \
72 putty.rsa2 sshd_proxy_orig
73
74# Enable all malloc(3) randomisations and checks
75TEST_ENV= "MALLOC_OPTIONS=AFGJPRX"
68 76
69t1: 77t1:
70 ssh-keygen -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv 78 ssh-keygen -if ${.CURDIR}/rsa_ssh2.prv | diff - ${.CURDIR}/rsa_openssh.prv
@@ -104,13 +112,13 @@ t-exec: ${LTESTS:=.sh}
104 @if [ "x$?" = "x" ]; then exit 0; fi; \ 112 @if [ "x$?" = "x" ]; then exit 0; fi; \
105 for TEST in ""$?; do \ 113 for TEST in ""$?; do \
106 echo "run test $${TEST}" ... 1>&2; \ 114 echo "run test $${TEST}" ... 1>&2; \
107 (env SUDO=${SUDO} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \ 115 (env SUDO=${SUDO} TEST_ENV=${TEST_ENV} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
108 done 116 done
109 117
110t-exec-interop: ${INTEROP_TESTS:=.sh} 118t-exec-interop: ${INTEROP_TESTS:=.sh}
111 @if [ "x$?" = "x" ]; then exit 0; fi; \ 119 @if [ "x$?" = "x" ]; then exit 0; fi; \
112 for TEST in ""$?; do \ 120 for TEST in ""$?; do \
113 echo "run test $${TEST}" ... 1>&2; \ 121 echo "run test $${TEST}" ... 1>&2; \
114 (env SUDO=${SUDO} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \ 122 (env SUDO=${SUDO} TEST_ENV=${TEST_ENV} sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/$${TEST}) || exit $$?; \
115 done 123 done
116 124
diff --git a/regress/addrmatch.sh b/regress/addrmatch.sh
index a258f7bb4..23ddd65ce 100644
--- a/regress/addrmatch.sh
+++ b/regress/addrmatch.sh
@@ -1,9 +1,9 @@
1# $OpenBSD: addrmatch.sh,v 1.1 2008/06/10 05:23:32 dtucker Exp $ 1# $OpenBSD: addrmatch.sh,v 1.3 2010/02/09 04:57:36 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="address match" 4tid="address match"
5 5
6mv $OBJ/sshd_proxy $OBJ/sshd_proxy_orig 6mv $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
7 7
8run_trial() 8run_trial()
9{ 9{
@@ -12,13 +12,13 @@ run_trial()
12 verbose "test $descr for $user $addr $host" 12 verbose "test $descr for $user $addr $host"
13 result=`${SSHD} -f $OBJ/sshd_proxy -T \ 13 result=`${SSHD} -f $OBJ/sshd_proxy -T \
14 -C user=${user},addr=${addr},host=${host} | \ 14 -C user=${user},addr=${addr},host=${host} | \
15 awk '/passwordauthentication/ {print $2}'` 15 awk '/^passwordauthentication/ {print $2}'`
16 if [ "$result" != "$expected" ]; then 16 if [ "$result" != "$expected" ]; then
17 fail "failed for $user $addr $host: expected $expected, got $result" 17 fail "failed for $user $addr $host: expected $expected, got $result"
18 fi 18 fi
19} 19}
20 20
21cp $OBJ/sshd_proxy_orig $OBJ/sshd_proxy 21cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
22cat >>$OBJ/sshd_proxy <<EOD 22cat >>$OBJ/sshd_proxy <<EOD
23PasswordAuthentication no 23PasswordAuthentication no
24Match Address 192.168.0.0/16,!192.168.30.0/24,10.0.0.0/8,host.example.com 24Match Address 192.168.0.0/16,!192.168.30.0/24,10.0.0.0/8,host.example.com
@@ -40,3 +40,6 @@ run_trial user ::3 somehost no "deny IP6 negated"
40run_trial user ::4 somehost no "deny, IP6 no match" 40run_trial user ::4 somehost no "deny, IP6 no match"
41run_trial user 2000::1 somehost yes "permit, IP6 network" 41run_trial user 2000::1 somehost yes "permit, IP6 network"
42run_trial user 2001::1 somehost no "deny, IP6 network" 42run_trial user 2001::1 somehost no "deny, IP6 network"
43
44cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
45rm $OBJ/sshd_proxy_bak
diff --git a/regress/agent-pkcs11.sh b/regress/agent-pkcs11.sh
new file mode 100644
index 000000000..db33ab37e
--- /dev/null
+++ b/regress/agent-pkcs11.sh
@@ -0,0 +1,69 @@
1# $OpenBSD: agent-pkcs11.sh,v 1.1 2010/02/08 10:52:47 markus Exp $
2# Placed in the Public Domain.
3
4tid="pkcs11 agent test"
5
6TEST_SSH_PIN=""
7TEST_SSH_PKCS11=/usr/local/lib/soft-pkcs11.so.0.0
8
9# setup environment for soft-pkcs11 token
10SOFTPKCS11RC=$OBJ/pkcs11.info
11export SOFTPKCS11RC
12# prevent ssh-agent from calling ssh-askpass
13SSH_ASKPASS=/usr/bin/true
14export SSH_ASKPASS
15unset DISPLAY
16
17# start command w/o tty, so ssh-add accepts pin from stdin
18notty() {
19 perl -e 'use POSIX; POSIX::setsid();
20 if (fork) { wait; exit($? >> 8); } else { exec(@ARGV) }' "$@"
21}
22
23trace "start agent"
24eval `${SSHAGENT} -s` > /dev/null
25r=$?
26if [ $r -ne 0 ]; then
27 fail "could not start ssh-agent: exit code $r"
28else
29 trace "generating key/cert"
30 rm -f $OBJ/pkcs11.key $OBJ/pkcs11.crt
31 openssl genrsa -out $OBJ/pkcs11.key 2048 > /dev/null 2>&1
32 chmod 600 $OBJ/pkcs11.key
33 openssl req -key $OBJ/pkcs11.key -new -x509 \
34 -out $OBJ/pkcs11.crt -text -subj '/CN=pkcs11 test' > /dev/null
35 printf "a\ta\t$OBJ/pkcs11.crt\t$OBJ/pkcs11.key" > $SOFTPKCS11RC
36 # add to authorized keys
37 ${SSHKEYGEN} -y -f $OBJ/pkcs11.key > $OBJ/authorized_keys_$USER
38
39 trace "add pkcs11 key to agent"
40 echo ${TEST_SSH_PIN} | notty ${SSHADD} -s ${TEST_SSH_PKCS11} > /dev/null 2>&1
41 r=$?
42 if [ $r -ne 0 ]; then
43 fail "ssh-add -s failed: exit code $r"
44 fi
45
46 trace "pkcs11 list via agent"
47 ${SSHADD} -l > /dev/null 2>&1
48 r=$?
49 if [ $r -ne 0 ]; then
50 fail "ssh-add -l failed: exit code $r"
51 fi
52
53 trace "pkcs11 connect via agent"
54 ${SSH} -2 -F $OBJ/ssh_proxy somehost exit 5
55 r=$?
56 if [ $r -ne 5 ]; then
57 fail "ssh connect failed (exit code $r)"
58 fi
59
60 trace "remove pkcs11 keys"
61 echo ${TEST_SSH_PIN} | notty ${SSHADD} -e ${TEST_SSH_PKCS11} > /dev/null 2>&1
62 r=$?
63 if [ $r -ne 0 ]; then
64 fail "ssh-add -e failed: exit code $r"
65 fi
66
67 trace "kill agent"
68 ${SSHAGENT} -k > /dev/null
69fi
diff --git a/regress/cert-hostkey.sh b/regress/cert-hostkey.sh
new file mode 100644
index 000000000..3fda667cb
--- /dev/null
+++ b/regress/cert-hostkey.sh
@@ -0,0 +1,211 @@
1# $OpenBSD: cert-hostkey.sh,v 1.3 2010/03/04 10:38:23 djm Exp $
2# Placed in the Public Domain.
3
4tid="certified host keys"
5
6rm -f $OBJ/known_hosts-cert $OBJ/host_ca_key* $OBJ/cert_host_key*
7cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
8
9HOSTS='localhost-with-alias,127.0.0.1,::1'
10
11# Create a CA key and add it to known hosts
12${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/host_ca_key ||\
13 fail "ssh-keygen of host_ca_key failed"
14(
15 echon '@cert-authority '
16 echon "$HOSTS "
17 cat $OBJ/host_ca_key.pub
18) > $OBJ/known_hosts-cert
19
20# Generate and sign host keys
21for ktype in rsa dsa ; do
22 verbose "$tid: sign host ${ktype} cert"
23 # Generate and sign a host key
24 ${SSHKEYGEN} -q -N '' -t ${ktype} \
25 -f $OBJ/cert_host_key_${ktype} || \
26 fail "ssh-keygen of cert_host_key_${ktype} failed"
27 ${SSHKEYGEN} -h -q -s $OBJ/host_ca_key \
28 -I "regress host key for $USER" \
29 -n $HOSTS $OBJ/cert_host_key_${ktype} ||
30 fail "couldn't sign cert_host_key_${ktype}"
31done
32
33# Basic connect tests
34for privsep in yes no ; do
35 for ktype in rsa dsa ; do
36 verbose "$tid: host ${ktype} cert connect privsep $privsep"
37 (
38 cat $OBJ/sshd_proxy_bak
39 echo HostKey $OBJ/cert_host_key_${ktype}
40 echo HostCertificate $OBJ/cert_host_key_${ktype}-cert.pub
41 echo UsePrivilegeSeparation $privsep
42 ) > $OBJ/sshd_proxy
43
44 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \
45 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \
46 -F $OBJ/ssh_proxy somehost true
47 if [ $? -ne 0 ]; then
48 fail "ssh cert connect failed"
49 fi
50 done
51done
52
53# Revoked certificates with key present
54(
55 echon '@cert-authority '
56 echon "$HOSTS "
57 cat $OBJ/host_ca_key.pub
58 echon '@revoked '
59 echon "* "
60 cat $OBJ/cert_host_key_rsa.pub
61 echon '@revoked '
62 echon "* "
63 cat $OBJ/cert_host_key_dsa.pub
64) > $OBJ/known_hosts-cert
65for privsep in yes no ; do
66 for ktype in rsa dsa ; do
67 verbose "$tid: host ${ktype} revoked cert privsep $privsep"
68 (
69 cat $OBJ/sshd_proxy_bak
70 echo HostKey $OBJ/cert_host_key_${ktype}
71 echo HostCertificate $OBJ/cert_host_key_${ktype}-cert.pub
72 echo UsePrivilegeSeparation $privsep
73 ) > $OBJ/sshd_proxy
74
75 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \
76 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \
77 -F $OBJ/ssh_proxy somehost true >/dev/null 2>&1
78 if [ $? -eq 0 ]; then
79 fail "ssh cert connect succeeded unexpectedly"
80 fi
81 done
82done
83
84# Revoked CA
85(
86 echon '@cert-authority '
87 echon "$HOSTS "
88 cat $OBJ/host_ca_key.pub
89 echon '@revoked '
90 echon "* "
91 cat $OBJ/host_ca_key.pub
92) > $OBJ/known_hosts-cert
93for ktype in rsa dsa ; do
94 verbose "$tid: host ${ktype} revoked cert"
95 (
96 cat $OBJ/sshd_proxy_bak
97 echo HostKey $OBJ/cert_host_key_${ktype}
98 echo HostCertificate $OBJ/cert_host_key_${ktype}-cert.pub
99 ) > $OBJ/sshd_proxy
100 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \
101 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \
102 -F $OBJ/ssh_proxy somehost true >/dev/null 2>&1
103 if [ $? -eq 0 ]; then
104 fail "ssh cert connect succeeded unexpectedly"
105 fi
106done
107
108# Create a CA key and add it to known hosts
109(
110 echon '@cert-authority '
111 echon "$HOSTS "
112 cat $OBJ/host_ca_key.pub
113) > $OBJ/known_hosts-cert
114
115test_one() {
116 ident=$1
117 result=$2
118 sign_opts=$3
119
120 verbose "$tid: test host cert connect $ident expect $result"
121
122 ${SSHKEYGEN} -q -s $OBJ/host_ca_key -I "regress host key for $USER" \
123 $sign_opts \
124 $OBJ/cert_host_key_rsa ||
125 fail "couldn't sign cert_host_key_rsa"
126 (
127 cat $OBJ/sshd_proxy_bak
128 echo HostKey $OBJ/cert_host_key_rsa
129 echo HostCertificate $OBJ/cert_host_key_rsa-cert.pub
130 ) > $OBJ/sshd_proxy
131
132 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \
133 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \
134 -F $OBJ/ssh_proxy somehost true >/dev/null 2>&1
135 rc=$?
136 if [ "x$result" = "xsuccess" ] ; then
137 if [ $rc -ne 0 ]; then
138 fail "ssh cert connect $ident failed unexpectedly"
139 fi
140 else
141 if [ $rc -eq 0 ]; then
142 fail "ssh cert connect $ident succeeded unexpectedly"
143 fi
144 fi
145}
146
147test_one "user-certificate" failure "-n $HOSTS"
148test_one "empty principals" success "-h"
149test_one "wrong principals" failure "-h -n foo"
150test_one "cert not yet valid" failure "-h -V20200101:20300101"
151test_one "cert expired" failure "-h -V19800101:19900101"
152test_one "cert valid interval" success "-h -V-1w:+2w"
153test_one "cert has constraints" failure "-h -Oforce-command=false"
154
155# Check downgrade of cert to raw key when no CA found
156rm -f $OBJ/known_hosts-cert $OBJ/cert_host_key*
157for ktype in rsa dsa ; do
158 verbose "$tid: host ${ktype} cert downgrade to raw key"
159 # Generate and sign a host key
160 ${SSHKEYGEN} -q -N '' -t ${ktype} \
161 -f $OBJ/cert_host_key_${ktype} || \
162 fail "ssh-keygen of cert_host_key_${ktype} failed"
163 ${SSHKEYGEN} -h -q -s $OBJ/host_ca_key -I "regress host key for $USER" \
164 -n $HOSTS $OBJ/cert_host_key_${ktype} ||
165 fail "couldn't sign cert_host_key_${ktype}"
166 (
167 echon "$HOSTS "
168 cat $OBJ/cert_host_key_${ktype}.pub
169 ) > $OBJ/known_hosts-cert
170 (
171 cat $OBJ/sshd_proxy_bak
172 echo HostKey $OBJ/cert_host_key_${ktype}
173 echo HostCertificate $OBJ/cert_host_key_${ktype}-cert.pub
174 ) > $OBJ/sshd_proxy
175
176 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \
177 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \
178 -F $OBJ/ssh_proxy somehost true
179 if [ $? -ne 0 ]; then
180 fail "ssh cert connect failed"
181 fi
182done
183
184# Wrong certificate
185(
186 echon '@cert-authority '
187 echon "$HOSTS "
188 cat $OBJ/host_ca_key.pub
189) > $OBJ/known_hosts-cert
190for ktype in rsa dsa ; do
191 # Self-sign key
192 ${SSHKEYGEN} -h -q -s $OBJ/cert_host_key_${ktype} \
193 -I "regress host key for $USER" \
194 -n $HOSTS $OBJ/cert_host_key_${ktype} ||
195 fail "couldn't sign cert_host_key_${ktype}"
196 verbose "$tid: host ${ktype} connect wrong cert"
197 (
198 cat $OBJ/sshd_proxy_bak
199 echo HostKey $OBJ/cert_host_key_${ktype}
200 echo HostCertificate $OBJ/cert_host_key_${ktype}-cert.pub
201 ) > $OBJ/sshd_proxy
202
203 ${SSH} -2 -oUserKnownHostsFile=$OBJ/known_hosts-cert \
204 -oGlobalKnownHostsFile=$OBJ/known_hosts-cert \
205 -F $OBJ/ssh_proxy -q somehost true >/dev/null 2>&1
206 if [ $? -eq 0 ]; then
207 fail "ssh cert connect $ident succeeded unexpectedly"
208 fi
209done
210
211rm -f $OBJ/known_hosts-cert $OBJ/host_ca_key* $OBJ/cert_host_key*
diff --git a/regress/cert-userkey.sh b/regress/cert-userkey.sh
new file mode 100644
index 000000000..7a58e7b75
--- /dev/null
+++ b/regress/cert-userkey.sh
@@ -0,0 +1,176 @@
1# $OpenBSD: cert-userkey.sh,v 1.3 2010/03/04 10:38:23 djm Exp $
2# Placed in the Public Domain.
3
4tid="certified user keys"
5
6rm -f $OBJ/authorized_keys_$USER $OBJ/user_ca_key* $OBJ/cert_user_key*
7cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
8
9# Create a CA key
10${SSHKEYGEN} -q -N '' -t rsa -f $OBJ/user_ca_key ||\
11 fail "ssh-keygen of user_ca_key failed"
12
13# Generate and sign user keys
14for ktype in rsa dsa ; do
15 verbose "$tid: sign user ${ktype} cert"
16 ${SSHKEYGEN} -q -N '' -t ${ktype} \
17 -f $OBJ/cert_user_key_${ktype} || \
18 fail "ssh-keygen of cert_user_key_${ktype} failed"
19 ${SSHKEYGEN} -q -s $OBJ/user_ca_key -I \
20 "regress user key for $USER" \
21 -n $USER $OBJ/cert_user_key_${ktype} ||
22 fail "couldn't sign cert_user_key_${ktype}"
23done
24
25basic_tests() {
26 auth=$1
27 if test "x$auth" = "xauthorized_keys" ; then
28 # Add CA to authorized_keys
29 (
30 echon 'cert-authority '
31 cat $OBJ/user_ca_key.pub
32 ) > $OBJ/authorized_keys_$USER
33 else
34 echo > $OBJ/authorized_keys_$USER
35 extra_sshd="TrustedUserCAKeys $OBJ/user_ca_key.pub"
36 fi
37
38 for ktype in rsa dsa ; do
39 for privsep in yes no ; do
40 _prefix="${ktype} privsep $privsep $auth"
41 # Simple connect
42 verbose "$tid: ${_prefix} connect"
43 (
44 cat $OBJ/sshd_proxy_bak
45 echo "UsePrivilegeSeparation $privsep"
46 echo "$extra_sshd"
47 ) > $OBJ/sshd_proxy
48
49 ${SSH} -2i $OBJ/cert_user_key_${ktype} \
50 -F $OBJ/ssh_proxy somehost true
51 if [ $? -ne 0 ]; then
52 fail "ssh cert connect failed"
53 fi
54
55 # Revoked keys
56 verbose "$tid: ${_prefix} revoked key"
57 (
58 cat $OBJ/sshd_proxy_bak
59 echo "UsePrivilegeSeparation $privsep"
60 echo "RevokedKeys $OBJ/cert_user_key_${ktype}.pub"
61 echo "$extra_sshd"
62 ) > $OBJ/sshd_proxy
63 ${SSH} -2i $OBJ/cert_user_key_${ktype} \
64 -F $OBJ/ssh_proxy somehost true >/dev/null 2>&1
65 if [ $? -eq 0 ]; then
66 fail "ssh cert connect succeeded unexpecedly"
67 fi
68 done
69
70 # Revoked CA
71 verbose "$tid: ${ktype} $auth revoked CA key"
72 (
73 cat $OBJ/sshd_proxy_bak
74 echo "RevokedKeys $OBJ/user_ca_key.pub"
75 echo "$extra_sshd"
76 ) > $OBJ/sshd_proxy
77 ${SSH} -2i $OBJ/cert_user_key_${ktype} -F $OBJ/ssh_proxy \
78 somehost true >/dev/null 2>&1
79 if [ $? -eq 0 ]; then
80 fail "ssh cert connect succeeded unexpecedly"
81 fi
82 done
83
84 verbose "$tid: $auth CA does not authenticate"
85 (
86 cat $OBJ/sshd_proxy_bak
87 echo "$extra_sshd"
88 ) > $OBJ/sshd_proxy
89 verbose "$tid: ensure CA key does not authenticate user"
90 ${SSH} -2i $OBJ/user_ca_key \
91 -F $OBJ/ssh_proxy somehost true >/dev/null 2>&1
92 if [ $? -eq 0 ]; then
93 fail "ssh cert connect with CA key succeeded unexpectedly"
94 fi
95}
96
97basic_tests authorized_keys
98basic_tests TrustedUserCAKeys
99
100test_one() {
101 ident=$1
102 result=$2
103 sign_opts=$3
104 auth_choice=$4
105
106 if test "x$auth_choice" = "x" ; then
107 auth_choice="authorized_keys TrustedUserCAKeys"
108 fi
109
110 for auth in $auth_choice ; do
111 cat $OBJ/sshd_proxy_bak > $OBJ/sshd_proxy
112 if test "x$auth" = "xauthorized_keys" ; then
113 # Add CA to authorized_keys
114 (
115 echon 'cert-authority '
116 cat $OBJ/user_ca_key.pub
117 ) > $OBJ/authorized_keys_$USER
118 else
119 echo > $OBJ/authorized_keys_$USER
120 echo "TrustedUserCAKeys $OBJ/user_ca_key.pub" >> \
121 $OBJ/sshd_proxy
122
123 fi
124
125 verbose "$tid: $ident auth $auth expect $result"
126 ${SSHKEYGEN} -q -s $OBJ/user_ca_key \
127 -I "regress user key for $USER" \
128 $sign_opts \
129 $OBJ/cert_user_key_rsa ||
130 fail "couldn't sign cert_user_key_rsa"
131
132 ${SSH} -2i $OBJ/cert_user_key_rsa -F $OBJ/ssh_proxy \
133 somehost true >/dev/null 2>&1
134 rc=$?
135 if [ "x$result" = "xsuccess" ] ; then
136 if [ $rc -ne 0 ]; then
137 fail "$ident failed unexpectedly"
138 fi
139 else
140 if [ $rc -eq 0 ]; then
141 fail "$ident succeeded unexpectedly"
142 fi
143 fi
144 done
145}
146
147test_one "correct principal" success "-n ${USER}"
148test_one "host-certificate" failure "-n ${USER} -h"
149test_one "wrong principals" failure "-n foo"
150test_one "cert not yet valid" failure "-n ${USER} -V20200101:20300101"
151test_one "cert expired" failure "-n ${USER} -V19800101:19900101"
152test_one "cert valid interval" success "-n ${USER} -V-1w:+2w"
153test_one "wrong source-address" failure "-n ${USER} -Osource-address=10.0.0.0/8"
154test_one "force-command" failure "-n ${USER} -Oforce-command=false"
155
156# Behaviour is different here: TrustedUserCAKeys doesn't allow empty principals
157test_one "empty principals" success "" authorized_keys
158test_one "empty principals" failure "" TrustedUserCAKeys
159
160# Wrong certificate
161for ktype in rsa dsa ; do
162 # Self-sign
163 ${SSHKEYGEN} -q -s $OBJ/cert_user_key_${ktype} -I \
164 "regress user key for $USER" \
165 -n $USER $OBJ/cert_user_key_${ktype} ||
166 fail "couldn't sign cert_user_key_${ktype}"
167 verbose "$tid: user ${ktype} connect wrong cert"
168 ${SSH} -2i $OBJ/cert_user_key_${ktype} -F $OBJ/ssh_proxy \
169 somehost true >/dev/null 2>&1
170 if [ $? -eq 0 ]; then
171 fail "ssh cert connect $ident succeeded unexpectedly"
172 fi
173done
174
175rm -f $OBJ/authorized_keys_$USER $OBJ/user_ca_key* $OBJ/cert_user_key*
176
diff --git a/regress/cfgmatch.sh b/regress/cfgmatch.sh
index 35c5e52a1..96badd51b 100644
--- a/regress/cfgmatch.sh
+++ b/regress/cfgmatch.sh
@@ -57,9 +57,9 @@ for p in 1 2; do
57done 57done
58 58
59# Retry previous with key option, should also be denied. 59# Retry previous with key option, should also be denied.
60echo -n 'permitopen="127.0.0.1:'$PORT'" ' >$OBJ/authorized_keys_$USER 60echon 'permitopen="127.0.0.1:'$PORT'" ' >$OBJ/authorized_keys_$USER
61cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER 61cat $OBJ/rsa.pub >> $OBJ/authorized_keys_$USER
62echo -n 'permitopen="127.0.0.1:'$PORT'" ' >>$OBJ/authorized_keys_$USER 62echon 'permitopen="127.0.0.1:'$PORT'" ' >>$OBJ/authorized_keys_$USER
63cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER 63cat $OBJ/rsa1.pub >> $OBJ/authorized_keys_$USER
64for p in 1 2; do 64for p in 1 2; do
65 rm -f $pidfile 65 rm -f $pidfile
diff --git a/regress/cipher-speed.sh b/regress/cipher-speed.sh
index d39a829d4..85de6d585 100644
--- a/regress/cipher-speed.sh
+++ b/regress/cipher-speed.sh
@@ -19,7 +19,7 @@ ciphers="aes128-cbc 3des-cbc blowfish-cbc cast128-cbc
19for c in $ciphers; do for m in $macs; do 19for c in $ciphers; do for m in $macs; do
20 trace "proto 2 cipher $c mac $m" 20 trace "proto 2 cipher $c mac $m"
21 for x in $tries; do 21 for x in $tries; do
22 echo -n "$c/$m:\t" 22 echon "$c/$m:\t"
23 ( ${SSH} -o 'compression no' \ 23 ( ${SSH} -o 'compression no' \
24 -F $OBJ/ssh_proxy -2 -m $m -c $c somehost \ 24 -F $OBJ/ssh_proxy -2 -m $m -c $c somehost \
25 exec sh -c \'"dd of=/dev/null obs=32k"\' \ 25 exec sh -c \'"dd of=/dev/null obs=32k"\' \
@@ -35,7 +35,7 @@ ciphers="3des blowfish"
35for c in $ciphers; do 35for c in $ciphers; do
36 trace "proto 1 cipher $c" 36 trace "proto 1 cipher $c"
37 for x in $tries; do 37 for x in $tries; do
38 echo -n "$c:\t" 38 echon "$c:\t"
39 ( ${SSH} -o 'compression no' \ 39 ( ${SSH} -o 'compression no' \
40 -F $OBJ/ssh_proxy -1 -c $c somehost \ 40 -F $OBJ/ssh_proxy -1 -c $c somehost \
41 exec sh -c \'"dd of=/dev/null obs=32k"\' \ 41 exec sh -c \'"dd of=/dev/null obs=32k"\' \
diff --git a/regress/forwarding.sh b/regress/forwarding.sh
index 9ffbb3dd4..6dec991a6 100644
--- a/regress/forwarding.sh
+++ b/regress/forwarding.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: forwarding.sh,v 1.6 2006/07/11 18:51:21 markus Exp $ 1# $OpenBSD: forwarding.sh,v 1.7 2010/01/11 02:53:44 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"
@@ -93,3 +93,13 @@ for p in 1 2; do
93 fi 93 fi
94 sleep 10 94 sleep 10
95done 95done
96
97for p in 2; do
98 trace "stdio forwarding proto $p"
99 cmd="${SSH} -$p -F $OBJ/ssh_config"
100 $cmd -o "ProxyCommand $cmd -q -W localhost:$PORT somehost" \
101 somehost true
102 if [ $? != 0 ]; then
103 fail "stdio forwarding proto $p"
104 fi
105done
diff --git a/regress/keygen-convert.sh b/regress/keygen-convert.sh
new file mode 100644
index 000000000..ad0e9c637
--- /dev/null
+++ b/regress/keygen-convert.sh
@@ -0,0 +1,33 @@
1# $OpenBSD: keygen-convert.sh,v 1.1 2009/11/09 04:20:04 dtucker Exp $
2# Placed in the Public Domain.
3
4tid="convert keys"
5
6for t in rsa dsa; do
7 # generate user key for agent
8 trace "generating $t key"
9 rm -f $OBJ/$t-key
10 ${SSHKEYGEN} -q -N "" -t $t -f $OBJ/$t-key
11
12 trace "export $t private to rfc4716 public"
13 ${SSHKEYGEN} -q -e -f $OBJ/$t-key >$OBJ/$t-key-rfc || \
14 fail "export $t private to rfc4716 public"
15
16 trace "export $t public to rfc4716 public"
17 ${SSHKEYGEN} -q -e -f $OBJ/$t-key.pub >$OBJ/$t-key-rfc.pub || \
18 fail "$t public to rfc4716 public"
19
20 cmp $OBJ/$t-key-rfc $OBJ/$t-key-rfc.pub || \
21 fail "$t rfc4716 exports differ between public and private"
22
23 trace "import $t rfc4716 public"
24 ${SSHKEYGEN} -q -i -f $OBJ/$t-key-rfc >$OBJ/$t-rfc-imported || \
25 fail "$t import rfc4716 public"
26
27 cut -f1,2 -d " " $OBJ/$t-key.pub >$OBJ/$t-key-nocomment.pub
28 cmp $OBJ/$t-key-nocomment.pub $OBJ/$t-rfc-imported || \
29 fail "$t imported differs from original"
30
31 rm -f $OBJ/$t-key $OBJ/$t-key.pub $OBJ/$t-key-rfc $OBJ/$t-key-rfc.pub \
32 $OBJ/$t-rfc-imported $OBJ/$t-key-nocomment.pub
33done
diff --git a/regress/multiplex.sh b/regress/multiplex.sh
index 4fba7b5ac..8a98a6e54 100644
--- a/regress/multiplex.sh
+++ b/regress/multiplex.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: multiplex.sh,v 1.11 2005/04/25 09:54:09 dtucker Exp $ 1# $OpenBSD: multiplex.sh,v 1.12 2009/05/05 07:51:36 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.$$
@@ -26,7 +26,7 @@ sleep 5
26 26
27verbose "test $tid: envpass" 27verbose "test $tid: envpass"
28trace "env passing over multiplexed connection" 28trace "env passing over multiplexed connection"
29_XXX_TEST=blah ${SSH} -oSendEnv="_XXX_TEST" -S$CTL otherhost sh << 'EOF' 29_XXX_TEST=blah ${SSH} -F $OBJ/ssh_config -oSendEnv="_XXX_TEST" -S$CTL otherhost sh << 'EOF'
30 test X"$_XXX_TEST" = X"blah" 30 test X"$_XXX_TEST" = X"blah"
31EOF 31EOF
32if [ $? -ne 0 ]; then 32if [ $? -ne 0 ]; then
@@ -36,26 +36,26 @@ fi
36verbose "test $tid: transfer" 36verbose "test $tid: transfer"
37rm -f ${COPY} 37rm -f ${COPY}
38trace "ssh transfer over multiplexed connection and check result" 38trace "ssh transfer over multiplexed connection and check result"
39${SSH} -S$CTL otherhost cat ${DATA} > ${COPY} 39${SSH} -F $OBJ/ssh_config -S$CTL otherhost cat ${DATA} > ${COPY}
40test -f ${COPY} || fail "ssh -Sctl: failed copy ${DATA}" 40test -f ${COPY} || fail "ssh -Sctl: failed copy ${DATA}"
41cmp ${DATA} ${COPY} || fail "ssh -Sctl: corrupted copy of ${DATA}" 41cmp ${DATA} ${COPY} || fail "ssh -Sctl: corrupted copy of ${DATA}"
42 42
43rm -f ${COPY} 43rm -f ${COPY}
44trace "ssh transfer over multiplexed connection and check result" 44trace "ssh transfer over multiplexed connection and check result"
45${SSH} -S $CTL otherhost cat ${DATA} > ${COPY} 45${SSH} -F $OBJ/ssh_config -S $CTL otherhost cat ${DATA} > ${COPY}
46test -f ${COPY} || fail "ssh -S ctl: failed copy ${DATA}" 46test -f ${COPY} || fail "ssh -S ctl: failed copy ${DATA}"
47cmp ${DATA} ${COPY} || fail "ssh -S ctl: corrupted copy of ${DATA}" 47cmp ${DATA} ${COPY} || fail "ssh -S ctl: corrupted copy of ${DATA}"
48 48
49rm -f ${COPY} 49rm -f ${COPY}
50trace "sftp transfer over multiplexed connection and check result" 50trace "sftp transfer over multiplexed connection and check result"
51echo "get ${DATA} ${COPY}" | \ 51echo "get ${DATA} ${COPY}" | \
52 ${SFTP} -S ${SSH} -oControlPath=$CTL otherhost >$LOG 2>&1 52 ${SFTP} -S ${SSH} -F $OBJ/ssh_config -oControlPath=$CTL otherhost >$LOG 2>&1
53test -f ${COPY} || fail "sftp: failed copy ${DATA}" 53test -f ${COPY} || fail "sftp: failed copy ${DATA}"
54cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}" 54cmp ${DATA} ${COPY} || fail "sftp: corrupted copy of ${DATA}"
55 55
56rm -f ${COPY} 56rm -f ${COPY}
57trace "scp transfer over multiplexed connection and check result" 57trace "scp transfer over multiplexed connection and check result"
58${SCP} -S ${SSH} -oControlPath=$CTL otherhost:${DATA} ${COPY} >$LOG 2>&1 58${SCP} -S ${SSH} -F $OBJ/ssh_config -oControlPath=$CTL otherhost:${DATA} ${COPY} >$LOG 2>&1
59test -f ${COPY} || fail "scp: failed copy ${DATA}" 59test -f ${COPY} || fail "scp: failed copy ${DATA}"
60cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}" 60cmp ${DATA} ${COPY} || fail "scp: corrupted copy of ${DATA}"
61 61
@@ -64,7 +64,7 @@ rm -f ${COPY}
64for s in 0 1 4 5 44; do 64for s in 0 1 4 5 44; do
65 trace "exit status $s over multiplexed connection" 65 trace "exit status $s over multiplexed connection"
66 verbose "test $tid: status $s" 66 verbose "test $tid: status $s"
67 ${SSH} -S $CTL otherhost exit $s 67 ${SSH} -F $OBJ/ssh_config -S $CTL otherhost exit $s
68 r=$? 68 r=$?
69 if [ $r -ne $s ]; then 69 if [ $r -ne $s ]; then
70 fail "exit code mismatch for protocol $p: $r != $s" 70 fail "exit code mismatch for protocol $p: $r != $s"
@@ -72,7 +72,7 @@ for s in 0 1 4 5 44; do
72 72
73 # same with early close of stdout/err 73 # same with early close of stdout/err
74 trace "exit status $s with early close over multiplexed connection" 74 trace "exit status $s with early close over multiplexed connection"
75 ${SSH} -S $CTL -n otherhost \ 75 ${SSH} -F $OBJ/ssh_config -S $CTL -n otherhost \
76 exec sh -c \'"sleep 2; exec > /dev/null 2>&1; sleep 3; exit $s"\' 76 exec sh -c \'"sleep 2; exec > /dev/null 2>&1; sleep 3; exit $s"\'
77 r=$? 77 r=$?
78 if [ $r -ne $s ]; then 78 if [ $r -ne $s ]; then
@@ -81,10 +81,10 @@ for s in 0 1 4 5 44; do
81done 81done
82 82
83trace "test check command" 83trace "test check command"
84${SSH} -S $CTL -Ocheck otherhost || fail "check command failed" 84${SSH} -F $OBJ/ssh_config -S $CTL -Ocheck otherhost || fail "check command failed"
85 85
86trace "test exit command" 86trace "test exit command"
87${SSH} -S $CTL -Oexit otherhost || fail "send exit command failed" 87${SSH} -F $OBJ/ssh_config -S $CTL -Oexit otherhost || fail "send exit command failed"
88 88
89# Wait for master to exit 89# Wait for master to exit
90sleep 2 90sleep 2
diff --git a/regress/portnum.sh b/regress/portnum.sh
new file mode 100644
index 000000000..1de0680fe
--- /dev/null
+++ b/regress/portnum.sh
@@ -0,0 +1,34 @@
1# $OpenBSD: portnum.sh,v 1.1 2009/08/13 00:57:17 djm Exp $
2# Placed in the Public Domain.
3
4tid="port number parsing"
5
6badport() {
7 port=$1
8 verbose "$tid: invalid port $port"
9 if ${SSH} -F $OBJ/ssh_proxy -p $port somehost true 2>/dev/null ; then
10 fail "$tid accepted invalid port $port"
11 fi
12}
13goodport() {
14 port=$1
15 verbose "$tid: valid port $port"
16 if ${SSH} -F $OBJ/ssh_proxy -p $port somehost true 2>/dev/null ; then
17 :
18 else
19 fail "$tid rejected valid port $port"
20 fi
21}
22
23badport 0
24badport 65536
25badport 131073
26badport 2000blah
27badport blah2000
28
29goodport 1
30goodport 22
31goodport 2222
32goodport 22222
33goodport 65535
34
diff --git a/regress/sftp-badcmds.sh b/regress/sftp-badcmds.sh
index b48b1cb01..08009f26b 100644
--- a/regress/sftp-badcmds.sh
+++ b/regress/sftp-badcmds.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: sftp-badcmds.sh,v 1.3 2008/03/24 21:46:54 djm Exp $ 1# $OpenBSD: sftp-badcmds.sh,v 1.4 2009/08/13 01:11:55 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="sftp invalid commands" 4tid="sftp invalid commands"
@@ -13,13 +13,13 @@ rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd
13 13
14rm -f ${COPY} 14rm -f ${COPY}
15verbose "$tid: get nonexistent" 15verbose "$tid: get nonexistent"
16echo "get $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 16echo "get $NONEXIST $COPY" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
17 || fail "get nonexistent failed" 17 || fail "get nonexistent failed"
18test -f ${COPY} && fail "existing copy after get nonexistent" 18test -f ${COPY} && fail "existing copy after get nonexistent"
19 19
20rm -f ${COPY}.dd/* 20rm -f ${COPY}.dd/*
21verbose "$tid: glob get to nonexistent directory" 21verbose "$tid: glob get to nonexistent directory"
22echo "get /bin/l* $NONEXIST" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 22echo "get /bin/l* $NONEXIST" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
23 || fail "get nonexistent failed" 23 || fail "get nonexistent failed"
24for x in $GLOBFILES; do 24for x in $GLOBFILES; do
25 test -f ${COPY}.dd/$x && fail "existing copy after get nonexistent" 25 test -f ${COPY}.dd/$x && fail "existing copy after get nonexistent"
@@ -27,13 +27,13 @@ done
27 27
28rm -f ${COPY} 28rm -f ${COPY}
29verbose "$tid: put nonexistent" 29verbose "$tid: put nonexistent"
30echo "put $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 30echo "put $NONEXIST $COPY" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
31 || fail "put nonexistent failed" 31 || fail "put nonexistent failed"
32test -f ${COPY} && fail "existing copy after put nonexistent" 32test -f ${COPY} && fail "existing copy after put nonexistent"
33 33
34rm -f ${COPY}.dd/* 34rm -f ${COPY}.dd/*
35verbose "$tid: glob put to nonexistent directory" 35verbose "$tid: glob put to nonexistent directory"
36echo "put /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 36echo "put /bin/l* ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
37 || fail "put nonexistent failed" 37 || fail "put nonexistent failed"
38for x in $GLOBFILES; do 38for x in $GLOBFILES; do
39 test -f ${COPY}.dd/$x && fail "existing copy after nonexistent" 39 test -f ${COPY}.dd/$x && fail "existing copy after nonexistent"
@@ -41,7 +41,7 @@ done
41 41
42rm -f ${COPY} 42rm -f ${COPY}
43verbose "$tid: rename nonexistent" 43verbose "$tid: rename nonexistent"
44echo "rename $NONEXIST ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 44echo "rename $NONEXIST ${COPY}.1" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
45 || fail "rename nonexist failed" 45 || fail "rename nonexist failed"
46test -f ${COPY}.1 && fail "file exists after rename nonexistent" 46test -f ${COPY}.1 && fail "file exists after rename nonexistent"
47 47
@@ -49,7 +49,7 @@ rm -rf ${COPY} ${COPY}.dd
49cp $DATA $COPY 49cp $DATA $COPY
50mkdir ${COPY}.dd 50mkdir ${COPY}.dd
51verbose "$tid: rename target exists (directory)" 51verbose "$tid: rename target exists (directory)"
52echo "rename $COPY ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 52echo "rename $COPY ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
53 || fail "rename target exists (directory) failed" 53 || fail "rename target exists (directory) failed"
54test -f ${COPY} || fail "oldname missing after rename target exists (directory)" 54test -f ${COPY} || fail "oldname missing after rename target exists (directory)"
55test -d ${COPY}.dd || fail "newname missing after rename target exists (directory)" 55test -d ${COPY}.dd || fail "newname missing after rename target exists (directory)"
@@ -59,7 +59,7 @@ rm -f ${COPY}.dd/*
59rm -rf ${COPY} 59rm -rf ${COPY}
60cp ${DATA2} ${COPY} 60cp ${DATA2} ${COPY}
61verbose "$tid: glob put files to local file" 61verbose "$tid: glob put files to local file"
62echo "put /bin/l* $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 62echo "put /bin/l* $COPY" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1
63cmp ${DATA2} ${COPY} || fail "put successed when it should have failed" 63cmp ${DATA2} ${COPY} || fail "put successed when it should have failed"
64 64
65rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd 65rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd
diff --git a/regress/sftp-batch.sh b/regress/sftp-batch.sh
index 365c47cfc..a51ef0782 100644
--- a/regress/sftp-batch.sh
+++ b/regress/sftp-batch.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: sftp-batch.sh,v 1.3 2004/01/13 09:49:06 djm Exp $ 1# $OpenBSD: sftp-batch.sh,v 1.4 2009/08/13 01:11:55 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="sftp batchfile" 4tid="sftp batchfile"
@@ -37,19 +37,19 @@ cat << EOF > ${BATCH}.fail.2
37EOF 37EOF
38 38
39verbose "$tid: good commands" 39verbose "$tid: good commands"
40${SFTP} -b ${BATCH}.pass.1 -P ${SFTPSERVER} >/dev/null 2>&1 \ 40${SFTP} -b ${BATCH}.pass.1 -D ${SFTPSERVER} >/dev/null 2>&1 \
41 || fail "good commands failed" 41 || fail "good commands failed"
42 42
43verbose "$tid: bad commands" 43verbose "$tid: bad commands"
44${SFTP} -b ${BATCH}.fail.1 -P ${SFTPSERVER} >/dev/null 2>&1 \ 44${SFTP} -b ${BATCH}.fail.1 -D ${SFTPSERVER} >/dev/null 2>&1 \
45 && fail "bad commands succeeded" 45 && fail "bad commands succeeded"
46 46
47verbose "$tid: comments and blanks" 47verbose "$tid: comments and blanks"
48${SFTP} -b ${BATCH}.pass.2 -P ${SFTPSERVER} >/dev/null 2>&1 \ 48${SFTP} -b ${BATCH}.pass.2 -D ${SFTPSERVER} >/dev/null 2>&1 \
49 || fail "comments & blanks failed" 49 || fail "comments & blanks failed"
50 50
51verbose "$tid: junk command" 51verbose "$tid: junk command"
52${SFTP} -b ${BATCH}.fail.2 -P ${SFTPSERVER} >/dev/null 2>&1 \ 52${SFTP} -b ${BATCH}.fail.2 -D ${SFTPSERVER} >/dev/null 2>&1 \
53 && fail "junk command succeeded" 53 && fail "junk command succeeded"
54 54
55rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.* 55rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
diff --git a/regress/sftp-cmds.sh b/regress/sftp-cmds.sh
index 3b453c5e8..c4d6ae2de 100644
--- a/regress/sftp-cmds.sh
+++ b/regress/sftp-cmds.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: sftp-cmds.sh,v 1.9 2007/12/12 05:04:03 djm Exp $ 1# $OpenBSD: sftp-cmds.sh,v 1.10 2009/08/13 01:11:55 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4# XXX - TODO: 4# XXX - TODO:
@@ -40,56 +40,56 @@ SPACECOPY_ARG="${COPY}\ this\ has\ spaces.txt"
40# File with glob metacharacters 40# File with glob metacharacters
41GLOBMETACOPY="${COPY} [metachar].txt" 41GLOBMETACOPY="${COPY} [metachar].txt"
42 42
43rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 43rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 ${BATCH}.*
44mkdir ${COPY}.dd 44mkdir ${COPY}.dd
45 45
46verbose "$tid: lls" 46verbose "$tid: lls"
47(echo "lcd ${OBJ}" ; echo "lls") | ${SFTP} -P ${SFTPSERVER} 2>&1 | \ 47(echo "lcd ${OBJ}" ; echo "lls") | ${SFTP} -D ${SFTPSERVER} 2>&1 | \
48 grep copy.dd >/dev/null 2>&1 || fail "lls failed" 48 grep copy.dd >/dev/null 2>&1 || fail "lls failed"
49 49
50verbose "$tid: lls w/path" 50verbose "$tid: lls w/path"
51echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} 2>&1 | \ 51echo "lls ${OBJ}" | ${SFTP} -D ${SFTPSERVER} 2>&1 | \
52 grep copy.dd >/dev/null 2>&1 || fail "lls w/path failed" 52 grep copy.dd >/dev/null 2>&1 || fail "lls w/path failed"
53 53
54verbose "$tid: ls" 54verbose "$tid: ls"
55echo "ls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 55echo "ls ${OBJ}" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
56 || fail "ls failed" 56 || fail "ls failed"
57# XXX always successful 57# XXX always successful
58 58
59verbose "$tid: shell" 59verbose "$tid: shell"
60echo "!echo hi there" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 60echo "!echo hi there" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
61 || fail "shell failed" 61 || fail "shell failed"
62# XXX always successful 62# XXX always successful
63 63
64verbose "$tid: pwd" 64verbose "$tid: pwd"
65echo "pwd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 65echo "pwd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
66 || fail "pwd failed" 66 || fail "pwd failed"
67# XXX always successful 67# XXX always successful
68 68
69verbose "$tid: lpwd" 69verbose "$tid: lpwd"
70echo "lpwd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 70echo "lpwd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
71 || fail "lpwd failed" 71 || fail "lpwd failed"
72# XXX always successful 72# XXX always successful
73 73
74verbose "$tid: quit" 74verbose "$tid: quit"
75echo "quit" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 75echo "quit" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
76 || fail "quit failed" 76 || fail "quit failed"
77# XXX always successful 77# XXX always successful
78 78
79verbose "$tid: help" 79verbose "$tid: help"
80echo "help" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 80echo "help" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
81 || fail "help failed" 81 || fail "help failed"
82# XXX always successful 82# XXX always successful
83 83
84rm -f ${COPY} 84rm -f ${COPY}
85verbose "$tid: get" 85verbose "$tid: get"
86echo "get $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 86echo "get $DATA $COPY" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
87 || fail "get failed" 87 || fail "get failed"
88cmp $DATA ${COPY} || fail "corrupted copy after get" 88cmp $DATA ${COPY} || fail "corrupted copy after get"
89 89
90rm -f ${COPY} 90rm -f ${COPY}
91verbose "$tid: get quoted" 91verbose "$tid: get quoted"
92echo "get \"$DATA\" $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 92echo "get \"$DATA\" $COPY" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
93 || fail "get failed" 93 || fail "get failed"
94cmp $DATA ${COPY} || fail "corrupted copy after get" 94cmp $DATA ${COPY} || fail "corrupted copy after get"
95 95
@@ -97,8 +97,8 @@ if [ "$os" != "cygwin" ]; then
97rm -f ${QUOTECOPY} 97rm -f ${QUOTECOPY}
98cp $DATA ${QUOTECOPY} 98cp $DATA ${QUOTECOPY}
99verbose "$tid: get filename with quotes" 99verbose "$tid: get filename with quotes"
100echo "get \"$QUOTECOPY_ARG\" ${COPY}" | \ 100echo "get \"$QUOTECOPY_ARG\" ${COPY}" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
101 ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ || fail "get failed" 101 || fail "get failed"
102cmp ${COPY} ${QUOTECOPY} || fail "corrupted copy after get with quotes" 102cmp ${COPY} ${QUOTECOPY} || fail "corrupted copy after get with quotes"
103rm -f ${QUOTECOPY} ${COPY} 103rm -f ${QUOTECOPY} ${COPY}
104fi 104fi
@@ -106,7 +106,7 @@ fi
106rm -f "$SPACECOPY" ${COPY} 106rm -f "$SPACECOPY" ${COPY}
107cp $DATA "$SPACECOPY" 107cp $DATA "$SPACECOPY"
108verbose "$tid: get filename with spaces" 108verbose "$tid: get filename with spaces"
109echo "get ${SPACECOPY_ARG} ${COPY}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 109echo "get ${SPACECOPY_ARG} ${COPY}" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
110 || fail "get failed" 110 || fail "get failed"
111cmp ${COPY} "$SPACECOPY" || fail "corrupted copy after get with spaces" 111cmp ${COPY} "$SPACECOPY" || fail "corrupted copy after get with spaces"
112 112
@@ -114,19 +114,19 @@ rm -f "$GLOBMETACOPY" ${COPY}
114cp $DATA "$GLOBMETACOPY" 114cp $DATA "$GLOBMETACOPY"
115verbose "$tid: get filename with glob metacharacters" 115verbose "$tid: get filename with glob metacharacters"
116echo "get \"${GLOBMETACOPY}\" ${COPY}" | \ 116echo "get \"${GLOBMETACOPY}\" ${COPY}" | \
117 ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "get failed" 117 ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 || fail "get failed"
118cmp ${COPY} "$GLOBMETACOPY" || \ 118cmp ${COPY} "$GLOBMETACOPY" || \
119 fail "corrupted copy after get with glob metacharacters" 119 fail "corrupted copy after get with glob metacharacters"
120 120
121rm -f ${COPY}.dd/* 121rm -f ${COPY}.dd/*
122verbose "$tid: get to directory" 122verbose "$tid: get to directory"
123echo "get $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 123echo "get $DATA ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
124 || fail "get failed" 124 || fail "get failed"
125cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get" 125cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get"
126 126
127rm -f ${COPY}.dd/* 127rm -f ${COPY}.dd/*
128verbose "$tid: glob get to directory" 128verbose "$tid: glob get to directory"
129echo "get /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 129echo "get /bin/l* ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
130 || fail "get failed" 130 || fail "get failed"
131for x in $GLOBFILES; do 131for x in $GLOBFILES; do
132 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get" 132 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get"
@@ -134,13 +134,13 @@ done
134 134
135rm -f ${COPY}.dd/* 135rm -f ${COPY}.dd/*
136verbose "$tid: get to local dir" 136verbose "$tid: get to local dir"
137(echo "lcd ${COPY}.dd"; echo "get $DATA" ) | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 137(echo "lcd ${COPY}.dd"; echo "get $DATA" ) | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
138 || fail "get failed" 138 || fail "get failed"
139cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get" 139cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after get"
140 140
141rm -f ${COPY}.dd/* 141rm -f ${COPY}.dd/*
142verbose "$tid: glob get to local dir" 142verbose "$tid: glob get to local dir"
143(echo "lcd ${COPY}.dd"; echo "get /bin/l*") | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 143(echo "lcd ${COPY}.dd"; echo "get /bin/l*") | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
144 || fail "get failed" 144 || fail "get failed"
145for x in $GLOBFILES; do 145for x in $GLOBFILES; do
146 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get" 146 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after get"
@@ -149,32 +149,32 @@ done
149rm -f ${COPY} 149rm -f ${COPY}
150verbose "$tid: put" 150verbose "$tid: put"
151echo "put $DATA $COPY" | \ 151echo "put $DATA $COPY" | \
152 ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "put failed" 152 ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 || fail "put failed"
153cmp $DATA ${COPY} || fail "corrupted copy after put" 153cmp $DATA ${COPY} || fail "corrupted copy after put"
154 154
155if [ "$os" != "cygwin" ]; then 155if [ "$os" != "cygwin" ]; then
156rm -f ${QUOTECOPY} 156rm -f ${QUOTECOPY}
157verbose "$tid: put filename with quotes" 157verbose "$tid: put filename with quotes"
158echo "put $DATA \"$QUOTECOPY_ARG\"" | \ 158echo "put $DATA \"$QUOTECOPY_ARG\"" | \
159 ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "put failed" 159 ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 || fail "put failed"
160cmp $DATA ${QUOTECOPY} || fail "corrupted copy after put with quotes" 160cmp $DATA ${QUOTECOPY} || fail "corrupted copy after put with quotes"
161fi 161fi
162 162
163rm -f "$SPACECOPY" 163rm -f "$SPACECOPY"
164verbose "$tid: put filename with spaces" 164verbose "$tid: put filename with spaces"
165echo "put $DATA ${SPACECOPY_ARG}" | \ 165echo "put $DATA ${SPACECOPY_ARG}" | \
166 ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "put failed" 166 ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 || fail "put failed"
167cmp $DATA "$SPACECOPY" || fail "corrupted copy after put with spaces" 167cmp $DATA "$SPACECOPY" || fail "corrupted copy after put with spaces"
168 168
169rm -f ${COPY}.dd/* 169rm -f ${COPY}.dd/*
170verbose "$tid: put to directory" 170verbose "$tid: put to directory"
171echo "put $DATA ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 171echo "put $DATA ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
172 || fail "put failed" 172 || fail "put failed"
173cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put" 173cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put"
174 174
175rm -f ${COPY}.dd/* 175rm -f ${COPY}.dd/*
176verbose "$tid: glob put to directory" 176verbose "$tid: glob put to directory"
177echo "put /bin/l? ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 177echo "put /bin/l? ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
178 || fail "put failed" 178 || fail "put failed"
179for x in $GLOBFILES; do 179for x in $GLOBFILES; do
180 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put" 180 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put"
@@ -182,60 +182,61 @@ done
182 182
183rm -f ${COPY}.dd/* 183rm -f ${COPY}.dd/*
184verbose "$tid: put to local dir" 184verbose "$tid: put to local dir"
185(echo "cd ${COPY}.dd"; echo "put $DATA") | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 185(echo "cd ${COPY}.dd"; echo "put $DATA") | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
186 || fail "put failed" 186 || fail "put failed"
187cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put" 187cmp $DATA ${COPY}.dd/`basename $DATA` || fail "corrupted copy after put"
188 188
189rm -f ${COPY}.dd/* 189rm -f ${COPY}.dd/*
190verbose "$tid: glob put to local dir" 190verbose "$tid: glob put to local dir"
191(echo "cd ${COPY}.dd"; echo "put /bin/l?") | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 191(echo "cd ${COPY}.dd"; echo "put /bin/l?") | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
192 || fail "put failed" 192 || fail "put failed"
193for x in $GLOBFILES; do 193for x in $GLOBFILES; do
194 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put" 194 cmp /bin/$x ${COPY}.dd/$x || fail "corrupted copy after put"
195done 195done
196 196
197verbose "$tid: rename" 197verbose "$tid: rename"
198echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 198echo "rename $COPY ${COPY}.1" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
199 || fail "rename failed" 199 || fail "rename failed"
200test -f ${COPY}.1 || fail "missing file after rename" 200test -f ${COPY}.1 || fail "missing file after rename"
201cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename" 201cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename"
202 202
203verbose "$tid: rename directory" 203verbose "$tid: rename directory"
204echo "rename ${COPY}.dd ${COPY}.dd2" | \ 204echo "rename ${COPY}.dd ${COPY}.dd2" | \
205 ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || \ 205 ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 || \
206 fail "rename directory failed" 206 fail "rename directory failed"
207test -d ${COPY}.dd && fail "oldname exists after rename directory" 207test -d ${COPY}.dd && fail "oldname exists after rename directory"
208test -d ${COPY}.dd2 || fail "missing newname after rename directory" 208test -d ${COPY}.dd2 || fail "missing newname after rename directory"
209 209
210verbose "$tid: ln" 210verbose "$tid: ln"
211echo "ln ${COPY}.1 ${COPY}.2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "ln failed" 211echo "ln ${COPY}.1 ${COPY}.2" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 || fail "ln failed"
212test -h ${COPY}.2 || fail "missing file after ln" 212test -h ${COPY}.2 || fail "missing file after ln"
213 213
214verbose "$tid: mkdir" 214verbose "$tid: mkdir"
215echo "mkdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 215echo "mkdir ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
216 || fail "mkdir failed" 216 || fail "mkdir failed"
217test -d ${COPY}.dd || fail "missing directory after mkdir" 217test -d ${COPY}.dd || fail "missing directory after mkdir"
218 218
219# XXX do more here 219# XXX do more here
220verbose "$tid: chdir" 220verbose "$tid: chdir"
221echo "chdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 221echo "chdir ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
222 || fail "chdir failed" 222 || fail "chdir failed"
223 223
224verbose "$tid: rmdir" 224verbose "$tid: rmdir"
225echo "rmdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 225echo "rmdir ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
226 || fail "rmdir failed" 226 || fail "rmdir failed"
227test -d ${COPY}.1 && fail "present directory after rmdir" 227test -d ${COPY}.1 && fail "present directory after rmdir"
228 228
229verbose "$tid: lmkdir" 229verbose "$tid: lmkdir"
230echo "lmkdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 230echo "lmkdir ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
231 || fail "lmkdir failed" 231 || fail "lmkdir failed"
232test -d ${COPY}.dd || fail "missing directory after lmkdir" 232test -d ${COPY}.dd || fail "missing directory after lmkdir"
233 233
234# XXX do more here 234# XXX do more here
235verbose "$tid: lchdir" 235verbose "$tid: lchdir"
236echo "lchdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \ 236echo "lchdir ${COPY}.dd" | ${SFTP} -D ${SFTPSERVER} >/dev/null 2>&1 \
237 || fail "lchdir failed" 237 || fail "lchdir failed"
238 238
239rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 239rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${COPY}.dd2 ${BATCH}.*
240rm -rf ${QUOTECOPY} "$SPACECOPY" "$GLOBMETACOPY" 240rm -rf ${QUOTECOPY} "$SPACECOPY" "$GLOBMETACOPY"
241 241
242
diff --git a/regress/sftp-glob.sh b/regress/sftp-glob.sh
index 60116a748..72bb17d75 100644
--- a/regress/sftp-glob.sh
+++ b/regress/sftp-glob.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: sftp-glob.sh,v 1.3 2007/10/26 05:30:01 djm Exp $ 1# $OpenBSD: sftp-glob.sh,v 1.4 2009/08/13 01:11:55 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="sftp glob" 4tid="sftp glob"
@@ -10,7 +10,7 @@ sftp_ls() {
10 unexpected=$4 10 unexpected=$4
11 verbose "$tid: $errtag" 11 verbose "$tid: $errtag"
12 printf "ls -l %s" "${target}" | \ 12 printf "ls -l %s" "${target}" | \
13 ${SFTP} -b - -P ${SFTPSERVER} 2>/dev/null | \ 13 ${SFTP} -b - -D ${SFTPSERVER} 2>/dev/null | \
14 grep -v "^sftp>" > ${RESULTS} 14 grep -v "^sftp>" > ${RESULTS}
15 if [ $? -ne 0 ]; then 15 if [ $? -ne 0 ]; then
16 fail "$errtag failed" 16 fail "$errtag failed"
diff --git a/regress/sftp.sh b/regress/sftp.sh
index 0e22f8f6b..f84fa6f4e 100644
--- a/regress/sftp.sh
+++ b/regress/sftp.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: sftp.sh,v 1.2 2002/03/27 22:39:52 markus Exp $ 1# $OpenBSD: sftp.sh,v 1.3 2009/08/13 01:11:55 djm 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"
@@ -19,8 +19,8 @@ REQUESTS="1 2 10"
19for B in ${BUFFERSIZE}; do 19for B in ${BUFFERSIZE}; do
20 for R in ${REQUESTS}; do 20 for R in ${REQUESTS}; do
21 verbose "test $tid: buffer_size $B num_requests $R" 21 verbose "test $tid: buffer_size $B num_requests $R"
22 rm -f ${COPY}.1 ${COPY}.2 22 rm -f ${COPY}.1 ${COPY}.2
23 ${SFTP} -P ${SFTPSERVER} -B $B -R $R -b $SFTPCMDFILE \ 23 ${SFTP} -D ${SFTPSERVER} -B $B -R $R -b $SFTPCMDFILE \
24 > /dev/null 2>&1 24 > /dev/null 2>&1
25 r=$? 25 r=$?
26 if [ $r -ne 0 ]; then 26 if [ $r -ne 0 ]; then
diff --git a/regress/ssh-com-sftp.sh b/regress/ssh-com-sftp.sh
index 936b4cca7..be6f4e0dc 100644
--- a/regress/ssh-com-sftp.sh
+++ b/regress/ssh-com-sftp.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: ssh-com-sftp.sh,v 1.5 2004/02/24 17:06:52 markus Exp $ 1# $OpenBSD: ssh-com-sftp.sh,v 1.6 2009/08/20 18:43:07 djm 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"
@@ -51,7 +51,7 @@ for v in ${VERSIONS}; do
51 for R in ${REQUESTS}; do 51 for R in ${REQUESTS}; do
52 verbose "test $tid: buffer_size $B num_requests $R" 52 verbose "test $tid: buffer_size $B num_requests $R"
53 rm -f ${COPY}.1 ${COPY}.2 53 rm -f ${COPY}.1 ${COPY}.2
54 ${SFTP} -P ${server} -B $B -R $R -b $SFTPCMDFILE \ 54 ${SFTP} -D ${server} -B $B -R $R -b $SFTPCMDFILE \
55 > /dev/null 2>&1 55 > /dev/null 2>&1
56 r=$? 56 r=$?
57 if [ $r -ne 0 ]; then 57 if [ $r -ne 0 ]; then
diff --git a/regress/ssh2putty.sh b/regress/ssh2putty.sh
index dfdeeff4a..691db1690 100755
--- a/regress/ssh2putty.sh
+++ b/regress/ssh2putty.sh
@@ -1,4 +1,5 @@
1#!/bin/sh 1#!/bin/sh
2# $OpenBSD: ssh2putty.sh,v 1.2 2009/10/06 23:51:49 dtucker Exp $
2 3
3if test "x$1" = "x" -o "x$2" = "x" -o "x$3" = "x" ; then 4if test "x$1" = "x" -o "x$2" = "x" -o "x$3" = "x" ; then
4 echo "Usage: ssh2putty hostname port ssh-private-key" 5 echo "Usage: ssh2putty hostname port ssh-private-key"
diff --git a/regress/test-exec.sh b/regress/test-exec.sh
index b54448912..b3a19389d 100644
--- a/regress/test-exec.sh
+++ b/regress/test-exec.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: test-exec.sh,v 1.35 2008/06/28 13:57:25 djm Exp $ 1# $OpenBSD: test-exec.sh,v 1.37 2010/02/24 06:21:56 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4#SUDO=sudo 4#SUDO=sudo
@@ -172,9 +172,17 @@ cleanup ()
172 echo no sshd running 172 echo no sshd running
173 else 173 else
174 if [ $pid -lt 2 ]; then 174 if [ $pid -lt 2 ]; then
175 echo bad pid for ssd: $pid 175 echo bad pid for ssh: $pid
176 else 176 else
177 $SUDO kill $pid 177 $SUDO kill $pid
178 trace "wait for sshd to exit"
179 i=0;
180 while [ -f $PIDFILE -a $i -lt 5 ]; do
181 i=`expr $i + 1`
182 sleep $i
183 done
184 test -f $PIDFILE && \
185 fatal "sshd didn't exit port $PORT pid $pid"
178 fi 186 fi
179 fi 187 fi
180 fi 188 fi
@@ -222,6 +230,7 @@ trap fatal 3 2
222cat << EOF > $OBJ/sshd_config 230cat << EOF > $OBJ/sshd_config
223 StrictModes no 231 StrictModes no
224 Port $PORT 232 Port $PORT
233 Protocol 2,1
225 AddressFamily inet 234 AddressFamily inet
226 ListenAddress 127.0.0.1 235 ListenAddress 127.0.0.1
227 #ListenAddress ::1 236 #ListenAddress ::1
@@ -247,6 +256,7 @@ echo 'StrictModes no' >> $OBJ/sshd_proxy
247# create client config 256# create client config
248cat << EOF > $OBJ/ssh_config 257cat << EOF > $OBJ/ssh_config
249Host * 258Host *
259 Protocol 2,1
250 Hostname 127.0.0.1 260 Hostname 127.0.0.1
251 HostKeyAlias localhost-with-alias 261 HostKeyAlias localhost-with-alias
252 Port $PORT 262 Port $PORT