xref: /freebsd/crypto/openssh/regress/scp-ssh-wrapper.sh (revision 43a5ec4eb41567cc92586503212743d89686d78f)
1#!/bin/sh
2#       $OpenBSD: scp-ssh-wrapper.sh,v 1.4 2019/07/19 03:45:44 djm 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 "x$1" != "x"; 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	;;
54badserver_5)
55	echo "D0555 0 "
56	echo "X"
57	;;
58badserver_6)
59	echo "D0555 0 ."
60	echo "X"
61	;;
62badserver_7)
63	echo "C0755 2 extrafile"
64	echo "X"
65	;;
66*)
67	set -- $arg
68	shift
69	exec $SCP "$@"
70	;;
71esac
72