xref: /freebsd/crypto/openssh/regress/stderr-data.sh (revision 57718be8fa0bd5edc11ab9a72e68cc71982939a6)
1#	$OpenBSD: stderr-data.sh,v 1.3 2013/05/17 04:29:14 dtucker Exp $
2#	Placed in the Public Domain.
3
4tid="stderr data transfer"
5
6for n in '' -n; do
7for p in 1 2; do
8	verbose "test $tid: proto $p ($n)"
9	${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \
10		exec sh -c \'"exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \
11		2> ${COPY}
12	r=$?
13	if [ $r -ne 0 ]; then
14		fail "ssh failed with exit code $r"
15	fi
16	cmp ${DATA} ${COPY}	|| fail "stderr corrupt"
17	rm -f ${COPY}
18
19	${SSH} $n -$p -F $OBJ/ssh_proxy otherhost \
20		exec sh -c \'"echo a; exec > /dev/null; sleep 3; cat ${DATA} 1>&2 $s"\' \
21		> /dev/null 2> ${COPY}
22	r=$?
23	if [ $r -ne 0 ]; then
24		fail "ssh failed with exit code $r"
25	fi
26	cmp ${DATA} ${COPY}	|| fail "stderr corrupt"
27	rm -f ${COPY}
28done
29done
30