stderr-after-eof.sh revision 98937
1#	$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
10MD5=md5sum
11
12# setup data
13rm -f ${DATA} ${COPY}
14cp /dev/null ${DATA}
15for i in 1 2 3 4 5 6; do
16	(date;echo $i) | $MD5 >> ${DATA}
17done
18
19${SSH} -2 -F $OBJ/ssh_proxy otherhost \
20	exec sh -c \'"exec > /dev/null; sleep 2; cat ${DATA} 1>&2 $s"\' \
21	2> ${COPY}
22r=$?
23if [ $r -ne 0 ]; then
24	fail "ssh failed with exit code $r"
25fi
26egrep 'Disconnecting: Received extended_data after EOF' ${COPY} &&
27	fail "ext data received after eof"
28cmp ${DATA} ${COPY}	|| fail "stderr corrupt"
29
30rm -f ${DATA} ${COPY}
31