From: Jeremy Allison Date: Fri, 4 Jun 2021 20:44:52 +0000 (-0700) Subject: s3: smbd: Remove is_visible_file(). X-Git-Tag: tevent-0.11.0~560 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b98cf3a12daedc572ec0fdd0d90918e42c2534ec;p=thirdparty%2Fsamba.git s3: smbd: Remove is_visible_file(). No longer used. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 2622ca55fa5..d9cc47c88e8 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -80,14 +80,6 @@ struct dptr_struct { struct memcache *dptr_cache; }; -#if 0 -static bool is_visible_file(connection_struct *conn, - struct smb_Dir *dir_hnd, - const char *name, - SMB_STRUCT_STAT *pst, - bool use_veto); -#endif - static struct smb_Dir *OpenDir_fsp(TALLOC_CTX *mem_ctx, connection_struct *conn, files_struct *fsp, const char *mask, @@ -1424,125 +1416,6 @@ static bool file_is_special(connection_struct *conn, return True; } -#if 0 -/******************************************************************* - Should the file be seen by the client? - NOTE: A successful return is no guarantee of the file's existence. -********************************************************************/ - -static bool is_visible_file(connection_struct *conn, - struct smb_Dir *dir_hnd, - const char *name, - SMB_STRUCT_STAT *pst, - bool use_veto) -{ - bool hide_unreadable = lp_hide_unreadable(SNUM(conn)); - bool hide_unwriteable = lp_hide_unwriteable_files(SNUM(conn)); - bool hide_special = lp_hide_special_files(SNUM(conn)); - int hide_new_files_timeout = lp_hide_new_files_timeout(SNUM(conn)); - char *entry = NULL; - struct smb_filename *dir_path = dir_hnd->fsp->fsp_name; - struct smb_filename *smb_fname_base = NULL; - bool ret = false; - - if (ISDOT(name) || ISDOTDOT(name)) { - return True; /* . and .. are always visible. */ - } - - /* If it's a vetoed file, pretend it doesn't even exist */ - if (use_veto && IS_VETO_PATH(conn, name)) { - DEBUG(10,("is_visible_file: file %s is vetoed.\n", name )); - return False; - } - - if (hide_unreadable || - hide_unwriteable || - hide_special || - (hide_new_files_timeout != 0)) - { - entry = talloc_asprintf(talloc_tos(), - "%s/%s", - dir_path->base_name, - name); - if (!entry) { - ret = false; - goto out; - } - - /* Create an smb_filename with stream_name == NULL. */ - smb_fname_base = synthetic_smb_fname(talloc_tos(), - entry, - NULL, - pst, - dir_path->twrp, - 0); - if (smb_fname_base == NULL) { - ret = false; - goto out; - } - - /* If the file name does not exist, there's no point checking - * the configuration options. We succeed, on the basis that the - * checks *might* have passed if the file was present. - */ - if (!VALID_STAT(*pst)) { - if (SMB_VFS_STAT(conn, smb_fname_base) != 0) { - ret = true; - goto out; - } - *pst = smb_fname_base->st; - } - - /* Honour _hide unreadable_ option */ - if (hide_unreadable && - !user_can_read_file(conn, - conn->cwd_fsp, - smb_fname_base)) - { - DEBUG(10,("is_visible_file: file %s is unreadable.\n", - entry )); - ret = false; - goto out; - } - /* Honour _hide unwriteable_ option */ - if (hide_unwriteable && - !user_can_write_file(conn, - conn->cwd_fsp, - smb_fname_base)) - { - DEBUG(10,("is_visible_file: file %s is unwritable.\n", - entry )); - ret = false; - goto out; - } - /* Honour _hide_special_ option */ - if (hide_special && file_is_special(conn, smb_fname_base)) { - DEBUG(10,("is_visible_file: file %s is special.\n", - entry )); - ret = false; - goto out; - } - - if (hide_new_files_timeout != 0) { - - double age = timespec_elapsed( - &smb_fname_base->st.st_ex_mtime); - - if (age < (double)hide_new_files_timeout) { - ret = false; - goto out; - } - } - } - - ret = true; - out: - TALLOC_FREE(smb_fname_base); - TALLOC_FREE(entry); - return ret; -} -#endif - /******************************************************************* Should the file be seen by the client? ********************************************************************/