3 # Copyright (C) 2002 by Martin Pool
5 # Call directly into unsafe_symlink and test its handling of various filenames
7 . $srcdir/testsuite/rsync.fns
10 result=`"$TOOLDIR/t_unsafe" "$1" "$2"` || test_fail "Failed to check $1 $2"
11 if [ "$result" != "$3" ]
13 test_fail "t_unsafe $1 $2 returned \"$result\", expected \"$3\""
17 test_unsafe file from safe
18 test_unsafe dir/file from safe
19 test_unsafe dir/./file from safe
20 test_unsafe dir/. from safe
21 test_unsafe dir/ from safe
23 test_unsafe /etc/passwd from unsafe
24 test_unsafe //../etc/passwd from unsafe
25 test_unsafe //./etc/passwd from unsafe
27 test_unsafe ./foo from safe
28 test_unsafe ../foo from unsafe
29 test_unsafe ../dest from/dir safe
31 # Based on tests from unsafe-links by VladimĂr Michl
32 test_unsafe ../../unsafe/unsafefile from/safe unsafe
33 test_unsafe ../files/file1 from/safe safe
35 test_unsafe ../../unsafe/unsafefile safe unsafe
36 test_unsafe ../files/file1 safe unsafe
38 test_unsafe ../../unsafe/unsafefile `pwd`/from/safe safe
39 test_unsafe ../files/file1 `pwd`/from/safe safe
41 # I think these are correct, but I don't really understand the code.
42 # Waiting for an answer from dwd
43 test_skipped "correct behaviour is unclear"
45 # Test suspicious handling of '..' in srcdir
46 test_unsafe ../../unsafe/unsafefile from/safe/../safe unsafe
47 test_unsafe ../files/file1 from/safe/../safe safe