diff options
author | djm@openbsd.org <djm@openbsd.org> | 2018-03-02 02:53:27 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2018-03-03 14:38:26 +1100 |
commit | dc3e92df17556dc5b0ab19cee8dcb2a6ba348717 (patch) | |
tree | 7474da42946c828243167de22e1c48eeb7f81476 /regress | |
parent | 3d1edd1ebbc0aabea8bbe61903060f37137f7c61 (diff) |
upstream: fix testing of pty option, include positive test and
testing of restrict keyword
OpenBSD-Regress-ID: 4268f27c2706a0a95e725d9518c5bcbec9814c6d
Diffstat (limited to 'regress')
-rw-r--r-- | regress/key-options.sh | 43 |
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 | ||
4 | tid="key options" | 4 | tid="key options" |
@@ -21,12 +21,41 @@ for c in 'command="echo bar"' 'no-pty,command="echo bar"'; do | |||
21 | done | 21 | done |
22 | 22 | ||
23 | # Test no-pty | 23 | # Test no-pty |
24 | sed 's/.*/no-pty &/' $origkeys >$authkeys | 24 | expect_pty_succeed() { |
25 | verbose "key option proto no-pty" | 25 | which=$1 |
26 | r=`${SSH} -q -F $OBJ/ssh_proxy somehost tty` | 26 | opts=$2 |
27 | if [ -f "$r" ]; then | 27 | rm -f $OBJ/data |
28 | fail "key option failed no-pty (pty $r)" | 28 | sed "s/.*/$opts &/" $origkeys >$authkeys |
29 | fi | 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 | } | ||
40 | expect_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. | ||
55 | expect_pty_succeed "default" "" | ||
56 | expect_pty_fail "no-pty" "no-pty" | ||
57 | expect_pty_fail "restrict" "restrict" | ||
58 | expect_pty_succeed "restrict,pty" "restrict,pty" | ||
30 | 59 | ||
31 | # Test environment= | 60 | # Test environment= |
32 | echo 'PermitUserEnvironment yes' >> $OBJ/sshd_proxy | 61 | echo 'PermitUserEnvironment yes' >> $OBJ/sshd_proxy |