From b026bbe24c12dcbfb716c7be26df183d339eac8b Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 19 Apr 2023 16:23:10 +0200 Subject: [PATCH] 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 Reviewed-by: Jeremy Allison (cherry picked from commit 9eb44306623fc4897b373b04763e475f696ab92d) Autobuild-User(v4-17-test): Jule Anger Autobuild-Date(v4-17-test): Fri Apr 28 15:57:35 UTC 2023 on sn-devel-184 --- selftest/knownfail.d/veto_files | 1 - source3/lib/util.c | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) delete mode 100644 selftest/knownfail.d/veto_files diff --git a/selftest/knownfail.d/veto_files b/selftest/knownfail.d/veto_files deleted file mode 100644 index be28da859b7..00000000000 --- a/selftest/knownfail.d/veto_files +++ /dev/null @@ -1 +0,0 @@ -^samba3.blackbox.test_veto_files.list.files.fileserver diff --git a/source3/lib/util.c b/source3/lib/util.c index 912ce1d3004..919dbcf68c5 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -748,6 +748,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. */