1 # $OpenBSD: scp3.sh,v 1.4 2023/01/13 04:47:34 dtucker Exp $
2 # Placed in the Public Domain.
12 maybe_add_scp_path_to_sshd
14 SRC=`dirname ${SCRIPT}`
15 cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp
16 chmod 755 ${OBJ}/scp-ssh-wrapper.scp
17 export SCP # used in scp-ssh-wrapper.scp
20 rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2}
22 chmod 755 ${DIR} ${DIR2}
25 for mode in scp sftp ; do
26 scpopts="-F${OBJ}/ssh_proxy -S ${SSH} -q"
27 tag="$tid: $mode mode"
28 if test $mode = scp ; then
31 scpopts="-s -D ${SFTPSERVER}"
34 verbose "$tag: simple copy remote file to remote file"
36 $SCP $scpopts -3 hostA:${DATA} hostB:${COPY} || fail "copy failed"
37 cmp ${DATA} ${COPY} || fail "corrupted copy"
39 verbose "$tag: simple copy remote file to remote dir"
42 $SCP $scpopts -3 hostA:${COPY} hostB:${DIR} || fail "copy failed"
43 cmp ${COPY} ${DIR}/copy || fail "corrupted copy"
45 verbose "$tag: recursive remote dir to remote dir"
48 cp ${DATA} ${DIR}/copy
49 $SCP $scpopts -3r hostA:${DIR} hostB:${DIR2} || fail "copy failed"
50 diff -r ${DIR} ${DIR2} || fail "corrupted copy"
51 diff -r ${DIR2} ${DIR} || fail "corrupted copy"
53 verbose "$tag: detect non-directory target"
57 $SCP $scpopts -3 hostA:${DATA} hostA:${COPY} hostB:${COPY2}
58 cmp ${COPY} ${COPY2} >/dev/null && fail "corrupt target"
62 rm -f ${OBJ}/scp-ssh-wrapper.exe