blob: 05a5ea56d0bc1e00817dc4fd7b04b5208b87def5 [file] [log] [blame]
Damien Miller38cd4352002-05-01 13:17:33 +10001# $OpenBSD: stderr-after-eof.sh,v 1.1 2002/03/23 16:38:09 markus Exp $
2# Placed in the Public Domain.
3
4tid="stderr data after eof"
5
6DATA=/etc/motd
7DATA=${OBJ}/data
8COPY=${OBJ}/copy
9
Tim Rice23ee3592003-09-11 22:32:17 -070010if have_prog md5sum; then
Darren Tuckerc376a882003-09-04 14:32:02 +100011 CHECKSUM=md5sum
Tim Rice23ee3592003-09-11 22:32:17 -070012elif have_prog openssl; then
Darren Tuckerc376a882003-09-04 14:32:02 +100013 CHECKSUM="openssl md5"
Tim Rice23ee3592003-09-11 22:32:17 -070014elif have_prog cksum; then
Darren Tuckerc376a882003-09-04 14:32:02 +100015 CHECKSUM=cksum
Tim Rice23ee3592003-09-11 22:32:17 -070016elif have_prog sum; then
Darren Tuckerc376a882003-09-04 14:32:02 +100017 CHECKSUM=sum
18else
19 fatal "No checksum program available, aborting $tid test"
20fi
Damien Miller38cd4352002-05-01 13:17:33 +100021
22# setup data
23rm -f ${DATA} ${COPY}
24cp /dev/null ${DATA}
25for i in 1 2 3 4 5 6; do
Darren Tuckerc376a882003-09-04 14:32:02 +100026 (date;echo $i) | $CHECKSUM >> ${DATA}
Damien Miller38cd4352002-05-01 13:17:33 +100027done
28
29${SSH} -2 -F $OBJ/ssh_proxy otherhost \
30 exec sh -c \'"exec > /dev/null; sleep 2; cat ${DATA} 1>&2 $s"\' \
31 2> ${COPY}
32r=$?
33if [ $r -ne 0 ]; then
34 fail "ssh failed with exit code $r"
35fi
36egrep 'Disconnecting: Received extended_data after EOF' ${COPY} &&
37 fail "ext data received after eof"
38cmp ${DATA} ${COPY} || fail "stderr corrupt"
39
40rm -f ${DATA} ${COPY}