mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-29 08:44:52 +02:00
upstream: fix testing of pty option, include positive test and
testing of restrict keyword OpenBSD-Regress-ID: 4268f27c2706a0a95e725d9518c5bcbec9814c6d
This commit is contained in:
parent
3d1edd1ebb
commit
dc3e92df17
@ -1,4 +1,4 @@
|
|||||||
# $OpenBSD: key-options.sh,v 1.4 2017/04/30 23:34:55 djm Exp $
|
# $OpenBSD: key-options.sh,v 1.5 2018/03/02 02:53:27 djm Exp $
|
||||||
# Placed in the Public Domain.
|
# Placed in the Public Domain.
|
||||||
|
|
||||||
tid="key options"
|
tid="key options"
|
||||||
@ -21,12 +21,41 @@ for c in 'command="echo bar"' 'no-pty,command="echo bar"'; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Test no-pty
|
# Test no-pty
|
||||||
sed 's/.*/no-pty &/' $origkeys >$authkeys
|
expect_pty_succeed() {
|
||||||
verbose "key option proto no-pty"
|
which=$1
|
||||||
r=`${SSH} -q -F $OBJ/ssh_proxy somehost tty`
|
opts=$2
|
||||||
if [ -f "$r" ]; then
|
rm -f $OBJ/data
|
||||||
fail "key option failed no-pty (pty $r)"
|
sed "s/.*/$opts &/" $origkeys >$authkeys
|
||||||
fi
|
verbose "key option pty $which"
|
||||||
|
${SSH} -ttq -F $OBJ/ssh_proxy somehost "tty > $OBJ/data; exit 0"
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
fail "key option failed $which"
|
||||||
|
else
|
||||||
|
r=`cat $OBJ/data`
|
||||||
|
if [ ! -e "$r" ]; then
|
||||||
|
fail "key option failed $which (pty $r)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
expect_pty_fail() {
|
||||||
|
which=$1
|
||||||
|
opts=$2
|
||||||
|
rm -f $OBJ/data
|
||||||
|
sed "s/.*/$opts &/" $origkeys >$authkeys
|
||||||
|
verbose "key option pty $which"
|
||||||
|
${SSH} -ttq -F $OBJ/ssh_proxy somehost "tty > $OBJ/data; exit 0"
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
r=`cat $OBJ/data`
|
||||||
|
if [ -e "$r" ]; then
|
||||||
|
fail "key option failed $which (pty $r)"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
# First ensure that we can allocate a pty by default.
|
||||||
|
expect_pty_succeed "default" ""
|
||||||
|
expect_pty_fail "no-pty" "no-pty"
|
||||||
|
expect_pty_fail "restrict" "restrict"
|
||||||
|
expect_pty_succeed "restrict,pty" "restrict,pty"
|
||||||
|
|
||||||
# Test environment=
|
# Test environment=
|
||||||
echo 'PermitUserEnvironment yes' >> $OBJ/sshd_proxy
|
echo 'PermitUserEnvironment yes' >> $OBJ/sshd_proxy
|
||||||
|
Loading…
x
Reference in New Issue
Block a user