1#	$OpenBSD: putty-transfer.sh,v 1.3 2013/05/17 04:29:14 dtucker Exp $
2#	Placed in the Public Domain.
3
4tid="putty transfer data"
5
6if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then
7	fatal "putty interop tests not enabled"
8fi
9
10# XXX support protocol 1 too
11for p in 2; do
12	for c in 0 1 ; do
13	verbose "$tid: proto $p compression $c"
14		rm -f ${COPY}
15		cp ${OBJ}/.putty/sessions/localhost_proxy \
16		    ${OBJ}/.putty/sessions/compression_$c
17		echo "Compression=$c" >> ${OBJ}/.putty/sessions/kex_$k
18		env HOME=$PWD ${PLINK} -load compression_$c -batch \
19		    -i putty.rsa$p 127.0.0.1 cat ${DATA} > ${COPY}
20		if [ $? -ne 0 ]; then
21			fail "ssh cat $DATA failed"
22		fi
23		cmp ${DATA} ${COPY}		|| fail "corrupted copy"
24
25		for s in 10 100 1k 32k 64k 128k 256k; do
26			trace "proto $p compression $c dd-size ${s}"
27			rm -f ${COPY}
28			dd if=$DATA obs=${s} 2> /dev/null | \
29				env HOME=$PWD ${PLINK} -load compression_$c \
30				    -batch -i putty.rsa$p 127.0.0.1 \
31				    "cat > ${COPY}"
32			if [ $? -ne 0 ]; then
33				fail "ssh cat $DATA failed"
34			fi
35			cmp $DATA ${COPY}	|| fail "corrupted copy"
36		done
37	done
38done
39rm -f ${COPY}
40
41