From 901c7cc6aafc98a91888e6ca7c9f7cb2ccdf8627 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 12 Nov 2023 11:48:30 +0100 Subject: [PATCH] smbd: Move mask_match_search() to smb1_reply.c Only called there. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source3/include/proto.h | 1 - source3/lib/util.c | 16 ---------------- source3/smbd/smb1_reply.c | 19 +++++++++++++++++++ 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 06ad7fb508a..13152f7a10a 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -347,7 +347,6 @@ bool parent_dirname(TALLOC_CTX *mem_ctx, const char *dir, char **parent, bool ms_has_wild(const char *s); bool ms_has_wild_w(const smb_ucs2_t *s); bool mask_match(const char *string, const char *pattern, bool is_case_sensitive); -bool mask_match_search(const char *string, const char *pattern, bool is_case_sensitive); bool mask_match_list(const char *string, char **list, int listLen, bool is_case_sensitive); #include "lib/util/unix_match.h" bool name_to_fqdn(fstring fqdn, const char *name); diff --git a/source3/lib/util.c b/source3/lib/util.c index f891842a6b7..fa01f419d65 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -1481,22 +1481,6 @@ bool mask_match(const char *string, const char *pattern, bool is_case_sensitive) return ms_fnmatch_protocol(pattern, string, Protocol, is_case_sensitive) == 0; } -/******************************************************************* - A wrapper that handles case sensitivity and the special handling - of the ".." name. Variant that is only called by old search code which requires - pattern translation. -*******************************************************************/ - -bool mask_match_search(const char *string, const char *pattern, bool is_case_sensitive) -{ - if (ISDOTDOT(string)) - string = "."; - if (ISDOT(pattern)) - return False; - - return ms_fnmatch(pattern, string, True, is_case_sensitive) == 0; -} - /******************************************************************* A wrapper that handles a list of patterns and calls mask_match() on each. Returns True if any of the patterns match. diff --git a/source3/smbd/smb1_reply.c b/source3/smbd/smb1_reply.c index 52a06fed821..ed6a1737485 100644 --- a/source3/smbd/smb1_reply.c +++ b/source3/smbd/smb1_reply.c @@ -1125,6 +1125,25 @@ static void make_dir_struct(TALLOC_CTX *ctx, DEBUG(8,("put name [%s] from [%s] into dir struct\n",buf+30, fname)); } +/******************************************************************* + A wrapper that handles case sensitivity and the special handling + of the ".." name. +*******************************************************************/ + +static bool mask_match_search(const char *string, + const char *pattern, + bool is_case_sensitive) +{ + if (ISDOTDOT(string)) { + string = "."; + } + if (ISDOT(pattern)) { + return False; + } + + return ms_fnmatch(pattern, string, True, is_case_sensitive) == 0; +} + static bool mangle_mask_match(connection_struct *conn, const char *filename, const char *mask) -- 2.47.3