diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 07:43:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 07:43:00 +0000 |
commit | f74e883352a52dd3ed454627dc159aa65f98d7f3 (patch) | |
tree | ef77b7637e7135f0f61cad9ae9923215ed60066b /regress/test-exec.sh | |
parent | Adding debian version 1:9.7p1-7. (diff) | |
download | openssh-f74e883352a52dd3ed454627dc159aa65f98d7f3.tar.xz openssh-f74e883352a52dd3ed454627dc159aa65f98d7f3.zip |
Merging upstream version 1:9.8p1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'regress/test-exec.sh')
-rw-r--r-- | regress/test-exec.sh | 96 |
1 files changed, 61 insertions, 35 deletions
diff --git a/regress/test-exec.sh b/regress/test-exec.sh index ad62794..7afc280 100644 --- a/regress/test-exec.sh +++ b/regress/test-exec.sh @@ -1,4 +1,4 @@ -# $OpenBSD: test-exec.sh,v 1.108 2024/03/08 11:34:10 dtucker Exp $ +# $OpenBSD: test-exec.sh,v 1.119 2024/06/20 08:18:34 dtucker Exp $ # Placed in the Public Domain. #SUDO=sudo @@ -90,6 +90,7 @@ SSHKEYGEN=ssh-keygen SSHKEYSCAN=ssh-keyscan SFTP=sftp SFTPSERVER=/usr/libexec/openssh/sftp-server +SSHD_SESSION=/usr/libexec/sshd-session SCP=scp # Set by make_tmpdir() on demand (below). @@ -115,6 +116,9 @@ NC=$OBJ/netcat if [ "x$TEST_SSH_SSH" != "x" ]; then SSH="${TEST_SSH_SSH}" fi +if [ "x$TEST_SSH_SSHD_SESSION" != "x" ]; then + SSHD_SESSION="${TEST_SSH_SSHD_SESSION}" +fi if [ "x$TEST_SSH_SSHD" != "x" ]; then SSHD="${TEST_SSH_SSHD}" fi @@ -348,7 +352,7 @@ ssh_logfile () # [kbytes] to ensure the file is at least that large. DATANAME=data DATA=$OBJ/${DATANAME} -cat ${SSHAGENT_BIN} >${DATA} +cat ${SSH_BIN} >${DATA} chmod u+w ${DATA} COPY=$OBJ/copy rm -f ${COPY} @@ -356,7 +360,7 @@ rm -f ${COPY} increase_datafile_size() { while [ `du -k ${DATA} | cut -f1` -lt $1 ]; do - cat ${SSHAGENT_BIN} >>${DATA} + cat ${SSH_BIN} >>${DATA} done } @@ -392,6 +396,7 @@ have_prog() jot() { awk "BEGIN { for (i = $2; i < $2 + $1; i++) { printf \"%d\n\", i } exit }" } + if [ ! -x "`which rev`" ]; then rev() { @@ -399,6 +404,13 @@ rev() } fi +if [ -x "/usr/xpg4/bin/id" ]; then +id() +{ + /usr/xpg4/bin/id $@ +} +fi + # Check whether preprocessor symbols are defined in config.h. config_defined () { @@ -444,33 +456,32 @@ make_tmpdir () stop_sshd () { - if [ -f $PIDFILE ]; then - pid=`$SUDO cat $PIDFILE` - if [ "X$pid" = "X" ]; then - echo no sshd running + [ -z $PIDFILE ] && return + [ -f $PIDFILE ] || return + pid=`$SUDO cat $PIDFILE` + if [ "X$pid" = "X" ]; then + echo "no sshd running" 1>&2 + return + elif [ $pid -lt 2 ]; then + echo "bad pid for sshd: $pid" 1>&2 + return + fi + $SUDO kill $pid + trace "wait for sshd to exit" + i=0; + while [ -f $PIDFILE -a $i -lt 5 ]; do + i=`expr $i + 1` + sleep $i + done + if test -f $PIDFILE; then + if $SUDO kill -0 $pid; then + echo "sshd didn't exit port $PORT pid $pid" 1>&2 else - if [ $pid -lt 2 ]; then - echo bad pid for sshd: $pid - else - $SUDO kill $pid - trace "wait for sshd to exit" - i=0; - while [ -f $PIDFILE -a $i -lt 5 ]; do - i=`expr $i + 1` - sleep $i - done - if test -f $PIDFILE; then - if $SUDO kill -0 $pid; then - echo "sshd didn't exit " \ - "port $PORT pid $pid" - else - echo "sshd died without cleanup" - fi - exit 1 - fi - fi + echo "sshd died without cleanup" 1>&2 fi + exit 1 fi + PIDFILE="" } # helper @@ -609,6 +620,8 @@ cat << EOF > $OBJ/sshd_config AcceptEnv _XXX_TEST_* AcceptEnv _XXX_TEST Subsystem sftp $SFTPSERVER + SshdSessionPath $SSHD_SESSION + PerSourcePenalties no EOF # This may be necessary if /usr/src and/or /usr/obj are group-writable, @@ -802,17 +815,18 @@ puttysetup() { echo "ProxyLocalhost=1" >> ${OBJ}/.putty/sessions/localhost_proxy PUTTYVER="`${PLINK} --version | awk '/plink: Release/{print $3}'`" + PUTTYMAJORVER="`echo ${PUTTYVER} | cut -f1 -d.`" PUTTYMINORVER="`echo ${PUTTYVER} | cut -f2 -d.`" - verbose "plink version ${PUTTYVER} minor ${PUTTYMINORVER}" + verbose "plink version ${PUTTYVER} major ${PUTTYMAJORVER} minor ${PUTTYMINORVER}" # Re-enable ssh-rsa on older PuTTY versions since they don't do newer # key types. - if [ "$PUTTYMINORVER" -lt "76" ]; then + if [ "$PUTTYMAJORVER" -eq "0" ] && [ "$PUTTYMINORVER" -lt "76" ]; then echo "HostKeyAlgorithms +ssh-rsa" >> ${OBJ}/sshd_proxy echo "PubkeyAcceptedKeyTypes +ssh-rsa" >> ${OBJ}/sshd_proxy fi - if [ "$PUTTYMINORVER" -le "64" ]; then + if [ "$PUTTYMAJORVER" -eq "0" ] && [ "$PUTTYMINORVER" -le "64" ]; then echo "KexAlgorithms +diffie-hellman-group14-sha1" \ >>${OBJ}/sshd_proxy fi @@ -832,15 +846,25 @@ esac if test "$REGRESS_INTEROP_DROPBEAR" = "yes" ; then trace Create dropbear keys and add to authorized_keys mkdir -p $OBJ/.dropbear - for i in rsa ecdsa ed25519 dss; do + kt="ed25519" + for i in dss rsa ecdsa; do + if $SSH -Q key-plain | grep "$i" >/dev/null; then + kt="$kt $i" + else + rm -f "$OBJ/.dropbear/id_$i" + fi + done + for i in $kt; do if [ ! -f "$OBJ/.dropbear/id_$i" ]; then - ($DROPBEARKEY -t $i -f $OBJ/.dropbear/id_$i - $DROPBEARCONVERT dropbear openssh \ - $OBJ/.dropbear/id_$i $OBJ/.dropbear/ossh.id_$i - ) > /dev/null 2>&1 + verbose Create dropbear key type $i + $DROPBEARKEY -t $i -f $OBJ/.dropbear/id_$i \ + >/dev/null 2>&1 fi + $DROPBEARCONVERT dropbear openssh $OBJ/.dropbear/id_$i \ + $OBJ/.dropbear/ossh.id_$i >/dev/null 2>&1 $SSHKEYGEN -y -f $OBJ/.dropbear/ossh.id_$i \ >>$OBJ/authorized_keys_$USER + rm -f $OBJ/.dropbear/id_$i.pub $OBJ/.dropbear/ossh.id_$i done fi @@ -861,6 +885,7 @@ chmod a+x $OBJ/ssh_proxy.sh start_sshd () { + PIDFILE=$OBJ/pidfile # start sshd logfile="${TEST_SSH_LOGDIR}/sshd.`$OBJ/timestamp`.$$.log" $SUDO ${SSHD} -f $OBJ/sshd_config "$@" -t || fatal "sshd_config broken" @@ -873,6 +898,7 @@ start_sshd () i=`expr $i + 1` sleep $i done + ln -f -s ${logfile} $TEST_SSHD_LOGFILE test -f $PIDFILE || fatal "no sshd running on port $PORT" } |