xref: /freebsd/crypto/openssh/regress/putty-transfer.sh (revision 2dd83b3f0507fc7bc64b908fb88f285a3b9663c8)
1#	$OpenBSD: putty-transfer.sh,v 1.11 2021/09/01 03:16:06 dtucker Exp $
2#	Placed in the Public Domain.
3
4tid="putty transfer data"
5
6if test "x$REGRESS_INTEROP_PUTTY" != "xyes" ; then
7	skip "putty interop tests not enabled"
8fi
9
10# Re-enable ssh-rsa on older PuTTY versions.
11oldver="`${PLINK} --version | awk '/plink: Release/{if ($3<0.76)print "yes"}'`"
12if [ "x$oldver" = "xyes" ]; then
13	echo "HostKeyAlgorithms +ssh-rsa" >> ${OBJ}/sshd_proxy
14	echo "PubkeyAcceptedKeyTypes +ssh-rsa" >> ${OBJ}/sshd_proxy
15fi
16
17if [ "`${SSH} -Q compression`" = "none" ]; then
18	comp="0"
19else
20	comp="0 1"
21fi
22
23for c in $comp; do
24	verbose "$tid: compression $c"
25	rm -f ${COPY}
26	cp ${OBJ}/.putty/sessions/localhost_proxy \
27	    ${OBJ}/.putty/sessions/compression_$c
28	echo "Compression=$c" >> ${OBJ}/.putty/sessions/kex_$k
29	env HOME=$PWD ${PLINK} -load compression_$c -batch \
30	    -i ${OBJ}/putty.rsa2 cat ${DATA} > ${COPY}
31	if [ $? -ne 0 ]; then
32		fail "ssh cat $DATA failed"
33	fi
34	cmp ${DATA} ${COPY}		|| fail "corrupted copy"
35
36	for s in 10 100 1k 32k 64k 128k 256k; do
37		trace "compression $c dd-size ${s}"
38		rm -f ${COPY}
39		dd if=$DATA obs=${s} 2> /dev/null | \
40			env HOME=$PWD ${PLINK} -load compression_$c \
41			    -batch -i ${OBJ}/putty.rsa2 \
42			    "cat > ${COPY}"
43		if [ $? -ne 0 ]; then
44			fail "ssh cat $DATA failed"
45		fi
46		cmp $DATA ${COPY}	|| fail "corrupted copy"
47	done
48done
49rm -f ${COPY}
50
51