import of openssh-5.8p1
[openssh.git] / regress / scp-ssh-wrapper.sh
1 #!/bin/sh
2 #       $OpenBSD: scp-ssh-wrapper.sh,v 1.2 2005/12/14 04:36:39 dtucker Exp $
3 #       Placed in the Public Domain.
4
5 printname () {
6         NAME=$1
7         save_IFS=$IFS
8         IFS=/
9         set -- `echo "$NAME"`
10         IFS="$save_IFS"
11         while [ $# -ge 1 ] ; do
12                 if [ "x$1" != "x" ]; then
13                         echo "D0755 0 $1"
14                 fi
15                 shift;
16         done
17 }
18
19 # Discard all but last argument.  We use arg later.
20 while test "$1" != ""; do
21         arg="$1"
22         shift
23 done
24
25 BAD="../../../../../../../../../../../../../${DIR}/dotpathdir"
26
27 case "$SCPTESTMODE" in
28 badserver_0)
29         echo "D0755 0 /${DIR}/rootpathdir"
30         echo "C755 2 rootpathfile"
31         echo "X"
32         ;;
33 badserver_1)
34         echo "D0755 0 $BAD"
35         echo "C755 2 file"
36         echo "X"
37         ;;
38 badserver_2)
39         echo "D0755 0 $BAD"
40         echo "C755 2 file"
41         echo "X"
42         ;;
43 badserver_3)
44         printname $BAD
45         echo "C755 2 file"
46         echo "X"
47         ;;
48 badserver_4)
49         printname $BAD
50         echo "D0755 0 .."
51         echo "C755 2 file"
52         echo "X"
53         ;;
54 *)
55         exec $arg
56         ;;
57 esac