xref: /freebsd/crypto/openssh/regress/stderr-data.sh (revision 1f4bcc459a76b7aa664f3fd557684cd0ba6da352)
1#	$OpenBSD: stderr-data.sh,v 1.4 2015/03/03 22:35:19 markus Exp $
2#	Placed in the Public Domain.
3
4tid="stderr data transfer"
5
6for n in '' -n; do
7for p in ${SSH_PROTOCOLS}; 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