From 4f5791ebd03eaec1c7da0865a383175b05102712 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 5 May 2024 19:47:29 +0200 Subject: Adding upstream version 2:4.17.12+dfsg. Signed-off-by: Daniel Baumann --- source3/script/tests/test_veto_files.sh | 279 ++++++++++++++++++++++++++++++++ 1 file changed, 279 insertions(+) create mode 100755 source3/script/tests/test_veto_files.sh (limited to 'source3/script/tests/test_veto_files.sh') diff --git a/source3/script/tests/test_veto_files.sh b/source3/script/tests/test_veto_files.sh new file mode 100755 index 0000000..201883e --- /dev/null +++ b/source3/script/tests/test_veto_files.sh @@ -0,0 +1,279 @@ +#!/bin/sh +# +# Check smbclient cannot get a file that matches a veto files +# parameter, or inside a directory that matches a veto files +# parameter. +# +# BUG: https://bugzilla.samba.org/show_bug.cgi?id=15143 +# + +if [ $# -lt 6 ]; then + cat <"$tmpfile" <"$tmpfile" < "${SHAREPATH}/regular_file" +echo "hidden_file" > "${SHAREPATH}/.hidden_file" + +test_smbclient "download regular file" \ + "get regular_file" "//${SERVER}/veto_files_nohidden" \ + -U"${USERNAME}%${PASSWORD}" || + failed=$((failed + 1)) +rm -f regular_file +test_smbclient_expect_failure "hidden file can't be downloaded" \ + "get .hidden_file" "//${SERVER}/veto_files_nohidden" \ + -U"${USERNAME}%${PASSWORD}" || + failed=$((failed + 1)) +test_smbclient "list files" \ + "ls" "//${SERVER}/veto_files_nohidden" \ + -U"${USERNAME}%${PASSWORD}" || + failed=$((failed + 1)) + +do_cleanup + +# Using hash2, veto_name_file\"mangle == VHXE5P~M +# Using hash2, veto_name_dir\"mangle == VF5SKC~B + +# I think a depth of 3 should be enough. +# toplevel +touch "$SHAREPATH/veto_name_file" +mkdir "$SHAREPATH/veto_name_dir" +touch "$SHAREPATH/veto_name_dir/file_inside_dir" +mkdir "$SHAREPATH/veto_name_dir/testdir" +touch "$SHAREPATH/veto_name_dir/testdir/file_inside_dir" +# toplevel mangle names. +touch "$SHAREPATH/veto_name_file\"mangle" +mkdir "$SHAREPATH/veto_name_dir\"mangle" +touch "$SHAREPATH/veto_name_dir\"mangle/file_inside_dir" +mkdir "$SHAREPATH/veto_name_dir\"mangle/testdir" +touch "$SHAREPATH/veto_name_dir\"mangle/testdir/file_inside_dir" + +#depth1 +mkdir "$SHAREPATH/dir1" +touch "$SHAREPATH/dir1/veto_name_file" +mkdir "$SHAREPATH/dir1/veto_name_dir" +touch "$SHAREPATH/dir1/veto_name_dir/file_inside_dir" +mkdir "$SHAREPATH/dir1/veto_name_dir/testdir" +touch "$SHAREPATH/dir1/veto_name_dir/testdir/file_inside_dir" +# depth1 mangle names. +touch "$SHAREPATH/dir1/veto_name_file\"mangle" +mkdir "$SHAREPATH/dir1/veto_name_dir\"mangle" +touch "$SHAREPATH/dir1/veto_name_dir\"mangle/file_inside_dir" +mkdir "$SHAREPATH/dir1/veto_name_dir\"mangle/testdir" +touch "$SHAREPATH/dir1/veto_name_dir\"mangle/testdir/file_inside_dir" + +#depth2 +mkdir "$SHAREPATH/dir1/dir2" +touch "$SHAREPATH/dir1/dir2/veto_name_file" +mkdir "$SHAREPATH/dir1/dir2/veto_name_dir" +touch "$SHAREPATH/dir1/dir2/veto_name_dir/file_inside_dir" +mkdir "$SHAREPATH/dir1/dir2/veto_name_dir/testdir" +touch "$SHAREPATH/dir1/dir2/veto_name_dir/testdir/file_inside_dir" +# depth2 mangle names. +touch "$SHAREPATH/dir1/dir2/veto_name_file\"mangle" +mkdir "$SHAREPATH/dir1/dir2/veto_name_dir\"mangle" +touch "$SHAREPATH/dir1/dir2/veto_name_dir\"mangle/file_inside_dir" +mkdir "$SHAREPATH/dir1/dir2/veto_name_dir\"mangle/testdir" +touch "$SHAREPATH/dir1/dir2/veto_name_dir\"mangle/testdir/file_inside_dir" + +#depth3 +mkdir "$SHAREPATH/dir1/dir2/dir3" +touch "$SHAREPATH/dir1/dir2/dir3/veto_name_file" +mkdir "$SHAREPATH/dir1/dir2/dir3/veto_name_dir" +touch "$SHAREPATH/dir1/dir2/dir3/veto_name_dir/file_inside_dir" +mkdir "$SHAREPATH/dir1/dir2/dir3/veto_name_dir/testdir" +touch "$SHAREPATH/dir1/dir2/dir3/veto_name_dir/testdir/file_inside_dir" +# depth3 mangle names. +touch "$SHAREPATH/dir1/dir2/dir3/veto_name_file\"mangle" +mkdir "$SHAREPATH/dir1/dir2/dir3/veto_name_dir\"mangle" +touch "$SHAREPATH/dir1/dir2/dir3/veto_name_dir\"mangle/file_inside_dir" +mkdir "$SHAREPATH/dir1/dir2/dir3/veto_name_dir\"mangle/testdir" +touch "$SHAREPATH/dir1/dir2/dir3/veto_name_dir\"mangle/testdir/file_inside_dir" + +testit "create_veto_file" test_create_veto_file || failed=$((failed + 1)) +testit "get_veto_file" test_get_veto_file || failed=$(("$failed" + 1)) + +do_cleanup + +cd "${PREFIX_ABS}" && rm -rf ${TMPDIR} + +exit "$failed" -- cgit v1.2.3