Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 1 | # $OpenBSD: stderr-after-eof.sh,v 1.1 2002/03/23 16:38:09 markus Exp $ |
| 2 | # Placed in the Public Domain. |
| 3 | |
| 4 | tid="stderr data after eof" |
| 5 | |
| 6 | DATA=/etc/motd |
| 7 | DATA=${OBJ}/data |
| 8 | COPY=${OBJ}/copy |
| 9 | |
Tim Rice | 23ee359 | 2003-09-11 22:32:17 -0700 | [diff] [blame] | 10 | if have_prog md5sum; then |
Darren Tucker | c376a88 | 2003-09-04 14:32:02 +1000 | [diff] [blame] | 11 | CHECKSUM=md5sum |
Tim Rice | 23ee359 | 2003-09-11 22:32:17 -0700 | [diff] [blame] | 12 | elif have_prog openssl; then |
Darren Tucker | c376a88 | 2003-09-04 14:32:02 +1000 | [diff] [blame] | 13 | CHECKSUM="openssl md5" |
Tim Rice | 23ee359 | 2003-09-11 22:32:17 -0700 | [diff] [blame] | 14 | elif have_prog cksum; then |
Darren Tucker | c376a88 | 2003-09-04 14:32:02 +1000 | [diff] [blame] | 15 | CHECKSUM=cksum |
Tim Rice | 23ee359 | 2003-09-11 22:32:17 -0700 | [diff] [blame] | 16 | elif have_prog sum; then |
Darren Tucker | c376a88 | 2003-09-04 14:32:02 +1000 | [diff] [blame] | 17 | CHECKSUM=sum |
| 18 | else |
| 19 | fatal "No checksum program available, aborting $tid test" |
| 20 | fi |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 21 | |
| 22 | # setup data |
| 23 | rm -f ${DATA} ${COPY} |
| 24 | cp /dev/null ${DATA} |
| 25 | for i in 1 2 3 4 5 6; do |
Darren Tucker | c376a88 | 2003-09-04 14:32:02 +1000 | [diff] [blame] | 26 | (date;echo $i) | $CHECKSUM >> ${DATA} |
Damien Miller | 38cd435 | 2002-05-01 13:17:33 +1000 | [diff] [blame] | 27 | done |
| 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} |
| 32 | r=$? |
| 33 | if [ $r -ne 0 ]; then |
| 34 | fail "ssh failed with exit code $r" |
| 35 | fi |
| 36 | egrep 'Disconnecting: Received extended_data after EOF' ${COPY} && |
| 37 | fail "ext data received after eof" |
| 38 | cmp ${DATA} ${COPY} || fail "stderr corrupt" |
| 39 | |
| 40 | rm -f ${DATA} ${COPY} |