diff options
author | Andreas Schneider <asn@samba.org> | 2023-04-19 15:35:47 +0200 |
---|---|---|
committer | Jule Anger <janger@samba.org> | 2023-04-28 14:56:13 +0000 |
commit | c13b5b7dc89039cb4ee6a74b766fe944ce311d67 (patch) | |
tree | 81f0c7890a4673302e6472cc23f5d2f135c3f084 | |
parent | 647c7c75f8f24e1f33047697b55fc79f35dfb134 (diff) | |
download | samba-c13b5b7dc89039cb4ee6a74b766fe944ce311d67.tar.gz |
s3:tests: Add test that veto files works for hidden files
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15360
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit a2acbd3f3cff8d1cac63acdead4b7be14a7092b2)
-rw-r--r-- | selftest/knownfail.d/veto_files | 1 | ||||
-rwxr-xr-x | selftest/target/Samba3.pm | 4 | ||||
-rwxr-xr-x | source3/script/tests/test_veto_files.sh | 25 |
3 files changed, 30 insertions, 0 deletions
diff --git a/selftest/knownfail.d/veto_files b/selftest/knownfail.d/veto_files new file mode 100644 index 00000000000..be28da859b7 --- /dev/null +++ b/selftest/knownfail.d/veto_files @@ -0,0 +1 @@ +^samba3.blackbox.test_veto_files.list.files.fileserver diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index f9c732284c2..9c590547c94 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -1974,6 +1974,10 @@ sub setup_fileserver path = $veto_sharedir delete veto files = yes +[veto_files_nohidden] + path = $veto_sharedir + veto files = /.*/ + [veto_files] path = $veto_sharedir veto files = /veto_name*/ diff --git a/source3/script/tests/test_veto_files.sh b/source3/script/tests/test_veto_files.sh index e246e864b32..201883ee330 100755 --- a/source3/script/tests/test_veto_files.sh +++ b/source3/script/tests/test_veto_files.sh @@ -22,10 +22,14 @@ SHAREPATH=${5} SMBCLIENT=${6} shift 6 SMBCLIENT="$VALGRIND ${SMBCLIENT}" +# Used by test_smbclient() +# shellcheck disable=2034 +smbclient="$VALGRIND ${SMBCLIENT}" ADDARGS="$@" incdir=$(dirname "$0")/../../../testprogs/blackbox . "$incdir"/subunit.sh +. "${incdir}/common_test_fns.inc" failed=0 @@ -45,6 +49,8 @@ do_cleanup() rm -rf "$SHAREPATH/veto_name_dir\"mangle" rm -f "$SHAREPATH/veto_name_file" rm -f "$SHAREPATH/veto_name_file\"mangle" + rm -f "${SHAREPATH}/regular_file" + rm -f "${SHAREPATH}/.hidden_file" ) } @@ -185,6 +191,25 @@ test_create_veto_file() do_cleanup +echo "regular_file" > "${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 |