s3: smbd: Remove is_visible_file().
authorJeremy Allison <jra@samba.org>
Fri, 4 Jun 2021 20:44:52 +0000 (13:44 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 9 Jun 2021 13:14:30 +0000 (13:14 +0000)
No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/dir.c

index 2622ca55fa508a80d845e3ef0b3b70d25dfe3a4b..d9cc47c88e81f641e29a4d8ee5fef2a0f3bab7ee 100644 (file)
@@ -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?
 ********************************************************************/