vfs: Remove name-based SMB_VFS_GET_REAL_FILENAME()
authorVolker Lendecke <vl@samba.org>
Wed, 16 Mar 2022 09:14:14 +0000 (10:14 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 28 Apr 2022 13:12:33 +0000 (13:12 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
16 files changed:
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source3/include/vfs.h
source3/include/vfs_macros.h
source3/modules/vfs_ceph.c
source3/modules/vfs_ceph_snapshots.c
source3/modules/vfs_default.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_glusterfs.c
source3/modules/vfs_glusterfs_fuse.c
source3/modules/vfs_gpfs.c
source3/modules/vfs_not_implemented.c
source3/modules/vfs_shadow_copy2.c
source3/modules/vfs_snapper.c
source3/modules/vfs_time_audit.c
source3/smbd/vfs.c

index bc18a07478b530a1b5ef7ae08c4dbd11ad9389f3..3c511ead769b4ecf7b11552a5dcde6cb13f15bd6 100644 (file)
@@ -651,15 +651,6 @@ static NTSTATUS skel_fstreaminfo(struct vfs_handle_struct *handle,
        return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-static NTSTATUS skel_get_real_filename(struct vfs_handle_struct *handle,
-                                      const struct smb_filename *path,
-                                      const char *name,
-                                      TALLOC_CTX *mem_ctx,
-                                      char **found_name)
-{
-       return NT_STATUS_NOT_IMPLEMENTED;
-}
-
 static NTSTATUS skel_get_real_filename_at(struct vfs_handle_struct *handle,
                                          struct files_struct *dirfsp,
                                          const char *name,
@@ -1053,7 +1044,6 @@ static struct vfs_fn_pointers skel_opaque_fns = {
        .set_compression_fn = skel_set_compression,
 
        .fstreaminfo_fn = skel_fstreaminfo,
-       .get_real_filename_fn = skel_get_real_filename,
        .get_real_filename_at_fn = skel_get_real_filename_at,
        .connectpath_fn = skel_connectpath,
        .brl_lock_windows_fn = skel_brl_lock_windows,
index 52d95235d1c91498e0d7c83d198471944e3bf79b..43d5e81837819e7213b408ecc7278624dddbe3e8 100644 (file)
@@ -875,16 +875,6 @@ static NTSTATUS skel_fstreaminfo(struct vfs_handle_struct *handle,
                                streams);
 }
 
-static NTSTATUS skel_get_real_filename(struct vfs_handle_struct *handle,
-                                      const struct smb_filename *path,
-                                      const char *name,
-                                      TALLOC_CTX *mem_ctx,
-                                      char **found_name)
-{
-       return SMB_VFS_NEXT_GET_REAL_FILENAME(handle,
-                                             path, name, mem_ctx, found_name);
-}
-
 static NTSTATUS skel_get_real_filename_at(struct vfs_handle_struct *handle,
                                          struct files_struct *dirfsp,
                                          const char *name,
@@ -1369,7 +1359,6 @@ static struct vfs_fn_pointers skel_transparent_fns = {
        .set_compression_fn = skel_set_compression,
 
        .fstreaminfo_fn = skel_fstreaminfo,
-       .get_real_filename_fn = skel_get_real_filename,
        .get_real_filename_at_fn = skel_get_real_filename_at,
        .connectpath_fn = skel_connectpath,
        .brl_lock_windows_fn = skel_brl_lock_windows,
index 716b9f02fce8ad2be8d9617022a25b5a2b1b3aaf..316a6c0ec7360ef02876b31eb844b806fb1e9f2c 100644 (file)
  * Version 47 - remove (unused) struct lock_struct last_lock_failure
                from files_struct.
  * Version 47 - Add SMB_VFS_GET_REAL_FILENAME_AT
+ * Version 47 - Replace SMB_VFS_GET_REAL_FILENAME with SMB_VFS_GET_REAL_FILENAME_AT
  */
 
 #define SMB_VFS_INTERFACE_VERSION 47
@@ -1148,12 +1149,6 @@ struct vfs_fn_pointers {
                                   unsigned int *num_streams,
                                   struct stream_struct **streams);
 
-       NTSTATUS (*get_real_filename_fn)(struct vfs_handle_struct *handle,
-                                        const struct smb_filename *path,
-                                        const char *name,
-                                        TALLOC_CTX *mem_ctx,
-                                        char **found_name);
-
        NTSTATUS (*get_real_filename_at_fn)(struct vfs_handle_struct *handle,
                                            struct files_struct *dirfsp,
                                            const char *name,
@@ -1623,11 +1618,6 @@ NTSTATUS smb_vfs_call_fstreaminfo(struct vfs_handle_struct *handle,
                                  TALLOC_CTX *mem_ctx,
                                  unsigned int *num_streams,
                                  struct stream_struct **streams);
-NTSTATUS smb_vfs_call_get_real_filename(struct vfs_handle_struct *handle,
-                                       const struct smb_filename *path,
-                                       const char *name,
-                                       TALLOC_CTX *mem_ctx,
-                                       char **found_name);
 NTSTATUS smb_vfs_call_get_real_filename_at(struct vfs_handle_struct *handle,
                                           struct files_struct *dirfsp,
                                           const char *name,
index 29cbaaba5c19d71e85d6637bad2beb481dc89842..43cfee814fd1d32c02cbff57cc3f852218a16bf3 100644 (file)
 #define SMB_VFS_NEXT_FSTREAMINFO(handle, fsp, mem_ctx, num_streams, streams) \
        smb_vfs_call_fstreaminfo(handle->next, (fsp), (mem_ctx), (num_streams), (streams))
 
-#define SMB_VFS_GET_REAL_FILENAME(conn, path, name, mem_ctx, found_name) \
-       smb_vfs_call_get_real_filename((conn)->vfs_handles, (path), (name), (mem_ctx), (found_name))
-#define SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx, found_name) \
-       smb_vfs_call_get_real_filename((handle)->next, (path), (name), (mem_ctx), (found_name))
-
 #define SMB_VFS_GET_REAL_FILENAME_AT(conn, dirfsp, name, mem_ctx, found_name) \
        smb_vfs_call_get_real_filename_at( \
                (conn)->vfs_handles, \
index b2f38c2be3b849144fd59eec7972d99c28a61415..8132f5ba8b183aa211aa6367ac62dbe93caf2a24 100644 (file)
@@ -1272,20 +1272,6 @@ static int cephwrap_fchflags(struct vfs_handle_struct *handle,
        return -1;
 }
 
-static NTSTATUS cephwrap_get_real_filename(
-       struct vfs_handle_struct *handle,
-       const struct smb_filename *path,
-       const char *name,
-       TALLOC_CTX *mem_ctx,
-       char **found_name)
-{
-       /*
-        * Don't fall back to get_real_filename so callers can differentiate
-        * between a full directory scan and an actual case-insensitive stat.
-        */
-       return NT_STATUS_NOT_SUPPORTED;
-}
-
 static NTSTATUS cephwrap_get_real_filename_at(
        struct vfs_handle_struct *handle,
        struct files_struct *dirfsp,
@@ -1648,7 +1634,6 @@ static struct vfs_fn_pointers ceph_fns = {
        .mknodat_fn = cephwrap_mknodat,
        .realpath_fn = cephwrap_realpath,
        .fchflags_fn = cephwrap_fchflags,
-       .get_real_filename_fn = cephwrap_get_real_filename,
        .get_real_filename_at_fn = cephwrap_get_real_filename_at,
        .connectpath_fn = cephwrap_connectpath,
 
index d86f7fe061055341492f6c053991322e4296f73d..06ef5538450e3037f19a3fe2b06bb55a12a3b7a6 100644 (file)
@@ -1313,44 +1313,6 @@ static int ceph_snap_gmt_fsetxattr(struct vfs_handle_struct *handle,
                                aname, value, size, flags);
 }
 
-static NTSTATUS ceph_snap_gmt_get_real_filename(
-       struct vfs_handle_struct *handle,
-       const struct smb_filename *path,
-       const char *name,
-       TALLOC_CTX *mem_ctx,
-       char **found_name)
-{
-       time_t timestamp = 0;
-       char stripped[PATH_MAX + 1];
-       char conv[PATH_MAX + 1];
-       struct smb_filename conv_fname;
-       int ret;
-       NTSTATUS status;
-
-       ret = ceph_snap_gmt_strip_snapshot(handle, path,
-                                       &timestamp, stripped, sizeof(stripped));
-       if (ret < 0) {
-               return map_nt_error_from_unix(-ret);
-       }
-       if (timestamp == 0) {
-               return SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name,
-                                                     mem_ctx, found_name);
-       }
-       ret = ceph_snap_gmt_convert_dir(handle, stripped,
-                                       timestamp, conv, sizeof(conv));
-       if (ret < 0) {
-               return map_nt_error_from_unix(-ret);
-       }
-
-       conv_fname = (struct smb_filename) {
-               .base_name = conv,
-       };
-
-       status = SMB_VFS_NEXT_GET_REAL_FILENAME(
-               handle, &conv_fname, name, mem_ctx, found_name);
-       return status;
-}
-
 static NTSTATUS ceph_snap_gmt_get_real_filename_at(
        struct vfs_handle_struct *handle,
        struct files_struct *dirfsp,
@@ -1513,7 +1475,6 @@ static struct vfs_fn_pointers ceph_snap_fns = {
        .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv,
        .fsetxattr_fn = ceph_snap_gmt_fsetxattr,
        .fchflags_fn = ceph_snap_gmt_fchflags,
-       .get_real_filename_fn = ceph_snap_gmt_get_real_filename,
        .get_real_filename_at_fn = ceph_snap_gmt_get_real_filename_at,
 };
 
index ca928ded260a002f95117eccd27b3c412c2167de..400bd98cacbecfbcf7ce048bb62b4c45db170b9b 100644 (file)
@@ -3358,19 +3358,6 @@ static NTSTATUS vfswrap_fstreaminfo(vfs_handle_struct *handle,
        return NT_STATUS_OK;
 }
 
-static NTSTATUS vfswrap_get_real_filename(struct vfs_handle_struct *handle,
-                                         const struct smb_filename *path,
-                                         const char *name,
-                                         TALLOC_CTX *mem_ctx,
-                                         char **found_name)
-{
-       /*
-        * Don't fall back to get_real_filename so callers can differentiate
-        * between a full directory scan and an actual case-insensitive stat.
-        */
-       return NT_STATUS_NOT_SUPPORTED;
-}
-
 static NTSTATUS vfswrap_get_real_filename_at(
        struct vfs_handle_struct *handle,
        struct files_struct *dirfsp,
@@ -4029,7 +4016,6 @@ static struct vfs_fn_pointers vfs_default_fns = {
        .file_id_create_fn = vfswrap_file_id_create,
        .fs_file_id_fn = vfswrap_fs_file_id,
        .fstreaminfo_fn = vfswrap_fstreaminfo,
-       .get_real_filename_fn = vfswrap_get_real_filename,
        .get_real_filename_at_fn = vfswrap_get_real_filename_at,
        .connectpath_fn = vfswrap_connectpath,
        .brl_lock_windows_fn = vfswrap_brl_lock_windows,
index c57366a533e795d6fc14a0767594a2e95e90b589..dc013e7e3a176be9de92deb5ccfe14f512e0f13e 100644 (file)
@@ -2082,29 +2082,6 @@ static NTSTATUS smb_full_audit_fstreaminfo(vfs_handle_struct *handle,
         return result;
 }
 
-static NTSTATUS smb_full_audit_get_real_filename(
-       struct vfs_handle_struct *handle,
-       const struct smb_filename *path,
-       const char *name,
-       TALLOC_CTX *mem_ctx,
-       char **found_name)
-{
-       NTSTATUS result;
-
-       result = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx,
-                                               found_name);
-
-       do_log(SMB_VFS_OP_GET_REAL_FILENAME,
-              NT_STATUS_IS_OK(result),
-              handle,
-              "%s/%s->%s",
-              path->base_name,
-              name,
-              NT_STATUS_IS_OK(result) ? *found_name : "");
-
-       return result;
-}
-
 static NTSTATUS smb_full_audit_get_real_filename_at(
        struct vfs_handle_struct *handle,
        struct files_struct *dirfsp,
@@ -3016,7 +2993,6 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
        .snap_create_fn = smb_full_audit_snap_create,
        .snap_delete_fn = smb_full_audit_snap_delete,
        .fstreaminfo_fn = smb_full_audit_fstreaminfo,
-       .get_real_filename_fn = smb_full_audit_get_real_filename,
        .get_real_filename_at_fn = smb_full_audit_get_real_filename_at,
        .connectpath_fn = smb_full_audit_connectpath,
        .brl_lock_windows_fn = smb_full_audit_brl_lock_windows,
index c30c19344f71c230ba5abed5b4988d8cf9183834..f526d413373f002a1fadcaa4ff260ebe31f1ab72 100644 (file)
@@ -1999,40 +1999,6 @@ static int vfs_gluster_fchflags(struct vfs_handle_struct *handle,
        return -1;
 }
 
-static NTSTATUS vfs_gluster_get_real_filename(
-       struct vfs_handle_struct *handle,
-       const struct smb_filename *path,
-       const char *name,
-       TALLOC_CTX *mem_ctx,
-       char **found_name)
-{
-       int ret;
-       char key_buf[GLUSTER_NAME_MAX + 64];
-       char val_buf[GLUSTER_NAME_MAX + 1];
-
-       if (strlen(name) >= GLUSTER_NAME_MAX) {
-               return NT_STATUS_OBJECT_NAME_INVALID;
-       }
-
-       snprintf(key_buf, GLUSTER_NAME_MAX + 64,
-                "glusterfs.get_real_filename:%s", name);
-
-       ret = glfs_getxattr(handle->data, path->base_name, key_buf, val_buf,
-                           GLUSTER_NAME_MAX + 1);
-       if (ret == -1) {
-               if (errno == ENOATTR) {
-                       errno = ENOENT;
-               }
-               return map_nt_error_from_unix(errno);
-       }
-
-       *found_name = talloc_strdup(mem_ctx, val_buf);
-       if (found_name[0] == NULL) {
-               return NT_STATUS_NO_MEMORY;
-       }
-       return NT_STATUS_OK;
-}
-
 static NTSTATUS vfs_gluster_get_real_filename_at(
        struct vfs_handle_struct *handle,
        struct files_struct *dirfsp,
@@ -2404,7 +2370,6 @@ static struct vfs_fn_pointers glusterfs_fns = {
        .fchflags_fn = vfs_gluster_fchflags,
        .file_id_create_fn = NULL,
        .fstreaminfo_fn = NULL,
-       .get_real_filename_fn = vfs_gluster_get_real_filename,
        .get_real_filename_at_fn = vfs_gluster_get_real_filename_at,
        .connectpath_fn = vfs_gluster_connectpath,
        .create_dfs_pathat_fn = vfs_gluster_create_dfs_pathat,
index 08abf9316b590848f378f4f90fe16ad87fba015b..3eb4dc27d548762aac94da6990a69c6301e96ccc 100644 (file)
 
 #define GLUSTER_NAME_MAX 255
 
-static NTSTATUS vfs_gluster_fuse_get_real_filename(
-       struct vfs_handle_struct *handle,
-       const struct smb_filename *path,
-       const char *name,
-       TALLOC_CTX *mem_ctx,
-       char **_found_name)
-{
-       int ret;
-       char key_buf[GLUSTER_NAME_MAX + 64];
-       char val_buf[GLUSTER_NAME_MAX + 1];
-       char *found_name = NULL;
-
-       if (strlen(name) >= GLUSTER_NAME_MAX) {
-               return NT_STATUS_OBJECT_NAME_INVALID;
-       }
-
-       snprintf(key_buf, GLUSTER_NAME_MAX + 64,
-                "glusterfs.get_real_filename:%s", name);
-
-       ret = getxattr(path->base_name, key_buf, val_buf, GLUSTER_NAME_MAX + 1);
-       if (ret == -1) {
-               if (errno == ENOATTR) {
-                       errno = ENOENT;
-               }
-               return map_nt_error_from_unix(errno);
-       }
-
-       found_name = talloc_strdup(mem_ctx, val_buf);
-       if (found_name == NULL) {
-               return NT_STATUS_NO_MEMORY;
-       }
-       *_found_name = found_name;
-       return NT_STATUS_OK;
-}
-
 static NTSTATUS vfs_gluster_fuse_get_real_filename_at(
        struct vfs_handle_struct *handle,
        struct files_struct *dirfsp,
@@ -296,7 +261,6 @@ static int vfs_glusterfs_fuse_connect(struct vfs_handle_struct *handle,
 struct vfs_fn_pointers glusterfs_fuse_fns = {
 
        .connect_fn = vfs_glusterfs_fuse_connect,
-       .get_real_filename_fn = vfs_gluster_fuse_get_real_filename,
        .get_real_filename_at_fn = vfs_gluster_fuse_get_real_filename_at,
        .file_id_create_fn = vfs_glusterfs_fuse_file_id_create,
 };
index 0402323f0481e7c2f7eee32f16ab8d196a84024a..43c625c3290c5886250ba6416aaa5d12c5e1cec7 100644 (file)
@@ -288,88 +288,6 @@ static int vfs_gpfs_setlease(vfs_handle_struct *handle,
 }
 #endif /* HAVE_KERNEL_OPLOCKS_LINUX */
 
-static NTSTATUS vfs_gpfs_get_real_filename(struct vfs_handle_struct *handle,
-                                          const struct smb_filename *path,
-                                          const char *name,
-                                          TALLOC_CTX *mem_ctx,
-                                          char **found_name)
-{
-       int result;
-       char *full_path = NULL;
-       char *to_free = NULL;
-       char real_pathname[PATH_MAX+1], tmpbuf[PATH_MAX];
-       size_t full_path_len;
-       int buflen;
-       bool mangled;
-       struct gpfs_config_data *config;
-
-       SMB_VFS_HANDLE_GET_DATA(handle, config,
-                               struct gpfs_config_data,
-                               return NT_STATUS_INTERNAL_ERROR);
-
-       if (!config->getrealfilename) {
-               return SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name,
-                                                     mem_ctx, found_name);
-       }
-
-       mangled = mangle_is_mangled(name, handle->conn->params);
-       if (mangled) {
-               return SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name,
-                                                     mem_ctx, found_name);
-       }
-
-       full_path_len = full_path_tos(path->base_name, name,
-                                     tmpbuf, sizeof(tmpbuf),
-                                     &full_path, &to_free);
-       if (full_path_len == -1) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       buflen = sizeof(real_pathname) - 1;
-
-       result = gpfswrap_get_realfilename_path(full_path, real_pathname,
-                                               &buflen);
-
-       TALLOC_FREE(to_free);
-
-       if ((result == -1) && (errno == ENOSYS)) {
-               return SMB_VFS_NEXT_GET_REAL_FILENAME(
-                       handle, path, name, mem_ctx, found_name);
-       }
-
-       if (result == -1) {
-               DEBUG(10, ("smbd_gpfs_get_realfilename_path returned %s\n",
-                          strerror(errno)));
-               return map_nt_error_from_unix(errno);
-       }
-
-       /*
-        * GPFS does not necessarily null-terminate the returned path
-        * but instead returns the buffer length in buflen.
-        */
-
-       if (buflen < sizeof(real_pathname)) {
-               real_pathname[buflen] = '\0';
-       } else {
-               real_pathname[sizeof(real_pathname)-1] = '\0';
-       }
-
-       DEBUG(10, ("smbd_gpfs_get_realfilename_path: %s/%s -> %s\n",
-                  path->base_name, name, real_pathname));
-
-       name = strrchr_m(real_pathname, '/');
-       if (name == NULL) {
-               return NT_STATUS_OBJECT_NAME_NOT_FOUND;
-       }
-
-       *found_name = talloc_strdup(mem_ctx, name+1);
-       if (*found_name == NULL) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       return NT_STATUS_OK;
-}
-
 static NTSTATUS vfs_gpfs_get_real_filename_at(struct vfs_handle_struct *handle,
                                              struct files_struct *dirfsp,
                                              const char *name,
@@ -2634,7 +2552,6 @@ static struct vfs_fn_pointers vfs_gpfs_fns = {
        .fs_capabilities_fn = vfs_gpfs_capabilities,
        .filesystem_sharemode_fn = vfs_gpfs_filesystem_sharemode,
        .linux_setlease_fn = vfs_gpfs_setlease,
-       .get_real_filename_fn = vfs_gpfs_get_real_filename,
        .get_real_filename_at_fn = vfs_gpfs_get_real_filename_at,
        .get_dos_attributes_send_fn = vfs_not_implemented_get_dos_attributes_send,
        .get_dos_attributes_recv_fn = vfs_not_implemented_get_dos_attributes_recv,
index 0a69f94c665082d8d38859e9269466e60a73fd8a..9c72e417f2618297f67a49cd9c7359a577081db5 100644 (file)
@@ -723,17 +723,6 @@ NTSTATUS vfs_not_implemented_fstreaminfo(struct vfs_handle_struct *handle,
        return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-_PUBLIC_
-NTSTATUS vfs_not_implemented_get_real_filename(
-       struct vfs_handle_struct *handle,
-       const struct smb_filename *path,
-       const char *name,
-       TALLOC_CTX *mem_ctx,
-       char **found_name)
-{
-       return NT_STATUS_NOT_IMPLEMENTED;
-}
-
 _PUBLIC_
 NTSTATUS vfs_not_implemented_get_real_filename_at(
        struct vfs_handle_struct *handle,
@@ -1159,7 +1148,6 @@ static struct vfs_fn_pointers vfs_not_implemented_fns = {
        .set_compression_fn = vfs_not_implemented_set_compression,
 
        .fstreaminfo_fn = vfs_not_implemented_fstreaminfo,
-       .get_real_filename_fn = vfs_not_implemented_get_real_filename,
        .get_real_filename_at_fn = vfs_not_implemented_get_real_filename_at,
        .connectpath_fn = vfs_not_implemented_connectpath,
        .brl_lock_windows_fn = vfs_not_implemented_brl_lock_windows,
index 673baf55651a317c28d500adf92f390dda6ace94..62c6df5ce729616171367af2b83a2aab47e740dc 100644 (file)
@@ -2500,108 +2500,6 @@ static NTSTATUS shadow_copy2_read_dfs_pathat(struct vfs_handle_struct *handle,
        return status;
 }
 
-static NTSTATUS shadow_copy2_get_real_filename(
-       struct vfs_handle_struct *handle,
-       const struct smb_filename *fname,
-       const char *name,
-       TALLOC_CTX *mem_ctx,
-       char **found_name)
-{
-       struct shadow_copy2_private *priv = NULL;
-       struct shadow_copy2_config *config = NULL;
-       time_t timestamp = 0;
-       char *stripped = NULL;
-       char *conv;
-       struct smb_filename conv_fname;
-       NTSTATUS status;
-
-       SMB_VFS_HANDLE_GET_DATA(handle, priv, struct shadow_copy2_private,
-                               return NT_STATUS_INTERNAL_ERROR);
-       config = priv->config;
-
-       DBG_DEBUG("Path=[%s] name=[%s]\n", smb_fname_str_dbg(fname), name);
-
-       if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
-                                        &timestamp, &stripped)) {
-               status = map_nt_error_from_unix(errno);
-               DEBUG(10, ("shadow_copy2_strip_snapshot failed\n"));
-               return status;
-       }
-       if (timestamp == 0) {
-               DEBUG(10, ("timestamp == 0\n"));
-               return SMB_VFS_NEXT_GET_REAL_FILENAME(handle, fname, name,
-                                                     mem_ctx, found_name);
-       }
-
-       /*
-        * Note that stripped may be an empty string "" if path was ".". As
-        * shadow_copy2_convert() combines "" with the shadow-copy tree connect
-        * root fullpath and get_real_filename_full_scan() has an explicit check
-        * for "" this works.
-        */
-       DBG_DEBUG("stripped [%s]\n", stripped);
-
-       conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
-       if (conv == NULL) {
-               status = map_nt_error_from_unix(errno);
-
-               if (!config->snapdirseverywhere) {
-                       DBG_DEBUG("shadow_copy2_convert [%s] failed\n", stripped);
-                       return status;
-               }
-
-               /*
-                * We're called in the path traversal loop in unix_convert()
-                * walking down the directory hierarchy. shadow_copy2_convert()
-                * will fail if the snapshot directory is futher down in the
-                * hierachy. Set conv to the original stripped path and try to
-                * look it up in the filesystem with
-                * SMB_VFS_NEXT_GET_REAL_FILENAME() or
-                * get_real_filename_full_scan().
-                */
-               DBG_DEBUG("Use stripped [%s] as conv\n", stripped);
-               conv = talloc_strdup(talloc_tos(), stripped);
-               if (conv == NULL) {
-                       return NT_STATUS_NO_MEMORY;
-               }
-       }
-
-       conv_fname = (struct smb_filename) {
-               .base_name = conv,
-       };
-
-       DEBUG(10, ("Calling NEXT_GET_REAL_FILE_NAME for conv=[%s], "
-                  "name=[%s]\n", conv, name));
-       status = SMB_VFS_NEXT_GET_REAL_FILENAME(
-               handle, &conv_fname, name, mem_ctx, found_name);
-       DEBUG(10, ("NEXT_REAL_FILE_NAME returned %s\n", nt_errstr(status)));
-       if (NT_STATUS_IS_OK(status)) {
-               return NT_STATUS_OK;
-       }
-       if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
-               TALLOC_FREE(conv);
-               return NT_STATUS_NOT_SUPPORTED;
-       }
-
-       status = get_real_filename_full_scan(handle->conn,
-                                            conv,
-                                            name,
-                                            false,
-                                            mem_ctx,
-                                            found_name);
-       if (!NT_STATUS_IS_OK(status)) {
-               DBG_DEBUG("Scan [%s] for [%s] failed\n",
-                         conv, name);
-               return status;
-       }
-
-       DBG_DEBUG("Scan [%s] for [%s] returned [%s]\n",
-                 conv, name, *found_name);
-
-       TALLOC_FREE(conv);
-       return NT_STATUS_OK;
-}
-
 static NTSTATUS shadow_copy2_get_real_filename_at(
        struct vfs_handle_struct *handle,
        struct files_struct *dirfsp,
@@ -3540,7 +3438,6 @@ static struct vfs_fn_pointers vfs_shadow_copy2_fns = {
        .mkdirat_fn = shadow_copy2_mkdirat,
        .fsetxattr_fn = shadow_copy2_fsetxattr,
        .fchflags_fn = shadow_copy2_fchflags,
-       .get_real_filename_fn = shadow_copy2_get_real_filename,
        .get_real_filename_at_fn = shadow_copy2_get_real_filename_at,
        .pwrite_fn = shadow_copy2_pwrite,
        .pwrite_send_fn = shadow_copy2_pwrite_send,
index 3cbdb35642fcbe1a2c89d6e87289b4063987fb24..15707ac03041120896befe7c52c5382d8c6a6cea 100644 (file)
@@ -2433,50 +2433,6 @@ static int snapper_gmt_fsetxattr(struct vfs_handle_struct *handle,
                                aname, value, size, flags);
 }
 
-static NTSTATUS snapper_gmt_get_real_filename(
-       struct vfs_handle_struct *handle,
-       const struct smb_filename *fpath,
-       const char *name,
-       TALLOC_CTX *mem_ctx,
-       char **found_name)
-{
-       time_t timestamp;
-       char *stripped;
-       char *conv;
-       struct smb_filename conv_fname;
-       NTSTATUS status;
-
-       if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, fpath,
-                                       &timestamp, &stripped)) {
-               return NT_STATUS_NO_MEMORY;
-       }
-       if (timestamp == 0) {
-               return SMB_VFS_NEXT_GET_REAL_FILENAME(handle, fpath, name,
-                                                     mem_ctx, found_name);
-       }
-       if (stripped[0] == '\0') {
-               *found_name = talloc_strdup(mem_ctx, name);
-               if (*found_name == NULL) {
-                       return NT_STATUS_NO_MEMORY;
-               }
-               return NT_STATUS_OK;
-       }
-       conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
-       TALLOC_FREE(stripped);
-       if (conv == NULL) {
-               return map_nt_error_from_unix(errno);
-       }
-
-       conv_fname = (struct smb_filename) {
-               .base_name = conv,
-       };
-
-       status = SMB_VFS_NEXT_GET_REAL_FILENAME(
-               handle, &conv_fname, name, mem_ctx, found_name);
-       TALLOC_FREE(conv);
-       return status;
-}
-
 static NTSTATUS snapper_gmt_get_real_filename_at(
        struct vfs_handle_struct *handle,
        struct files_struct *dirfsp,
@@ -2682,7 +2638,6 @@ static struct vfs_fn_pointers snapper_fns = {
        .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv,
        .fsetxattr_fn = snapper_gmt_fsetxattr,
        .fchflags_fn = snapper_gmt_fchflags,
-       .get_real_filename_fn = snapper_gmt_get_real_filename,
        .get_real_filename_at_fn = snapper_gmt_get_real_filename_at,
 };
 
index b40f9ff00ef27314d47fd651d6dddee0583725db..4f9ad52592f7891dc419033cad6d593377584235 100644 (file)
@@ -1717,31 +1717,6 @@ static NTSTATUS smb_time_audit_fstreaminfo(vfs_handle_struct *handle,
        return result;
 }
 
-static NTSTATUS smb_time_audit_get_real_filename(
-       struct vfs_handle_struct *handle,
-       const struct smb_filename *path,
-       const char *name,
-       TALLOC_CTX *mem_ctx,
-       char **found_name)
-{
-       NTSTATUS result;
-       struct timespec ts1,ts2;
-       double timediff;
-
-       clock_gettime_mono(&ts1);
-       result = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx,
-                                               found_name);
-       clock_gettime_mono(&ts2);
-       timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
-       if (timediff > audit_timeout) {
-               smb_time_audit_log_fname("get_real_filename",
-                                        timediff, path->base_name);
-       }
-
-       return result;
-}
-
 static NTSTATUS smb_time_audit_get_real_filename_at(
        struct vfs_handle_struct *handle,
        struct files_struct *dirfsp,
@@ -2829,7 +2804,6 @@ static struct vfs_fn_pointers vfs_time_audit_fns = {
        .snap_create_fn = smb_time_audit_snap_create,
        .snap_delete_fn = smb_time_audit_snap_delete,
        .fstreaminfo_fn = smb_time_audit_fstreaminfo,
-       .get_real_filename_fn = smb_time_audit_get_real_filename,
        .get_real_filename_at_fn = smb_time_audit_get_real_filename_at,
        .connectpath_fn = smb_time_audit_connectpath,
        .brl_lock_windows_fn = smb_time_audit_brl_lock_windows,
index 68a97ace038dbc3b64dbeb91b3ad0b46c8c1976e..6ae68cdf87889c3470a557b59dd8711bf1300559 100644 (file)
@@ -2261,17 +2261,6 @@ NTSTATUS smb_vfs_call_fstreaminfo(struct vfs_handle_struct *handle,
                                          num_streams, streams);
 }
 
-NTSTATUS smb_vfs_call_get_real_filename(struct vfs_handle_struct *handle,
-                                       const struct smb_filename *path,
-                                       const char *name,
-                                       TALLOC_CTX *mem_ctx,
-                                       char **found_name)
-{
-       VFS_FIND(get_real_filename);
-       return handle->fns->get_real_filename_fn(handle, path, name, mem_ctx,
-                                                found_name);
-}
-
 NTSTATUS smb_vfs_call_get_real_filename_at(struct vfs_handle_struct *handle,
                                           struct files_struct *dirfsp,
                                           const char *name,