1#	$OpenBSD: putty-transfer.sh,v 1.7 2020/01/23 11:19:12 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
10if [ "`${SSH} -Q compression`" = "none" ]; then
11	comp="0"
12else
13	comp="0 1"
14fi
15
16for c in $comp; do
17	verbose "$tid: compression $c"
18	rm -f ${COPY}
19	cp ${OBJ}/.putty/sessions/localhost_proxy \
20	    ${OBJ}/.putty/sessions/compression_$c
21	echo "Compression=$c" >> ${OBJ}/.putty/sessions/kex_$k
22	env HOME=$PWD ${PLINK} -load compression_$c -batch \
23	    -i putty.rsa2 cat ${DATA} > ${COPY}
24	if [ $? -ne 0 ]; then
25		fail "ssh cat $DATA failed"
26	fi
27	cmp ${DATA} ${COPY}		|| fail "corrupted copy"
28
29	for s in 10 100 1k 32k 64k 128k 256k; do
30		trace "compression $c dd-size ${s}"
31		rm -f ${COPY}
32		dd if=$DATA obs=${s} 2> /dev/null | \
33			env HOME=$PWD ${PLINK} -load compression_$c \
34			    -batch -i putty.rsa2 \
35			    "cat > ${COPY}"
36		if [ $? -ne 0 ]; then
37			fail "ssh cat $DATA failed"
38		fi
39		cmp $DATA ${COPY}	|| fail "corrupted copy"
40	done
41done
42rm -f ${COPY}
43
44