2004-06-16 10:15:59 +00:00
|
|
|
#!/bin/sh
|
2019-07-19 03:45:44 +00:00
|
|
|
# $OpenBSD: scp-ssh-wrapper.sh,v 1.4 2019/07/19 03:45:44 djm Exp $
|
2004-06-16 10:15:59 +00:00
|
|
|
# Placed in the Public Domain.
|
|
|
|
|
|
|
|
printname () {
|
|
|
|
NAME=$1
|
|
|
|
save_IFS=$IFS
|
|
|
|
IFS=/
|
|
|
|
set -- `echo "$NAME"`
|
|
|
|
IFS="$save_IFS"
|
|
|
|
while [ $# -ge 1 ] ; do
|
|
|
|
if [ "x$1" != "x" ]; then
|
|
|
|
echo "D0755 0 $1"
|
|
|
|
fi
|
|
|
|
shift;
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2005-12-14 04:39:20 +00:00
|
|
|
# Discard all but last argument. We use arg later.
|
2014-01-24 03:27:04 +00:00
|
|
|
while test "x$1" != "x"; do
|
2005-12-14 04:39:20 +00:00
|
|
|
arg="$1"
|
|
|
|
shift
|
|
|
|
done
|
2004-06-16 10:15:59 +00:00
|
|
|
|
|
|
|
BAD="../../../../../../../../../../../../../${DIR}/dotpathdir"
|
|
|
|
|
|
|
|
case "$SCPTESTMODE" in
|
|
|
|
badserver_0)
|
|
|
|
echo "D0755 0 /${DIR}/rootpathdir"
|
|
|
|
echo "C755 2 rootpathfile"
|
|
|
|
echo "X"
|
|
|
|
;;
|
|
|
|
badserver_1)
|
|
|
|
echo "D0755 0 $BAD"
|
|
|
|
echo "C755 2 file"
|
|
|
|
echo "X"
|
|
|
|
;;
|
|
|
|
badserver_2)
|
|
|
|
echo "D0755 0 $BAD"
|
|
|
|
echo "C755 2 file"
|
|
|
|
echo "X"
|
|
|
|
;;
|
|
|
|
badserver_3)
|
|
|
|
printname $BAD
|
|
|
|
echo "C755 2 file"
|
|
|
|
echo "X"
|
|
|
|
;;
|
|
|
|
badserver_4)
|
|
|
|
printname $BAD
|
|
|
|
echo "D0755 0 .."
|
|
|
|
echo "C755 2 file"
|
|
|
|
echo "X"
|
|
|
|
;;
|
2019-07-19 03:45:44 +00:00
|
|
|
badserver_5)
|
|
|
|
echo "D0555 0 "
|
|
|
|
echo "X"
|
|
|
|
;;
|
|
|
|
badserver_6)
|
|
|
|
echo "D0555 0 ."
|
|
|
|
echo "X"
|
|
|
|
;;
|
|
|
|
badserver_7)
|
|
|
|
echo "C0755 2 extrafile"
|
|
|
|
echo "X"
|
|
|
|
;;
|
2004-06-16 10:15:59 +00:00
|
|
|
*)
|
2014-01-24 03:27:04 +00:00
|
|
|
set -- $arg
|
|
|
|
shift
|
|
|
|
exec $SCP "$@"
|
2004-06-16 10:15:59 +00:00
|
|
|
;;
|
|
|
|
esac
|