xref: /freebsd/crypto/openssh/regress/scp-ssh-wrapper.sh (revision 4f29da19bd44f0e99f021510460a81bf754c21d2)
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
5printname () {
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.
20while test "$1" != ""; do
21	arg="$1"
22	shift
23done
24
25BAD="../../../../../../../../../../../../../${DIR}/dotpathdir"
26
27case "$SCPTESTMODE" in
28badserver_0)
29	echo "D0755 0 /${DIR}/rootpathdir"
30	echo "C755 2 rootpathfile"
31	echo "X"
32	;;
33badserver_1)
34	echo "D0755 0 $BAD"
35	echo "C755 2 file"
36	echo "X"
37	;;
38badserver_2)
39	echo "D0755 0 $BAD"
40	echo "C755 2 file"
41	echo "X"
42	;;
43badserver_3)
44	printname $BAD
45	echo "C755 2 file"
46	echo "X"
47	;;
48badserver_4)
49	printname $BAD
50	echo "D0755 0 .."
51	echo "C755 2 file"
52	echo "X"
53	;;
54*)
55	exec $arg
56	;;
57esac
58