Fix compile w/o openssl; disable sha256 & sha512 for --checksum.
[rsync.git] / testsuite / unsafe-byname.test
blob75e720145a7aadf0db7f09d5010dbfd8b70f20a5
1 #!/bin/sh
3 # Copyright (C) 2002 by Martin Pool
5 # Call directly into unsafe_symlink and test its handling of various filenames
7 . "$suitedir/rsync.fns"
9 test_unsafe() {
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
15 result=`"$TOOLDIR/t_unsafe" "$1" "$2"` || test_fail "Failed to check $1 $2"
16 if [ "$result" != "$3" ]; then
17 test_fail "t_unsafe $1 $2 returned \"$result\", expected \"$3\""
21 test_unsafe file from safe
22 test_unsafe dir/file from safe
23 test_unsafe dir/./file from safe
24 test_unsafe dir/. from safe
25 test_unsafe dir/ from safe
27 test_unsafe /etc/passwd from unsafe
28 test_unsafe //../etc/passwd from unsafe
29 test_unsafe //./etc/passwd from unsafe
31 test_unsafe ./foo from safe
32 test_unsafe ../foo from unsafe
33 test_unsafe ./../foo from unsafe
34 test_unsafe .//../foo from unsafe
35 test_unsafe ./../foo from/.. unsafe
36 test_unsafe ../dest from/dir safe
37 test_unsafe ../../dest from//dir unsafe
38 test_unsafe ..//../dest from/dir unsafe
40 test_unsafe .. from/file safe
41 test_unsafe ../.. from/file unsafe
42 test_unsafe ..//.. from//file unsafe
43 test_unsafe dir/.. from safe
44 test_unsafe dir/../.. from unsafe
45 test_unsafe dir/..//.. from unsafe
47 test_unsafe '' from unsafe
49 # Based on tests from unsafe-links by VladimĂ­r Michl
50 test_unsafe ../../unsafe/unsafefile from/safe unsafe
51 test_unsafe ..//../unsafe/unsafefile from/safe unsafe
52 test_unsafe ../files/file1 from/safe safe
54 test_unsafe ../../unsafe/unsafefile safe unsafe
55 test_unsafe ../files/file1 safe unsafe
57 test_unsafe ../../unsafe/unsafefile `pwd`/from/safe safe
58 test_unsafe ../files/file1 `pwd`/from/safe safe