summaryrefslogtreecommitdiff
path: root/regress/key-options.sh
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2018-03-02 02:53:27 +0000
committerDamien Miller <djm@mindrot.org>2018-03-03 14:38:26 +1100
commitdc3e92df17556dc5b0ab19cee8dcb2a6ba348717 (patch)
tree7474da42946c828243167de22e1c48eeb7f81476 /regress/key-options.sh
parent3d1edd1ebbc0aabea8bbe61903060f37137f7c61 (diff)
upstream: fix testing of pty option, include positive test and
testing of restrict keyword OpenBSD-Regress-ID: 4268f27c2706a0a95e725d9518c5bcbec9814c6d
Diffstat (limited to 'regress/key-options.sh')
-rw-r--r--regress/key-options.sh43
1 files changed, 36 insertions, 7 deletions
diff --git a/regress/key-options.sh b/regress/key-options.sh
index 2adee6833..aa5f8bf97 100644
--- a/regress/key-options.sh
+++ b/regress/key-options.sh
@@ -1,4 +1,4 @@
1# $OpenBSD: key-options.sh,v 1.4 2017/04/30 23:34:55 djm Exp $ 1# $OpenBSD: key-options.sh,v 1.5 2018/03/02 02:53:27 djm Exp $
2# Placed in the Public Domain. 2# Placed in the Public Domain.
3 3
4tid="key options" 4tid="key options"
@@ -21,12 +21,41 @@ for c in 'command="echo bar"' 'no-pty,command="echo bar"'; do
21done 21done
22 22
23# Test no-pty 23# Test no-pty
24sed 's/.*/no-pty &/' $origkeys >$authkeys 24expect_pty_succeed() {
25verbose "key option proto no-pty" 25 which=$1
26r=`${SSH} -q -F $OBJ/ssh_proxy somehost tty` 26 opts=$2
27if [ -f "$r" ]; then 27 rm -f $OBJ/data
28 fail "key option failed no-pty (pty $r)" 28 sed "s/.*/$opts &/" $origkeys >$authkeys
29fi 29 verbose "key option pty $which"
30 ${SSH} -ttq -F $OBJ/ssh_proxy somehost "tty > $OBJ/data; exit 0"
31 if [ $? -ne 0 ] ; then
32 fail "key option failed $which"
33 else
34 r=`cat $OBJ/data`
35 if [ ! -e "$r" ]; then
36 fail "key option failed $which (pty $r)"
37 fi
38 fi
39}
40expect_pty_fail() {
41 which=$1
42 opts=$2
43 rm -f $OBJ/data
44 sed "s/.*/$opts &/" $origkeys >$authkeys
45 verbose "key option pty $which"
46 ${SSH} -ttq -F $OBJ/ssh_proxy somehost "tty > $OBJ/data; exit 0"
47 if [ $? -eq 0 ]; then
48 r=`cat $OBJ/data`
49 if [ -e "$r" ]; then
50 fail "key option failed $which (pty $r)"
51 fi
52 fi
53}
54# First ensure that we can allocate a pty by default.
55expect_pty_succeed "default" ""
56expect_pty_fail "no-pty" "no-pty"
57expect_pty_fail "restrict" "restrict"
58expect_pty_succeed "restrict,pty" "restrict,pty"
30 59
31# Test environment= 60# Test environment=
32echo 'PermitUserEnvironment yes' >> $OBJ/sshd_proxy 61echo 'PermitUserEnvironment yes' >> $OBJ/sshd_proxy