1255670Sdes#	$OpenBSD: putty-transfer.sh,v 1.3 2013/05/17 04:29:14 dtucker Exp $
2180746Sdes#	Placed in the Public Domain.
3180746Sdes
4180746Sdestid="putty transfer data"
5180746Sdes
6180746Sdesif test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then
7189006Sdes	echo "putty interop tests not enabled"
8189006Sdes	exit 0
9180746Sdesfi
10180746Sdes
11180746Sdes# XXX support protocol 1 too
12180746Sdesfor p in 2; do
13180746Sdes	for c in 0 1 ; do 
14180746Sdes	verbose "$tid: proto $p compression $c"
15180746Sdes		rm -f ${COPY}
16180746Sdes		cp ${OBJ}/.putty/sessions/localhost_proxy \
17180746Sdes		    ${OBJ}/.putty/sessions/compression_$c
18180746Sdes		echo "Compression=$c" >> ${OBJ}/.putty/sessions/kex_$k
19180746Sdes		env HOME=$PWD ${PLINK} -load compression_$c -batch \
20180746Sdes		    -i putty.rsa$p 127.0.0.1 cat ${DATA} > ${COPY}
21180746Sdes		if [ $? -ne 0 ]; then
22180746Sdes			fail "ssh cat $DATA failed"
23180746Sdes		fi
24180746Sdes		cmp ${DATA} ${COPY}		|| fail "corrupted copy"
25180746Sdes	
26180746Sdes		for s in 10 100 1k 32k 64k 128k 256k; do
27180746Sdes			trace "proto $p compression $c dd-size ${s}"
28180746Sdes			rm -f ${COPY}
29180746Sdes			dd if=$DATA obs=${s} 2> /dev/null | \
30180746Sdes				env HOME=$PWD ${PLINK} -load compression_$c \
31180746Sdes				    -batch -i putty.rsa$p 127.0.0.1 \
32180746Sdes				    "cat > ${COPY}"
33180746Sdes			if [ $? -ne 0 ]; then
34180746Sdes				fail "ssh cat $DATA failed"
35180746Sdes			fi
36180746Sdes			cmp $DATA ${COPY}	|| fail "corrupted copy"
37180746Sdes		done
38180746Sdes	done
39180746Sdesdone
40180746Sdesrm -f ${COPY}
41180746Sdes
42