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:16:11 +0000 |
commit | c09c3f8e38ac2e02676af908b9a0e958ac673d74 (patch) | |
tree | 170d3fc3b3bfcd131f416fbce703c17a989bb039 | |
parent | a26cbb56b5b7be67b261f9646799fb70651ebca3 (diff) | |
download | samba-c09c3f8e38ac2e02676af908b9a0e958ac673d74.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 e0e3c026fa6..0556efd4741 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 |