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