- (dtucker) [reconfigure.sh rekey.sh sftp-badcmds.sh]

Import new regression tests from OpenBSD
This commit is contained in:
Darren Tucker 2003-06-18 22:18:57 +10:00
parent 0275b52387
commit fc8a7ea202
4 changed files with 140 additions and 1 deletions

View File

@ -23,6 +23,8 @@
- markus@cvs.openbsd.org 2003/06/17 18:14:23 - markus@cvs.openbsd.org 2003/06/17 18:14:23
[cipher-ctr.c] [cipher-ctr.c]
use license from /usr/share/misc/license.template for new code use license from /usr/share/misc/license.template for new code
- (dtucker) [reconfigure.sh rekey.sh sftp-badcmds.sh]
Import new regression tests from OpenBSD
20030614 20030614
- (djm) Update license on fake-rfc2553.[ch]; ok itojun@ - (djm) Update license on fake-rfc2553.[ch]; ok itojun@
@ -538,4 +540,4 @@
- Fix sshd BindAddress and -b options for systems using fake-getaddrinfo. - Fix sshd BindAddress and -b options for systems using fake-getaddrinfo.
Report from murple@murple.net, diagnosis from dtucker@zip.com.au Report from murple@murple.net, diagnosis from dtucker@zip.com.au
$Id: ChangeLog,v 1.2808 2003/06/18 10:29:35 djm Exp $ $Id: ChangeLog,v 1.2809 2003/06/18 12:18:57 dtucker Exp $

28
regress/reconfigure.sh Normal file
View File

@ -0,0 +1,28 @@
# $OpenBSD: reconfigure.sh,v 1.1 2003/06/12 15:43:32 markus Exp $
# Placed in the Public Domain.
tid="simple connect after reconfigure"
# we need the full path to sshd for -HUP
SSHD=/usr/sbin/sshd
start_sshd
kill -HUP `cat $PIDFILE`
sleep 1
trace "wait for sshd to restart"
i=0;
while [ ! -f $PIDFILE -a $i -lt 10 ]; do
i=`expr $i + 1`
sleep $i
done
test -f $PIDFILE || fatal "sshd did not restart"
for p in 1 2; do
${SSH} -o "Protocol=$p" -F $OBJ/ssh_config somehost true
if [ $? -ne 0 ]; then
fail "ssh connect with protocol $p failed after reconfigure"
fi
done

31
regress/rekey.sh Normal file
View File

@ -0,0 +1,31 @@
# $OpenBSD: rekey.sh,v 1.1 2003/03/28 13:58:28 markus Exp $
# Placed in the Public Domain.
tid="rekey during transfer data"
DATA=${OBJ}/data
COPY=${OBJ}/copy
LOG=${OBJ}/log
rm -f ${COPY} ${LOG} ${DATA}
dd if=/dev/zero of=${DATA} bs=1k count=512 > /dev/null 2>&1
for s in 16 1k 128k 256k; do
trace "rekeylimit ${s}"
rm -f ${COPY}
cat $DATA | \
${SSH} -oCompression=no -oRekeyLimit=$s \
-v -F $OBJ/ssh_proxy somehost "cat > ${COPY}" \
2> ${LOG}
if [ $? -ne 0 ]; then
fail "ssh failed"
fi
cmp $DATA ${COPY} || fail "corrupted copy"
n=`grep 'NEWKEYS sent' ${LOG} | wc -l`
n=`expr $n - 1`
trace "$n rekeying(s)"
if [ $n -lt 1 ]; then
fail "no rekeying occured"
fi
done
rm -f ${COPY} ${LOG} ${DATA}

78
regress/sftp-badcmds.sh Normal file
View File

@ -0,0 +1,78 @@
# $OpenBSD: sftp-badcmds.sh,v 1.2 2003/05/15 04:07:12 mouring Exp $
# Placed in the Public Domain.
tid="sftp invalid commands"
DATA=/bin/ls
DATA2=/bin/cat
NONEXIST=/NONEXIST.$$
COPY=${OBJ}/copy
GLOBFILES=`(cd /bin;echo l*)`
rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*
rm -f ${COPY}
verbose "$tid: get nonexistent"
echo "get $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|| fail "get nonexistent failed"
test -f ${COPY} && fail "existing copy after get nonexistent"
rm -f ${COPY}.dd/*
verbose "$tid: glob get to nonexistent directory"
echo "get /bin/l* $NONEXIST" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|| fail "get nonexistent failed"
for x in $GLOBFILES; do
test -f ${COPY}.dd/$x && fail "existing copy after get nonexistent"
done
rm -f ${COPY}
verbose "$tid: put nonexistent"
echo "put $NONEXIST $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|| fail "put nonexistent failed"
test -f ${COPY} && fail "existing copy after put nonexistent"
rm -f ${COPY}.dd/*
verbose "$tid: glob put to nonexistent directory"
echo "put /bin/l* ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|| fail "put nonexistent failed"
for x in $GLOBFILES; do
test -f ${COPY}.dd/$x && fail "existing copy after nonexistent"
done
rm -f ${COPY}
verbose "$tid: rename nonexistent"
echo "rename $NONEXIST ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|| fail "rename nonexist failed"
test -f ${COPY}.1 && fail "file exists after rename nonexistent"
rm -f ${COPY} ${COPY}.1
cp $DATA $COPY
cp $DATA2 ${COPY}.1
verbose "$tid: rename target exists"
echo "rename $COPY ${COPY}.1" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|| fail "rename target exists failed"
test -f ${COPY} || fail "oldname missing after rename target exists"
test -f ${COPY}.1 || fail "newname missing after rename target exists"
cmp $DATA ${COPY} >/dev/null 2>&1 || fail "corrupted oldname after rename target exists"
cmp $DATA2 ${COPY}.1 >/dev/null 2>&1 || fail "corrupted newname after rename target exists"
rm -rf ${COPY} ${COPY}.dd
cp $DATA $COPY
mkdir ${COPY}.dd
verbose "$tid: rename target exists (directory)"
echo "rename $COPY ${COPY}.dd" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1 \
|| fail "rename target exists (directory) failed"
test -f ${COPY} || fail "oldname missing after rename target exists (directory)"
test -d ${COPY}.dd || fail "newname missing after rename target exists (directory)"
cmp $DATA ${COPY} >/dev/null 2>&1 || fail "corrupted oldname after rename target exists (directory)"
rm -f ${COPY}.dd/*
rm -rf ${COPY}
cp ${DATA2} ${COPY}
verbose "$tid: glob put files to local file"
echo "put /bin/l* $COPY" | ${SFTP} -P ${SFTPSERVER} >/dev/null 2>&1
cmp ${DATA2} ${COPY} || fail "put successed when it should have failed"
rm -rf ${COPY} ${COPY}.1 ${COPY}.2 ${COPY}.dd ${BATCH}.*