diff options
author | Jeremy Allison <jra@samba.org> | 2023-01-12 10:22:09 -0800 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2023-01-13 07:34:35 +0000 |
commit | c844bff3eca336547c6cedfeeb03adda4eed57c6 (patch) | |
tree | 9a2f195ea56a850846266a821a3dd7b259f556ee | |
parent | 1421969b86bf2eab2d192d4a071080b2d021cd38 (diff) | |
download | samba-c844bff3eca336547c6cedfeeb03adda4eed57c6.tar.gz |
selftest: Show vfs_virusscanner crashes when traversing a 2-level directory tree.
Modify check_infected_read() test to use a 2-level deep
directory.
We must have vfs_default:VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS = no
set on the virusscanner share as otherwise the openat flag
shortcut defeats the test.
Add knownfail.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15283
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
-rw-r--r-- | selftest/knownfail.d/virusscanner | 1 | ||||
-rwxr-xr-x | selftest/target/Samba3.pm | 1 | ||||
-rwxr-xr-x | source3/script/tests/test_virus_scanner.sh | 25 |
3 files changed, 20 insertions, 7 deletions
diff --git a/selftest/knownfail.d/virusscanner b/selftest/knownfail.d/virusscanner new file mode 100644 index 00000000000..9bcaae7b4d1 --- /dev/null +++ b/selftest/knownfail.d/virusscanner @@ -0,0 +1 @@ +^samba3.blackbox.virus_scanner.check_infected_read\(fileserver:local\) diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index c6cdc84b615..6f93694f1b3 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -1998,6 +1998,7 @@ sub setup_fileserver virusfilter:infected files = *infected* virusfilter:infected file action = rename virusfilter:scan on close = yes + vfs_default:VFS_OPEN_HOW_RESOLVE_NO_SYMLINKS = no [volumeserialnumber] path = $volume_serial_number_sharedir diff --git a/source3/script/tests/test_virus_scanner.sh b/source3/script/tests/test_virus_scanner.sh index 913c353028b..83b50df915f 100755 --- a/source3/script/tests/test_virus_scanner.sh +++ b/source3/script/tests/test_virus_scanner.sh @@ -26,25 +26,36 @@ check_infected_read() { rm -rf "${sharedir:?}"/* - if ! touch "${sharedir}/infected.txt"; then - echo "ERROR: Cannot create ${sharedir}/infected.txt" + if ! mkdir "${sharedir}/read1"; then + echo "ERROR: Cannot create ${sharedir}/read1" + return 1 + fi + + if ! mkdir "${sharedir}/read1/read2"; then + echo "ERROR: Cannot create ${sharedir}/read1/read2" return 1 fi - ${SMBCLIENT} "//${SERVER_IP}/${SHARE}" -U"${USER}"%"${PASSWORD}" -c "get infected.txt ${sharedir}/infected.download.txt" + if ! touch "${sharedir}/read1/read2/infected.txt"; then + echo "ERROR: Cannot create ${sharedir}/read1/read2/infected.txt" + return 1 + fi + + ${SMBCLIENT} "//${SERVER_IP}/${SHARE}" -U"${USER}"%"${PASSWORD}" -c "get read1/read2/infected.txt ${sharedir}/read1/read2/infected.download.txt" # check that virusfilter:rename prefix/suffix was added - if [ ! -f "${sharedir}/virusfilter.infected.txt.infected" ]; then - echo "ERROR: ${sharedir}/virusfilter.infected.txt.infected is missing." + if [ ! -f "${sharedir}/read1/read2/virusfilter.infected.txt.infected" ]; then + echo "ERROR: ${sharedir}/read1/read2/virusfilter.infected.txt.infected is missing." return 1 fi # check that file was not downloaded - if [ -f "${sharedir}/infected.download.txt" ]; then - echo "ERROR: {sharedir}/infected.download.txt should not exist." + if [ -f "${sharedir}/read1/read2/infected.download.txt" ]; then + echo "ERROR: {sharedir}/read1/read2/infected.download.txt should not exist." return 1 fi + rm -rf "${sharedir:?}"/* return 0 } |