]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
Actually skip pty tests when needed.
authorDarren Tucker <dtucker@dtucker.net>
Wed, 13 May 2020 05:24:51 +0000 (15:24 +1000)
committerDarren Tucker <dtucker@dtucker.net>
Wed, 13 May 2020 05:24:51 +0000 (15:24 +1000)
regress/key-options.sh

index 112c9bd8ec5cf474f9bb2fc75445a30b980afd73..097f46eba4e4d9b49dd8b3d99a97032032068e85 100644 (file)
@@ -7,6 +7,12 @@ origkeys="$OBJ/authkeys_orig"
 authkeys="$OBJ/authorized_keys_${USER}"
 cp $authkeys $origkeys
 
+# Allocating ptys can require privileges on some platforms.
+skip_pty=""
+if ! config_defined HAVE_OPENPTY && [ "x$SUDO" == "x" ]; then
+       skip_pty="no openpty(3) and SUDO not set"
+fi
+
 # Test command= forced command
 for c in 'command="echo bar"' 'no-pty,command="echo bar"'; do
        sed "s/.*/$c &/" $origkeys >$authkeys
@@ -27,7 +33,7 @@ expect_pty_succeed() {
        rm -f $OBJ/data
        sed "s/.*/$opts &/" $origkeys >$authkeys
        verbose "key option pty $which"
-       config_defined HAVE_OPENPTY || verbose "skipped for no openpty(3)"
+       [ "x$skip_pty" != "x" ] && verbose "skipped because $skip_pty" && return
        ${SSH} -ttq -F $OBJ/ssh_proxy somehost "tty > $OBJ/data; exit 0"
        if [ $? -ne 0 ] ; then
                fail "key option failed $which"
@@ -45,7 +51,7 @@ expect_pty_fail() {
        rm -f $OBJ/data
        sed "s/.*/$opts &/" $origkeys >$authkeys
        verbose "key option pty $which"
-       config_defined HAVE_OPENPTY || verbose "skipped for no openpty(3)"
+       [ "x$skip_pty" != "x" ] && verbose "skipped because $skip_pty" && return
        ${SSH} -ttq -F $OBJ/ssh_proxy somehost "tty > $OBJ/data; exit 0"
        if [ $? -eq 0 ]; then
                r=`cat $OBJ/data`