Changed some instances of \" in checkit calls to '.
[rsync/rsync.git] / testsuite / unsafe-byname.test
CommitLineData
d25c0e42
MP
1#! /bin/sh
2
3# Copyright (C) 2002 by Martin Pool
4
5# Call directly into unsafe_symlink and test its handling of various filenames
6
e920830e 7. "$suitedir/rsync.fns"
d25c0e42
MP
8
9test_unsafe() {
4eea7793
MP
10 # $1 is the target of a symlink
11 # $2 is the directory we're copying
12 # $3 is the expected outcome: "safe" if the link lies within $2,
13 # or "unsafe" otherwise
14
d25c0e42
MP
15 result=`"$TOOLDIR/t_unsafe" "$1" "$2"` || test_fail "Failed to check $1 $2"
16 if [ "$result" != "$3" ]
17 then
18 test_fail "t_unsafe $1 $2 returned \"$result\", expected \"$3\""
19 fi
20}
21
e4d709cb
MP
22test_unsafe file from safe
23test_unsafe dir/file from safe
24test_unsafe dir/./file from safe
a405cda6
DD
25test_unsafe dir/. from safe
26test_unsafe dir/ from safe
c81a32f0 27
a405cda6
DD
28test_unsafe /etc/passwd from unsafe
29test_unsafe //../etc/passwd from unsafe
30test_unsafe //./etc/passwd from unsafe
c81a32f0 31
4eea7793
MP
32test_unsafe ./foo from safe
33test_unsafe ../foo from unsafe
34test_unsafe ../dest from/dir safe
35
a405cda6
DD
36test_unsafe .. from/file safe
37test_unsafe ../.. from/file unsafe
38test_unsafe dir/.. from safe
39test_unsafe dir/../.. from unsafe
40
4eea7793 41test_unsafe '' from unsafe
c81a32f0
MP
42
43