The branch, master has been updated
       via  0caaa2d1723 vfs: Remove shadow_copy2_get_real_filename_at()
       via  6afcb7f0dbf testing: case insensitive lookups fail in shadow_copy2 
snapshots
      from  c09d1a3ac1c tests: add a test for "fake directory create times"

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 0caaa2d1723084ba5a707432830c5916e85e21bc
Author: Volker Lendecke <v...@samba.org>
Date:   Thu Jan 11 16:49:29 2024 +0000

    vfs: Remove shadow_copy2_get_real_filename_at()
    
    The synthetic_pathref() call in shadow_copy2_get_real_filename_at()
    fails if shadow:snapdir is set outside of the share root, it creates
    an absolute path and non_widelink_open() blocks that.
    
    We don't need shadow_copy2_get_real_filename_at() anymore because the
    dirfsp already points at the correct directory in the snapshot
    directory. So get_real_filename_full_scan_at() just works fine.
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=15556
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Tue Jan 16 19:44:53 UTC 2024 on atb-devel-224

commit 6afcb7f0dbfe741e43b2070f8a78d87cdb73e042
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Jan 16 11:42:43 2024 +0100

    testing: case insensitive lookups fail in shadow_copy2 snapshots
    
    Bug: https://bugzilla.samba.org/show_bug.cgi?id=15556
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/modules/vfs_shadow_copy2.c       | 95 --------------------------------
 source3/script/tests/test_shadow_copy.sh |  4 ++
 2 files changed, 4 insertions(+), 95 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_shadow_copy2.c 
b/source3/modules/vfs_shadow_copy2.c
index 47b0edc72c3..c6e6ecd26c4 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -2524,100 +2524,6 @@ static NTSTATUS shadow_copy2_read_dfs_pathat(struct 
vfs_handle_struct *handle,
        return status;
 }
 
-static NTSTATUS shadow_copy2_get_real_filename_at(
-       struct vfs_handle_struct *handle,
-       struct files_struct *dirfsp,
-       const char *name,
-       TALLOC_CTX *mem_ctx,
-       char **found_name)
-{
-       struct shadow_copy2_private *priv = NULL;
-       time_t timestamp = 0;
-       char *stripped = NULL;
-       char *conv;
-       struct smb_filename *conv_fname = NULL;
-       NTSTATUS status;
-       bool ok;
-
-       SMB_VFS_HANDLE_GET_DATA(handle, priv, struct shadow_copy2_private,
-                               return NT_STATUS_INTERNAL_ERROR);
-
-       DBG_DEBUG("Path=[%s] name=[%s]\n", fsp_str_dbg(dirfsp), name);
-
-       ok = shadow_copy2_strip_snapshot(
-               talloc_tos(), handle, dirfsp->fsp_name, &timestamp, &stripped);
-       if (!ok) {
-               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_AT(
-                       handle, dirfsp, 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);
-               DBG_DEBUG("shadow_copy2_convert [%s] failed: %s\n",
-                         stripped,
-                         strerror(errno));
-               return status;
-       }
-
-       status = synthetic_pathref(
-               talloc_tos(),
-               dirfsp->conn->cwd_fsp,
-               conv,
-               NULL,
-               NULL,
-               0,
-               0,
-               &conv_fname);
-       if (!NT_STATUS_IS_OK(status)) {
-               return status;
-       }
-
-       DEBUG(10, ("Calling NEXT_GET_REAL_FILE_NAME for conv=[%s], "
-                  "name=[%s]\n", conv, name));
-       status = SMB_VFS_NEXT_GET_REAL_FILENAME_AT(
-               handle, conv_fname->fsp, name, mem_ctx, found_name);
-       DEBUG(10, ("NEXT_REAL_FILE_NAME returned %s\n", nt_errstr(status)));
-       if (NT_STATUS_IS_OK(status)) {
-               TALLOC_FREE(conv_fname);
-               return NT_STATUS_OK;
-       }
-       if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
-               TALLOC_FREE(conv_fname);
-               TALLOC_FREE(conv);
-               return NT_STATUS_NOT_SUPPORTED;
-       }
-
-       status = get_real_filename_full_scan_at(
-               conv_fname->fsp, name, false, mem_ctx, found_name);
-       TALLOC_FREE(conv_fname);
-       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 const char *shadow_copy2_connectpath(
        struct vfs_handle_struct *handle,
        const struct files_struct *dirfsp,
@@ -3382,7 +3288,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_at_fn = shadow_copy2_get_real_filename_at,
        .pwrite_fn = shadow_copy2_pwrite,
        .pwrite_send_fn = shadow_copy2_pwrite_send,
        .pwrite_recv_fn = shadow_copy2_pwrite_recv,
diff --git a/source3/script/tests/test_shadow_copy.sh 
b/source3/script/tests/test_shadow_copy.sh
index 3141df3568d..dd6699f2310 100755
--- a/source3/script/tests/test_shadow_copy.sh
+++ b/source3/script/tests/test_shadow_copy.sh
@@ -275,6 +275,10 @@ test_shadow_copy_fixed()
         test_count_versions $share bar/baz $ncopies_allowed || \
         failed=`expr $failed + 1`
 
+    testit "$msg - regular file in case insensitive subdir" \
+        test_count_versions $share bar/bAz $ncopies_allowed || \
+        failed=`expr $failed + 1`
+
     testit "$msg - local symlink" \
         test_count_versions $share bar/lfoo $ncopies_allowed || \
         failed=`expr $failed + 1`


-- 
Samba Shared Repository

Reply via email to