[SCM] Samba Shared Repository - branch master updated
Jeremy Allison
jra at samba.org
Wed Apr 19 22:31:02 UTC 2023
The branch, master has been updated
via 9eb44306623 s3:lib: Do not try to match '.' and '..' directories in is_in_path()
via a2acbd3f3cf s3:tests: Add test that veto files works for hidden files
via b5a66840e30 s3:tests: Create a temporary directory for test_veto_files.sh
from 6e525d55d98 gp: Fix NameError: free variable 'cron_dir' in Crontab CSE
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 9eb44306623fc4897b373b04763e475f696ab92d
Author: Andreas Schneider <asn at samba.org>
Date: Wed Apr 19 16:23:10 2023 +0200
s3:lib: Do not try to match '.' and '..' directories in is_in_path()
This fixes setting veto files to '.*' to not list hidden files and
directories starting with a dot.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15360
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
Autobuild-User(master): Jeremy Allison <jra at samba.org>
Autobuild-Date(master): Wed Apr 19 22:30:19 UTC 2023 on atb-devel-224
commit a2acbd3f3cff8d1cac63acdead4b7be14a7092b2
Author: Andreas Schneider <asn at samba.org>
Date: Wed Apr 19 15:35:47 2023 +0200
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 at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
commit b5a66840e3057cbff85fe6cd231310c4a9cfb34b
Author: Andreas Schneider <asn at samba.org>
Date: Wed Apr 19 20:45:52 2023 +0200
s3:tests: Create a temporary directory for test_veto_files.sh
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15360
Signed-off-by: Andreas Schneider <asn at samba.org>
Reviewed-by: Jeremy Allison <jra at samba.org>
-----------------------------------------------------------------------
Summary of changes:
selftest/target/Samba3.pm | 4 ++++
source3/lib/util.c | 5 +++++
source3/script/tests/test_veto_files.sh | 35 +++++++++++++++++++++++++++++++--
3 files changed, 42 insertions(+), 2 deletions(-)
Changeset truncated at 500 lines:
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 6f9b7466e4a..6b371ee2714 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1968,6 +1968,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/lib/util.c b/source3/lib/util.c
index b010d035cdd..9fd913ba729 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -743,6 +743,11 @@ bool is_in_path(const char *name, name_compare_entry *namelist, bool case_sensit
return False;
}
+ /* Do not reject path components if namelist is set to '.*' */
+ if (ISDOT(name) || ISDOTDOT(name)) {
+ return false;
+ }
+
DEBUG(8, ("is_in_path: %s\n", name));
/* Get the last component of the unix name. */
diff --git a/source3/script/tests/test_veto_files.sh b/source3/script/tests/test_veto_files.sh
index 5ecfb53b8a4..201883ee330 100755
--- a/source3/script/tests/test_veto_files.sh
+++ b/source3/script/tests/test_veto_files.sh
@@ -22,13 +22,21 @@ 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
+TMPDIR=${PREFIX_ABS}/$(basename "${0}")
+mkdir -p "${TMPDIR}" || exit 1
+cd "${TMPDIR}" || exit 1
+
#
# Cleanup function.
#
@@ -41,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"
)
}
@@ -51,7 +61,7 @@ smbclient_get_expect_error()
{
filename1="$1"
expected_error="$2"
- tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+ tmpfile=${TMPDIR}/smbclient_interactive_prompt_commands
cat >"$tmpfile" <<EOF
get $filename1 got_file
quit
@@ -88,7 +98,7 @@ smbclient_create_expect_error()
{
filename="$1.$$"
expected_error="$2"
- tmpfile=$PREFIX/smbclient_interactive_prompt_commands
+ tmpfile=${TMPDIR}/smbclient_interactive_prompt_commands
cat >"$tmpfile" <<EOF
put $tmpfile $filename
quit
@@ -181,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
@@ -245,4 +274,6 @@ testit "get_veto_file" test_get_veto_file || failed=$(("$failed" + 1))
do_cleanup
+cd "${PREFIX_ABS}" && rm -rf ${TMPDIR}
+
exit "$failed"
--
Samba Shared Repository
More information about the samba-cvs
mailing list