1294332Sdes#	$OpenBSD: stderr-data.sh,v 1.4 2015/03/03 22:35:19 markus Exp $
298937Sdes#	Placed in the Public Domain.
398937Sdes
498937Sdestid="stderr data transfer"
598937Sdes
698937Sdesfor n in '' -n; do
7294332Sdesfor p in ${SSH_PROTOCOLS}; do
898937Sdes	verbose "test $tid: proto $p ($n)"
998937Sdes	${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \
1098937Sdes		exec sh -c \'"exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \
1198937Sdes		2> ${COPY}
1298937Sdes	r=$?
1398937Sdes	if [ $r -ne 0 ]; then
1498937Sdes		fail "ssh failed with exit code $r"
1598937Sdes	fi
1698937Sdes	cmp ${DATA} ${COPY}	|| fail "stderr corrupt"
1798937Sdes	rm -f ${COPY}
1898937Sdes
1998937Sdes	${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \
2098937Sdes		exec sh -c \'"echo a; exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \
2198937Sdes		> /dev/null 2> ${COPY}
2298937Sdes	r=$?
2398937Sdes	if [ $r -ne 0 ]; then
2498937Sdes		fail "ssh failed with exit code $r"
2598937Sdes	fi
2698937Sdes	cmp ${DATA} ${COPY}	|| fail "stderr corrupt"
2798937Sdes	rm -f ${COPY}
2898937Sdesdone
2998937Sdesdone
30