diff options
Diffstat (limited to 'regress/scp.sh')
-rw-r--r-- | regress/scp.sh | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/regress/scp.sh b/regress/scp.sh index 703cc0893..c3034b6e7 100644 --- a/regress/scp.sh +++ b/regress/scp.sh | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: scp.sh,v 1.2 2004/06/16 13:15:09 dtucker Exp $ | 1 | # $OpenBSD: scp.sh,v 1.3 2004/07/08 12:59:35 dtucker Exp $ |
2 | # Placed in the Public Domain. | 2 | # Placed in the Public Domain. |
3 | 3 | ||
4 | tid="scp" | 4 | tid="scp" |
@@ -12,16 +12,16 @@ else | |||
12 | DIFFOPT="-r" | 12 | DIFFOPT="-r" |
13 | fi | 13 | fi |
14 | 14 | ||
15 | DATA=/bin/ls | 15 | DATA=/bin/ls${EXEEXT} |
16 | COPY=${OBJ}/copy | 16 | COPY=${OBJ}/copy |
17 | COPY2=${OBJ}/copy2 | 17 | COPY2=${OBJ}/copy2 |
18 | DIR=${COPY}.dd | 18 | DIR=${COPY}.dd |
19 | DIR2=${COPY}.dd2 | 19 | DIR2=${COPY}.dd2 |
20 | 20 | ||
21 | SRC=`dirname ${SCRIPT}` | 21 | SRC=`dirname ${SCRIPT}` |
22 | cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.exe | 22 | cp ${SRC}/scp-ssh-wrapper.sh ${OBJ}/scp-ssh-wrapper.scp |
23 | chmod 755 ${OBJ}/scp-ssh-wrapper.exe | 23 | chmod 755 ${OBJ}/scp-ssh-wrapper.scp |
24 | scpopts="-q -S ${OBJ}/scp-ssh-wrapper.exe" | 24 | scpopts="-q -S ${OBJ}/scp-ssh-wrapper.scp" |
25 | 25 | ||
26 | scpclean() { | 26 | scpclean() { |
27 | rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2} | 27 | rm -rf ${COPY} ${COPY2} ${DIR} ${DIR2} |
@@ -64,6 +64,19 @@ cp ${DATA} ${DIR}/copy | |||
64 | $SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed" | 64 | $SCP $scpopts -r somehost:${DIR} ${DIR2} || fail "copy failed" |
65 | diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" | 65 | diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" |
66 | 66 | ||
67 | if [ ! -z "$SUDO" ]; then | ||
68 | verbose "$tid: skipped file after scp -p with failed chown+utimes" | ||
69 | scpclean | ||
70 | cp -p ${DATA} ${DIR}/copy | ||
71 | cp -p ${DATA} ${DIR}/copy2 | ||
72 | cp ${DATA} ${DIR2}/copy | ||
73 | chmod 660 ${DIR2}/copy | ||
74 | $SUDO chown root ${DIR2}/copy | ||
75 | $SCP -p $scpopts somehost:${DIR}/\* ${DIR2} >/dev/null 2>&1 | ||
76 | diff ${DIFFOPT} ${DIR} ${DIR2} || fail "corrupted copy" | ||
77 | $SUDO rm ${DIR2}/copy | ||
78 | fi | ||
79 | |||
67 | for i in 0 1 2 3 4; do | 80 | for i in 0 1 2 3 4; do |
68 | verbose "$tid: disallow bad server #$i" | 81 | verbose "$tid: disallow bad server #$i" |
69 | SCPTESTMODE=badserver_$i | 82 | SCPTESTMODE=badserver_$i |
@@ -79,4 +92,4 @@ for i in 0 1 2 3 4; do | |||
79 | done | 92 | done |
80 | 93 | ||
81 | scpclean | 94 | scpclean |
82 | rm -f ${OBJ}/scp-ssh-wrapper.exe | 95 | rm -f ${OBJ}/scp-ssh-wrapper.scp |