From b919798f5758e3284ff7f6f7402312c0a4b24d03 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Wed, 3 Nov 2021 14:40:01 +0100 Subject: [PATCH] smbd: early out in is_visible_fsp() This is used in a hot codepath (directory enumeration) so we should avoiding the string comparisions by adding an early exit. Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Nov 3 17:33:00 UTC 2021 on sn-devel-184 --- source3/smbd/dir.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 4d61bb0d56d..856a3625a75 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -1356,6 +1356,14 @@ bool is_visible_fsp(struct files_struct *fsp) hide_special = lp_hide_special_files(SNUM(fsp->conn)); hide_new_files_timeout = lp_hide_new_files_timeout(SNUM(fsp->conn)); + if (!hide_unreadable && + !hide_unwriteable && + !hide_special && + (hide_new_files_timeout == 0)) + { + return true; + } + if (fsp->base_fsp != NULL) { /* Only operate on non-stream files. */ fsp = fsp->base_fsp; -- 2.47.2