#!/bin/sh # $OpenBSD: scp-ssh-wrapper.sh,v 1.3 2014/01/26 10:49:17 djm Exp $ # Placed in the Public Domain. proc printname { setglobal NAME = $1 setglobal save_IFS = $IFS setglobal IFS = '/' set -- $[echo $NAME] setglobal IFS = $save_IFS while test $Argc -ge 1 { if test "x$1" != "x" { echo "D0755 0 $1" } shift; } } # Discard all but last argument. We use arg later. while test "x$1" != "x { setglobal arg = $1 shift } setglobal BAD = ""../../../../../../../../../../../../../$(DIR)/dotpathdir"" match $SCPTESTMODE { with badserver_0 echo "D0755 0 /$(DIR)/rootpathdir" echo "C755 2 rootpathfile" echo "X" with badserver_1 echo "D0755 0 $BAD" echo "C755 2 file" echo "X" with badserver_2 echo "D0755 0 $BAD" echo "C755 2 file" echo "X" with badserver_3 printname $BAD echo "C755 2 file" echo "X" with badserver_4 printname $BAD echo "D0755 0 .." echo "C755 2 file" echo "X" with * set -- $arg shift exec $SCP @Argv }