summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2003-09-01 18:42:19 +0000
committerColin Watson <cjwatson@debian.org>2003-09-01 18:42:19 +0000
commit8d6b7f4c46de3feb66f704ab483e51ea1a3bb0e1 (patch)
tree41fe3dd71501bbec5b0393f1536c925eaee180e9 /regress
parentf045c69060bfdd5cf8759a5f29d7008d02e4de5b (diff)
parent58bfa257481a1c6938ada9bbd38801cc45633fb0 (diff)
Debian release 3.6p1-1.
Diffstat (limited to 'regress')
-rw-r--r--regress/Makefile14
-rw-r--r--regress/agent-getpeereid.sh34
-rw-r--r--regress/agent-ptrace.sh28
-rw-r--r--regress/agent-timeout.sh36
-rw-r--r--regress/keygen-change.sh23
-rw-r--r--regress/proxy-connect.sh9
-rw-r--r--regress/sftp-batch.sh57
-rw-r--r--regress/sftp-cmds.sh100
-rw-r--r--regress/ssh-com-client.sh6
-rw-r--r--regress/ssh-com-keygen.sh6
-rw-r--r--regress/ssh-com-sftp.sh6
-rw-r--r--regress/ssh-com.sh10
12 files changed, 314 insertions, 15 deletions
diff --git a/regress/Makefile b/regress/Makefile
index 26224cd7d..6e2029348 100644
--- a/regress/Makefile
+++ b/regress/Makefile
@@ -1,8 +1,8 @@
1# $OpenBSD: Makefile,v 1.13 2002/04/01 22:15:08 markus Exp $ 1# $OpenBSD: Makefile,v 1.20 2003/01/08 23:54:22 djm Exp $
2 2
3REGRESSTARGETS= t1 t2 t3 t4 t5 t6 t7 3REGRESS_TARGETS= t1 t2 t3 t4 t5 t6 t7
4 4
5CLEANFILES+= t2.out t6.out1 t6.out2 t7.out t7.out.pub 5CLEANFILES+= t2.out t6.out1 t6.out2 t7.out t7.out.pub copy.1 copy.2
6 6
7LTESTS= connect \ 7LTESTS= connect \
8 proxy-connect \ 8 proxy-connect \
@@ -17,8 +17,14 @@ LTESTS= connect \
17 try-ciphers \ 17 try-ciphers \
18 yes-head \ 18 yes-head \
19 agent \ 19 agent \
20 agent-getpeereid \
21 agent-timeout \
22 agent-ptrace \
20 keyscan \ 23 keyscan \
24 keygen-change \
21 sftp \ 25 sftp \
26 sftp-cmds \
27 sftp-batch \
22 forwarding 28 forwarding
23 29
24USER!= id -un 30USER!= id -un
@@ -65,7 +71,7 @@ t7: t7.out
65 ssh-keygen -Bf t7.out > /dev/null 71 ssh-keygen -Bf t7.out > /dev/null
66 72
67.for t in ${LTESTS} 73.for t in ${LTESTS}
68REGRESSTARGETS+=t-${t} 74REGRESS_TARGETS+=t-${t}
69t-${t}: 75t-${t}:
70 sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/${t}.sh 76 sh ${.CURDIR}/test-exec.sh ${.OBJDIR} ${.CURDIR}/${t}.sh
71.endfor 77.endfor
diff --git a/regress/agent-getpeereid.sh b/regress/agent-getpeereid.sh
new file mode 100644
index 000000000..0889fe80e
--- /dev/null
+++ b/regress/agent-getpeereid.sh
@@ -0,0 +1,34 @@
1# $OpenBSD: agent-getpeereid.sh,v 1.1 2002/12/09 16:05:02 markus Exp $
2# Placed in the Public Domain.
3
4tid="disallow agent attach from other uid"
5
6UNPRIV=nobody
7ASOCK=${OBJ}/agent
8SSH_AUTH_SOCK=/nonexistant
9
10trace "start agent"
11eval `${SSHAGENT} -s -a ${ASOCK}` > /dev/null
12r=$?
13if [ $r -ne 0 ]; then
14 fail "could not start ssh-agent: exit code $r"
15else
16 chmod 644 ${SSH_AUTH_SOCK}
17
18 ssh-add -l > /dev/null 2>&1
19 r=$?
20 if [ $r -ne 1 ]; then
21 fail "ssh-add failed with $r != 1"
22 fi
23
24 < /dev/null sudo -S -u ${UNPRIV} ssh-add -l > /dev/null 2>&1
25 r=$?
26 if [ $r -lt 2 ]; then
27 fail "ssh-add did not fail for ${UNPRIV}: $r < 2"
28 fi
29
30 trace "kill agent"
31 ${SSHAGENT} -k > /dev/null
32fi
33
34rm -f ${OBJ}/agent
diff --git a/regress/agent-ptrace.sh b/regress/agent-ptrace.sh
new file mode 100644
index 000000000..9f9c99960
--- /dev/null
+++ b/regress/agent-ptrace.sh
@@ -0,0 +1,28 @@
1# $OpenBSD: agent-ptrace.sh,v 1.1 2002/12/09 15:38:30 markus Exp $
2# Placed in the Public Domain.
3
4tid="disallow agent ptrace attach"
5
6trace "start agent"
7eval `${SSHAGENT} -s` > /dev/null
8r=$?
9if [ $r -ne 0 ]; then
10 fail "could not start ssh-agent: exit code $r"
11else
12 # ls -l ${SSH_AUTH_SOCK}
13 gdb ${SSHAGENT} ${SSH_AGENT_PID} > ${OBJ}/gdb.out 2>&1 << EOF
14 quit
15EOF
16 if [ $? -ne 0 ]; then
17 fail "gdb failed: exit code $?"
18 fi
19 grep -q 'ptrace: Operation not permitted.' ${OBJ}/gdb.out
20 r=$?
21 rm -f ${OBJ}/gdb.out
22 if [ $r -ne 0 ]; then
23 fail "ptrace succeeded?: exit code $r"
24 fi
25
26 trace "kill agent"
27 ${SSHAGENT} -k > /dev/null
28fi
diff --git a/regress/agent-timeout.sh b/regress/agent-timeout.sh
new file mode 100644
index 000000000..28b1be028
--- /dev/null
+++ b/regress/agent-timeout.sh
@@ -0,0 +1,36 @@
1# $OpenBSD: agent-timeout.sh,v 1.1 2002/06/06 00:38:40 markus Exp $
2# Placed in the Public Domain.
3
4tid="agent timeout test"
5
6TIMEOUT=5
7
8trace "start agent"
9eval `${SSHAGENT} -s` > /dev/null
10r=$?
11if [ $r -ne 0 ]; then
12 fail "could not start ssh-agent: exit code $r"
13else
14 trace "add keys with timeout"
15 for t in rsa rsa1; do
16 ${SSHADD} -t ${TIMEOUT} $OBJ/$t > /dev/null 2>&1
17 if [ $? -ne 0 ]; then
18 fail "ssh-add did succeed exit code 0"
19 fi
20 done
21 n=`${SSHADD} -l 2> /dev/null | wc -l`
22 trace "agent has $n keys"
23 if [ $n -ne 2 ]; then
24 fail "ssh-add -l did not return 2 keys: $n"
25 fi
26 trace "sleeping 2*${TIMEOUT} seconds"
27 sleep ${TIMEOUT}
28 sleep ${TIMEOUT}
29 ${SSHADD} -l 2> /dev/null | grep -q 'The agent has no identities.'
30 if [ $? -ne 0 ]; then
31 fail "ssh-add -l still returns keys after timeout"
32 fi
33
34 trace "kill agent"
35 ${SSHAGENT} -k > /dev/null
36fi
diff --git a/regress/keygen-change.sh b/regress/keygen-change.sh
new file mode 100644
index 000000000..08d359023
--- /dev/null
+++ b/regress/keygen-change.sh
@@ -0,0 +1,23 @@
1# $OpenBSD: keygen-change.sh,v 1.2 2002/07/16 09:15:55 markus Exp $
2# Placed in the Public Domain.
3
4tid="change passphrase for key"
5
6S1="secret1"
7S2="2secret"
8
9for t in rsa dsa rsa1; do
10 # generate user key for agent
11 trace "generating $t key"
12 rm -f $OBJ/$t-key
13 ${SSHKEYGEN} -q -N ${S1} -t $t -f $OBJ/$t-key
14 if [ $? -eq 0 ]; then
15 ${SSHKEYGEN} -p -P ${S1} -N ${S2} -f $OBJ/$t-key > /dev/null
16 if [ $? -ne 0 ]; then
17 fail "ssh-keygen -p failed for $t-key"
18 fi
19 else
20 fail "ssh-keygen for $t-key failed"
21 fi
22 rm -f $OBJ/$t-key $OBJ/$t-key.pub
23done
diff --git a/regress/proxy-connect.sh b/regress/proxy-connect.sh
index bf1940fcc..6a36b2513 100644
--- a/regress/proxy-connect.sh
+++ b/regress/proxy-connect.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: proxy-connect.sh,v 1.4 2002/03/15 13:08:56 markus Exp $ 1# $OpenBSD: proxy-connect.sh,v 1.5 2002/12/09 15:28:46 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="proxy connect" 4tid="proxy connect"
@@ -8,4 +8,11 @@ for p in 1 2; do
8 if [ $? -ne 0 ]; then 8 if [ $? -ne 0 ]; then
9 fail "ssh proxyconnect protocol $p failed" 9 fail "ssh proxyconnect protocol $p failed"
10 fi 10 fi
11 SSH_CONNECTION=`${SSH} -$p -F $OBJ/ssh_proxy 999.999.999.999 'echo $SSH_CONNECTION'`
12 if [ $? -ne 0 ]; then
13 fail "ssh proxyconnect protocol $p failed"
14 fi
15 if [ "$SSH_CONNECTION" != "UNKNOWN 65535 UNKNOWN 65535" ]; then
16 fail "bad SSH_CONNECTION"
17 fi
11done 18done
diff --git a/regress/sftp-batch.sh b/regress/sftp-batch.sh
new file mode 100644
index 000000000..cffacb6df
--- /dev/null
+++ b/regress/sftp-batch.sh
@@ -0,0 +1,57 @@
1# $OpenBSD: sftp-batch.sh,v 1.2 2003/01/10 07:52:41 djm Exp $
2# Placed in the Public Domain.
3
4tid="sftp batchfile"
5
6DATA=/bin/ls
7COPY=${OBJ}/copy
8BATCH=${OBJ}/sftp-batch
9
10rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
11
12cat << EOF > ${BATCH}.pass.1
13 get $DATA $COPY
14 put ${COPY} ${COPY}.1
15 rm ${COPY}
16 -put ${COPY} ${COPY}.2
17EOF
18
19cat << EOF > ${BATCH}.pass.2
20 # This is a comment
21
22 # That was a blank line
23 ls
24EOF
25
26cat << EOF > ${BATCH}.fail.1
27 get $DATA $COPY
28 put ${COPY} ${COPY}.3
29 rm ${COPY}.*
30 # The next command should fail
31 put ${COPY}.3 ${COPY}.4
32EOF
33
34cat << EOF > ${BATCH}.fail.2
35 # The next command should fail
36 jajajajaja
37EOF
38
39verbose "$tid: good commands"
40${SFTP} -b ${BATCH}.pass.1 -P ${SFTPSERVER} >/dev/null 2>&1 \
41 || fail "good commands failed"
42
43verbose "$tid: bad commands"
44${SFTP} -b ${BATCH}.fail.1 -P ${SFTPSERVER} >/dev/null 2>&1 \
45 && fail "bad commands succeeded"
46
47verbose "$tid: comments and blanks"
48${SFTP} -b ${BATCH}.pass.2 -P ${SFTPSERVER} >/dev/null 2>&1 \
49 || fail "comments & blanks failed"
50
51verbose "$tid: junk command"
52${SFTP} -b ${BATCH}.fail.2 -P ${SFTPSERVER} >/dev/null 2>&1 \
53 && fail "junk command succeeded"
54
55rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
56
57
diff --git a/regress/sftp-cmds.sh b/regress/sftp-cmds.sh
new file mode 100644
index 000000000..462c6802f
--- /dev/null
+++ b/regress/sftp-cmds.sh
@@ -0,0 +1,100 @@
1# $OpenBSD: sftp-cmds.sh,v 1.2 2003/01/10 07:52:41 djm Exp $
2# Placed in the Public Domain.
3
4# XXX - TODO:
5# - globbed operations
6# - chmod / chown / chgrp
7# - -p flag for get & put
8
9tid="sftp commands"
10
11DATA=/bin/ls
12COPY=${OBJ}/copy
13
14rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
15
16verbose "$tid: lls"
17echo "lls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
18 || fail "lls failed"
19# XXX always successful
20
21verbose "$tid: ls"
22echo "ls ${OBJ}" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
23 || fail "ls failed"
24# XXX always successful
25
26verbose "$tid: shell"
27echo "!echo hi there" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
28 || fail "shell failed"
29# XXX always successful
30
31verbose "$tid: pwd"
32echo "pwd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
33 || fail "pwd failed"
34# XXX always successful
35
36verbose "$tid: lpwd"
37echo "lpwd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
38 || fail "lpwd failed"
39# XXX always successful
40
41verbose "$tid: quit"
42echo "quit" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
43 || fail "quit failed"
44# XXX always successful
45
46verbose "$tid: help"
47echo "help" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
48 || fail "help failed"
49# XXX always successful
50
51rm -f ${COPY}
52verbose "$tid: get"
53echo "get $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
54 || fail "get failed"
55cmp $DATA ${COPY} || fail "corrupted copy after get"
56
57rm -f ${COPY}
58verbose "$tid: put"
59echo "put $DATA $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
60 || fail "put failed"
61cmp $DATA ${COPY} || fail "corrupted copy after put"
62
63verbose "$tid: rename"
64echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
65 || fail "rename failed"
66test -f ${COPY}.1 || fail "missing file after rename"
67cmp $DATA ${COPY}.1 >/dev/null 2>&1 || fail "corrupted copy after rename"
68
69verbose "$tid: ln"
70echo "ln ${COPY}.1 ${COPY}.2" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 || fail "ln failed"
71test -L ${COPY}.2 || fail "missing file after ln"
72
73verbose "$tid: mkdir"
74echo "mkdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
75 || fail "mkdir failed"
76test -d ${COPY}.dd || fail "missing directory after mkdir"
77
78# XXX do more here
79verbose "$tid: chdir"
80echo "chdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
81 || fail "chdir failed"
82
83verbose "$tid: rmdir"
84echo "rmdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
85 || fail "rmdir failed"
86test -d ${COPY}.1 && fail "present directory after rmdir"
87
88verbose "$tid: lmkdir"
89echo "lmkdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
90 || fail "lmkdir failed"
91test -d ${COPY}.dd || fail "missing directory after lmkdir"
92
93# XXX do more here
94verbose "$tid: lchdir"
95echo "lchdir ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
96 || fail "lchdir failed"
97
98rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
99
100
diff --git a/regress/ssh-com-client.sh b/regress/ssh-com-client.sh
index 84b0b471e..015ebbb8c 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.3 2002/04/10 08:45:30 markus Exp $ 1# $OpenBSD: ssh-com-client.sh,v 1.4 2002/07/16 08:58:16 markus 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"
@@ -15,7 +15,9 @@ VERSIONS="
15 2.3.1 15 2.3.1
16 2.4.0 16 2.4.0
17 3.0.0 17 3.0.0
18 3.1.0" 18 3.1.0
19 3.2.0
20 3.3.0"
19 21
20# 2.0.10 2.0.12 2.0.13 don't like the test setup 22# 2.0.10 2.0.12 2.0.13 don't like the test setup
21 23
diff --git a/regress/ssh-com-keygen.sh b/regress/ssh-com-keygen.sh
index 90ba2fcdc..e93dc78c9 100644
--- a/regress/ssh-com-keygen.sh
+++ b/regress/ssh-com-keygen.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: ssh-com-keygen.sh,v 1.1 2002/03/27 22:40:27 markus Exp $ 1# $OpenBSD: ssh-com-keygen.sh,v 1.2 2002/07/16 08:58:16 markus Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="ssh.com key import" 4tid="ssh.com key import"
@@ -18,7 +18,9 @@ VERSIONS="
18 2.3.1 18 2.3.1
19 2.4.0 19 2.4.0
20 3.0.0 20 3.0.0
21 3.1.0" 21 3.1.0
22 3.2.0
23 3.3.0"
22 24
23COMPRV=${OBJ}/comkey 25COMPRV=${OBJ}/comkey
24COMPUB=${COMPRV}.pub 26COMPUB=${COMPRV}.pub
diff --git a/regress/ssh-com-sftp.sh b/regress/ssh-com-sftp.sh
index 231efa132..f08018b84 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.2 2002/04/10 08:45:30 markus Exp $ 1# $OpenBSD: ssh-com-sftp.sh,v 1.3 2002/07/16 08:58:16 markus 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"
@@ -24,7 +24,9 @@ VERSIONS="
24 2.3.1 24 2.3.1
25 2.4.0 25 2.4.0
26 3.0.0 26 3.0.0
27 3.1.0" 27 3.1.0
28 3.2.0
29 3.3.0"
28 30
29# go for it 31# go for it
30for v in ${VERSIONS}; do 32for v in ${VERSIONS}; do
diff --git a/regress/ssh-com.sh b/regress/ssh-com.sh
index 6a199fa65..c2bd15380 100644
--- a/regress/ssh-com.sh
+++ b/regress/ssh-com.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: ssh-com.sh,v 1.3 2002/03/15 13:08:56 markus Exp $ 1# $OpenBSD: ssh-com.sh,v 1.4 2002/07/16 08:58:16 markus 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"
@@ -14,17 +14,19 @@ VERSIONS="
14 2.1.0 14 2.1.0
15 2.2.0 15 2.2.0
16 2.3.0 16 2.3.0
17 2.3.1
18 2.4.0 17 2.4.0
19 3.0.0 18 3.0.0
20 3.1.0" 19 3.1.0
20 3.2.0
21 3.3.0"
21# 2.0.10 does not support UserConfigDirectory 22# 2.0.10 does not support UserConfigDirectory
23# 2.3.1 requires a config in $HOME/.ssh2
22 24
23SRC=`dirname ${SCRIPT}` 25SRC=`dirname ${SCRIPT}`
24 26
25# ssh.com 27# ssh.com
26cat << EOF > $OBJ/sshd2_config 28cat << EOF > $OBJ/sshd2_config
27*: 29#*:
28 # Port and ListenAdress are not used. 30 # Port and ListenAdress are not used.
29 QuietMode yes 31 QuietMode yes
30 Port 4343 32 Port 4343