The branch, master has been updated
       via  247481c s3: smbd: Change dptr_create() to take a const struct 
smb_filename * instead of const char *.
       via  66ce80c s3: smbd: In call_trans2findfirst() all use of ctx is 
really talloc_tos().
       via  3203eb6 s3: smbd: Change OpenDir() to take a struct smb_filename *, 
not a char *.
       via  852cce9 s3: smbd: Change the internals of the private struct 
smb_Dir.
       via  c74ae37 VFS: Modify opendir to take a const struct smb_filename * 
instead of const char *
      from  fb4778f passdb: add linefeed to debug message

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


- Log -----------------------------------------------------------------
commit 247481c12c048c10471895e00e3b7501e1362842
Author: Jeremy Allison <[email protected]>
Date:   Fri Feb 26 16:35:17 2016 -0800

    s3: smbd: Change dptr_create() to take a const struct smb_filename * 
instead of const char *.
    
    Also internally change path storage inside struct dptr_struct
    to a struct smb_filename *.
    
    This allows me to remove several of the synthetic_smb_fname()
    calls I had to add in the previous patches, as we're now
    dealing with struct smb_filename * throughout the dptr and
    OpenDir code.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>
    
    Autobuild-User(master): Ralph Böhme <[email protected]>
    Autobuild-Date(master): Tue Mar  1 18:34:24 CET 2016 on sn-devel-144

commit 66ce80c6d94ca407dc54d318c3956fc037672985
Author: Jeremy Allison <[email protected]>
Date:   Fri Feb 26 16:31:10 2016 -0800

    s3: smbd: In call_trans2findfirst() all use of ctx is really talloc_tos().
    
    Use talloc_tos() explicitly to make this clear. Will help make the next
    commit clearer.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 3203eb66d9fd85e8e58c2f0c658eb3483dcf0870
Author: Jeremy Allison <[email protected]>
Date:   Fri Feb 26 15:55:14 2016 -0800

    s3: smbd: Change OpenDir() to take a struct smb_filename *, not a char *.
    
    Enhances plumbing to remove lp_posix_pathnames() later.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit 852cce993047436353bc2e977b2a3d0886dc74b5
Author: Jeremy Allison <[email protected]>
Date:   Fri Feb 26 14:59:51 2016 -0800

    s3: smbd: Change the internals of the private struct smb_Dir.
    
    Store a struct smb_filename *, not a char *. This will
    allow us to change the interface to OpenDir() in the next
    commit to pass in a struct smb_filename *, not a char *.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

commit c74ae37fe6df0c7a80733e6ed3ae8844345743a5
Author: Jeremy Allison <[email protected]>
Date:   Fri Feb 26 14:53:12 2016 -0800

    VFS: Modify opendir to take a const struct smb_filename * instead of const 
char *
    
    Preparing to reduce use of lp_posix_pathnames().
    
    Uses the same techniques as commit 616d068f0cebb8e50a855b6e30f36fccb7f5a3c8
    (synthetic_smb_fname()) to cope with modules that
    modify the incoming pathname.
    
    Signed-off-by: Jeremy Allison <[email protected]>
    Reviewed-by: Ralph Boehme <[email protected]>

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

Summary of changes:
 examples/VFS/skel_opaque.c          |   6 +-
 examples/VFS/skel_transparent.c     |   8 +-
 source3/include/vfs.h               |  12 ++-
 source3/include/vfs_macros.h        |   8 +-
 source3/modules/vfs_audit.c         |   9 ++-
 source3/modules/vfs_cap.c           |  19 ++++-
 source3/modules/vfs_catia.c         |  27 +++++--
 source3/modules/vfs_default.c       |   7 +-
 source3/modules/vfs_dirsort.c       |   9 ++-
 source3/modules/vfs_extd_audit.c    |  11 ++-
 source3/modules/vfs_full_audit.c    |   9 ++-
 source3/modules/vfs_media_harmony.c |  24 ++++--
 source3/modules/vfs_netatalk.c      |   7 +-
 source3/modules/vfs_shadow_copy.c   |  25 +++++-
 source3/modules/vfs_shadow_copy2.c  |  40 ++++++++--
 source3/modules/vfs_snapper.c       |  25 ++++--
 source3/modules/vfs_streams_depot.c |  14 +++-
 source3/modules/vfs_time_audit.c    |   6 +-
 source3/modules/vfs_unityed_media.c |  23 ++++--
 source3/smbd/close.c                |   4 +-
 source3/smbd/dir.c                  | 154 +++++++++++++++++++++++-------------
 source3/smbd/filename.c             |  15 +++-
 source3/smbd/msdfs.c                |  24 +++++-
 source3/smbd/proto.h                |  17 +++-
 source3/smbd/reply.c                |  58 +++++++++++++-
 source3/smbd/smb2_query_directory.c |   2 +-
 source3/smbd/trans2.c               |  26 +++---
 source3/smbd/vfs.c                  |   7 +-
 source3/torture/cmd_vfs.c           |  28 ++++++-
 29 files changed, 466 insertions(+), 158 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c
index 8961627..ae165a6 100644
--- a/examples/VFS/skel_opaque.c
+++ b/examples/VFS/skel_opaque.c
@@ -97,8 +97,10 @@ static NTSTATUS skel_get_dfs_referrals(struct 
vfs_handle_struct *handle,
        return NT_STATUS_NOT_IMPLEMENTED;
 }
 
-static DIR *skel_opendir(vfs_handle_struct *handle, const char *fname,
-                        const char *mask, uint32_t attr)
+static DIR *skel_opendir(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       const char *mask,
+                       uint32_t attr)
 {
        return NULL;
 }
diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c
index ac82432..549d7d8 100644
--- a/examples/VFS/skel_transparent.c
+++ b/examples/VFS/skel_transparent.c
@@ -95,10 +95,12 @@ static NTSTATUS skel_get_dfs_referrals(struct 
vfs_handle_struct *handle,
        return SMB_VFS_NEXT_GET_DFS_REFERRALS(handle, r);
 }
 
-static DIR *skel_opendir(vfs_handle_struct *handle, const char *fname,
-                        const char *mask, uint32_t attr)
+static DIR *skel_opendir(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       const char *mask,
+                       uint32_t attr)
 {
-       return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+       return SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
 }
 
 static NTSTATUS skel_snap_check_path(struct vfs_handle_struct *handle,
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index b291206..2f34c22 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -177,6 +177,8 @@
                const struct smb_filename * */
 /* Version 35 - Change rmdir from const char *, to
                const struct smb_filename * */
+/* Version 35 - Change opendir from const char *, to
+               const struct smb_filename * */
 
 #define SMB_VFS_INTERFACE_VERSION 35
 
@@ -550,7 +552,10 @@ struct vfs_fn_pointers {
 
        /* Directory operations */
 
-       DIR *(*opendir_fn)(struct vfs_handle_struct *handle, const char *fname, 
const char *mask, uint32_t attributes);
+       DIR *(*opendir_fn)(struct vfs_handle_struct *handle,
+                                       const struct smb_filename *smb_fname,
+                                       const char *mask,
+                                       uint32_t attributes);
        DIR *(*fdopendir_fn)(struct vfs_handle_struct *handle, files_struct 
*fsp, const char *mask, uint32_t attributes);
        struct dirent *(*readdir_fn)(struct vfs_handle_struct *handle,
                                         DIR *dirp,
@@ -963,8 +968,9 @@ uint32_t smb_vfs_call_fs_capabilities(struct 
vfs_handle_struct *handle,
 NTSTATUS smb_vfs_call_get_dfs_referrals(struct vfs_handle_struct *handle,
                                        struct dfs_GetDFSReferral *r);
 DIR *smb_vfs_call_opendir(struct vfs_handle_struct *handle,
-                                    const char *fname, const char *mask,
-                                    uint32_t attributes);
+                       const struct smb_filename *smb_fname,
+                       const char *mask,
+                       uint32_t attributes);
 DIR *smb_vfs_call_fdopendir(struct vfs_handle_struct *handle,
                                        struct files_struct *fsp,
                                        const char *mask,
diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h
index e50c6a6..2e8ca18 100644
--- a/source3/include/vfs_macros.h
+++ b/source3/include/vfs_macros.h
@@ -79,10 +79,10 @@
        smb_vfs_call_get_dfs_referrals((handle)->next, (r))
 
 /* Directory operations */
-#define SMB_VFS_OPENDIR(conn, fname, mask, attr) \
-       smb_vfs_call_opendir((conn)->vfs_handles, (fname), (mask), (attr))
-#define SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr) \
-       smb_vfs_call_opendir((handle)->next, (fname), (mask), (attr))
+#define SMB_VFS_OPENDIR(conn, smb_fname, mask, attr) \
+       smb_vfs_call_opendir((conn)->vfs_handles, (smb_fname), (mask), (attr))
+#define SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr) \
+       smb_vfs_call_opendir((handle)->next, (smb_fname), (mask), (attr))
 
 #define SMB_VFS_FDOPENDIR(fsp, mask, attr) \
        smb_vfs_call_fdopendir((fsp)->conn->vfs_handles, (fsp), (mask), (attr))
diff --git a/source3/modules/vfs_audit.c b/source3/modules/vfs_audit.c
index e16355a..fa47b3c 100644
--- a/source3/modules/vfs_audit.c
+++ b/source3/modules/vfs_audit.c
@@ -106,14 +106,17 @@ static void audit_disconnect(vfs_handle_struct *handle)
        return;
 }
 
-static DIR *audit_opendir(vfs_handle_struct *handle, const char *fname, const 
char *mask, uint32_t attr)
+static DIR *audit_opendir(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       const char *mask,
+                       uint32_t attr)
 {
        DIR *result;
        
-       result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+       result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
 
        syslog(audit_syslog_priority(handle), "opendir %s %s%s\n",
-              fname,
+              smb_fname->base_name,
               (result == NULL) ? "failed: " : "",
               (result == NULL) ? strerror(errno) : "");
 
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index fb97412..f96455c 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -54,15 +54,28 @@ static int cap_get_quota(vfs_handle_struct *handle, const 
char *path,
        return SMB_VFS_NEXT_GET_QUOTA(handle, cappath, qtype, id, dq);
 }
 
-static DIR *cap_opendir(vfs_handle_struct *handle, const char *fname, const 
char *mask, uint32_t attr)
+static DIR *cap_opendir(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       const char *mask,
+                       uint32_t attr)
 {
-       char *capname = capencode(talloc_tos(), fname);
+       char *capname = capencode(talloc_tos(), smb_fname->base_name);
+       struct smb_filename *cap_smb_fname = NULL;
 
        if (!capname) {
                errno = ENOMEM;
                return NULL;
        }
-       return SMB_VFS_NEXT_OPENDIR(handle, capname, mask, attr);
+       cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       capname,
+                                       NULL,
+                                       NULL);
+       if (cap_smb_fname == NULL) {
+               TALLOC_FREE(capname);
+               errno = ENOMEM;
+               return NULL;
+       }
+       return SMB_VFS_NEXT_OPENDIR(handle, cap_smb_fname, mask, attr);
 }
 
 static struct dirent *cap_readdir(vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c
index f65ed4c..9f42e5f 100644
--- a/source3/modules/vfs_catia.c
+++ b/source3/modules/vfs_catia.c
@@ -269,23 +269,38 @@ static NTSTATUS 
catia_string_replace_allocate(connection_struct *conn,
 }
 
 static DIR *catia_opendir(vfs_handle_struct *handle,
-                                    const char *fname,
-                                    const char *mask,
-                                    uint32_t attr)
+                       const struct smb_filename *smb_fname,
+                       const char *mask,
+                       uint32_t attr)
 {
        char *name_mapped = NULL;
        NTSTATUS status;
        DIR *ret;
+       struct smb_filename *mapped_smb_fname = NULL;
 
-       status = catia_string_replace_allocate(handle->conn, fname,
-                                       &name_mapped, vfs_translate_to_unix);
+       status = catia_string_replace_allocate(handle->conn,
+                               smb_fname->base_name,
+                               &name_mapped,
+                               vfs_translate_to_unix);
        if (!NT_STATUS_IS_OK(status)) {
                errno = map_errno_from_nt_status(status);
                return NULL;
        }
 
-       ret = SMB_VFS_NEXT_OPENDIR(handle, name_mapped, mask, attr);
+       mapped_smb_fname = synthetic_smb_fname(talloc_tos(),
+                               name_mapped,
+                               NULL,
+                               NULL);
+       if (mapped_smb_fname == NULL) {
+               TALLOC_FREE(mapped_smb_fname);
+               errno = ENOMEM;
+               return NULL;
+       }
+
+       ret = SMB_VFS_NEXT_OPENDIR(handle, mapped_smb_fname, mask, attr);
+
        TALLOC_FREE(name_mapped);
+       TALLOC_FREE(mapped_smb_fname);
 
        return ret;
 }
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index b13b517..c96bd0d 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -375,12 +375,15 @@ static NTSTATUS vfswrap_snap_delete(struct 
vfs_handle_struct *handle,
 
 /* Directory operations */
 
-static DIR *vfswrap_opendir(vfs_handle_struct *handle, const char *fname, 
const char *mask, uint32_t attr)
+static DIR *vfswrap_opendir(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               const char *mask,
+                               uint32_t attr)
 {
        DIR *result;
 
        START_PROFILE(syscall_opendir);
-       result = opendir(fname);
+       result = opendir(smb_fname->base_name);
        END_PROFILE(syscall_opendir);
        return result;
 }
diff --git a/source3/modules/vfs_dirsort.c b/source3/modules/vfs_dirsort.c
index d164088..f856835 100644
--- a/source3/modules/vfs_dirsort.c
+++ b/source3/modules/vfs_dirsort.c
@@ -113,8 +113,9 @@ static bool open_and_sort_dir(vfs_handle_struct *handle,
 }
 
 static DIR *dirsort_opendir(vfs_handle_struct *handle,
-                                      const char *fname, const char *mask,
-                                      uint32_t attr)
+                               const struct smb_filename *smb_fname,
+                               const char *mask,
+                               uint32_t attr)
 {
        struct dirsort_privates *list_head = NULL;
        struct dirsort_privates *data = NULL;
@@ -131,14 +132,14 @@ static DIR *dirsort_opendir(vfs_handle_struct *handle,
                return NULL;
        }
 
-       data->smb_fname = synthetic_smb_fname(data, fname, NULL, NULL);
+       data->smb_fname = cp_smb_filename(data, smb_fname);
        if (data->smb_fname == NULL) {
                TALLOC_FREE(data);
                return NULL;
        }
 
        /* Open the underlying directory and count the number of entries */
-       data->source_directory = SMB_VFS_NEXT_OPENDIR(handle, fname, mask,
+       data->source_directory = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask,
                                                      attr);
 
        if (data->source_directory == NULL) {
diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c
index 6429370..137bf72 100644
--- a/source3/modules/vfs_extd_audit.c
+++ b/source3/modules/vfs_extd_audit.c
@@ -116,20 +116,23 @@ static void audit_disconnect(vfs_handle_struct *handle)
        return;
 }
 
-static DIR *audit_opendir(vfs_handle_struct *handle, const char *fname, const 
char *mask, uint32_t attr)
+static DIR *audit_opendir(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       const char *mask,
+                       uint32_t attr)
 {
        DIR *result;
 
-       result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+       result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
 
        if (lp_syslog() > 0) {
                syslog(audit_syslog_priority(handle), "opendir %s %s%s\n",
-                      fname,
+                      smb_fname->base_name,
                       (result == NULL) ? "failed: " : "",
                       (result == NULL) ? strerror(errno) : "");
        }
        DEBUG(1, ("vfs_extd_audit: opendir %s %s %s\n",
-              fname,
+              smb_fname->base_name,
               (result == NULL) ? "failed: " : "",
               (result == NULL) ? strerror(errno) : ""));
 
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 3dd2005..311c760 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -776,13 +776,16 @@ static NTSTATUS smb_full_audit_snap_delete(struct 
vfs_handle_struct *handle,
 }
 
 static DIR *smb_full_audit_opendir(vfs_handle_struct *handle,
-                         const char *fname, const char *mask, uint32_t attr)
+                       const struct smb_filename *smb_fname,
+                       const char *mask,
+                       uint32_t attr)
 {
        DIR *result;
 
-       result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+       result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
 
-       do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s", fname);
+       do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s",
+               smb_fname->base_name);
 
        return result;
 }
diff --git a/source3/modules/vfs_media_harmony.c 
b/source3/modules/vfs_media_harmony.c
index b5173af..786cee9 100644
--- a/source3/modules/vfs_media_harmony.c
+++ b/source3/modules/vfs_media_harmony.c
@@ -760,15 +760,16 @@ err:
  * Failure: set errno, return NULL
  */
 static DIR *mh_opendir(vfs_handle_struct *handle,
-               const char *fname,
+               const struct smb_filename *smb_fname,
                const char *mask,
                uint32_t attr)
 {
        struct mh_dirinfo_struct *dirInfo;
 
-       DEBUG(MH_INFO_DEBUG, ("Entering with fname '%s'\n", fname));
+       DEBUG(MH_INFO_DEBUG, ("Entering with fname '%s'\n",
+               smb_fname->base_name));
 
-       if (alloc_set_client_dirinfo(handle, fname, &dirInfo))
+       if (alloc_set_client_dirinfo(handle, smb_fname->base_name, &dirInfo))
        {
                goto err;
        }
@@ -776,10 +777,20 @@ static DIR *mh_opendir(vfs_handle_struct *handle,
        if (!dirInfo->isInMediaFiles)
        {
                dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(handle,
-                       fname, mask, attr);
+                       smb_fname, mask, attr);
        } else {
+               struct smb_filename *smb_fname_clientpath =
+                               synthetic_smb_fname(talloc_tos(),
+                                       dirInfo->clientPath,
+                                       NULL,
+                                       NULL);
+               if (smb_fname_clientpath == NULL) {
+                       goto err;
+               }
+
                dirInfo->dirstream = SMB_VFS_NEXT_OPENDIR(handle,
-                       dirInfo->clientPath, mask, attr);
+                       smb_fname_clientpath, mask, attr);
+               TALLOC_FREE(smb_fname_clientpath);
        }
 
        if (dirInfo->dirstream == NULL) {
@@ -794,7 +805,8 @@ static DIR *mh_opendir(vfs_handle_struct *handle,
        return (DIR*)dirInfo;
 err:
        /* Failure is freed here. */
-       DEBUG(MH_ERR_DEBUG, ("Failing with fname '%s'\n", fname));
+       DEBUG(MH_ERR_DEBUG, ("Failing with fname '%s'\n",
+               smb_fname->base_name));
        TALLOC_FREE(dirInfo);
        return NULL;
 }
diff --git a/source3/modules/vfs_netatalk.c b/source3/modules/vfs_netatalk.c
index 487ab50..d8f9f34 100644
--- a/source3/modules/vfs_netatalk.c
+++ b/source3/modules/vfs_netatalk.c
@@ -177,11 +177,14 @@ static void atalk_rrmdir(TALLOC_CTX *ctx, char *path)
 
 /* Directory operations */
 
-static DIR *atalk_opendir(struct vfs_handle_struct *handle, const char *fname, 
const char *mask, uint32_t attr)
+static DIR *atalk_opendir(struct vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       const char *mask,
+                       uint32_t attr)
 {
        DIR *ret = 0;
 
-       ret = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+       ret = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
 
        /*
         * when we try to perform delete operation upon file which has fork
diff --git a/source3/modules/vfs_shadow_copy.c 
b/source3/modules/vfs_shadow_copy.c
index 5c05e25..77dc163 100644
--- a/source3/modules/vfs_shadow_copy.c
+++ b/source3/modules/vfs_shadow_copy.c
@@ -73,13 +73,18 @@ static bool shadow_copy_match_name(const char *name)
        return False;
 }
 
-static DIR *shadow_copy_opendir(vfs_handle_struct *handle, const char *fname, 
const char *mask, uint32_t attr)
+static DIR *shadow_copy_opendir(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       const char *mask,
+                       uint32_t attr)
 {
        shadow_copy_Dir *dirp;
-       DIR *p = SMB_VFS_NEXT_OPENDIR(handle,fname,mask,attr);
+       DIR *p = SMB_VFS_NEXT_OPENDIR(handle,smb_fname,mask,attr);
 
        if (!p) {
-               DEBUG(0,("shadow_copy_opendir: SMB_VFS_NEXT_OPENDIR() failed 
for [%s]\n",fname));
+               DEBUG(0,("shadow_copy_opendir: SMB_VFS_NEXT_OPENDIR() "
+                       "failed for [%s]\n",
+                       smb_fname->base_name));
                return NULL;
        }
 
@@ -221,7 +226,19 @@ static int 
shadow_copy_get_shadow_copy_data(vfs_handle_struct *handle,
                                            struct shadow_copy_data 
*shadow_copy_data,
                                            bool labels)
 {
-       DIR *p = SMB_VFS_NEXT_OPENDIR(handle,fsp->conn->connectpath,NULL,0);
+       DIR *p = NULL;
+       struct smb_filename *smb_fname = synthetic_smb_fname(talloc_tos(),
+                                               fsp->conn->connectpath,
+                                               NULL,
+                                               NULL);
+       if (smb_fname == NULL) {
+               errno = ENOMEM;
+               return -1;
+       }
+
+       p = SMB_VFS_NEXT_OPENDIR(handle,smb_fname,NULL,0);
+
+       TALLOC_FREE(smb_fname);
 
        shadow_copy_data->num_volumes = 0;
        shadow_copy_data->labels = NULL;
diff --git a/source3/modules/vfs_shadow_copy2.c 
b/source3/modules/vfs_shadow_copy2.c
index 7817168..27fc8a9 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -690,31 +690,44 @@ static void convert_sbuf(vfs_handle_struct *handle, const 
char *fname,
 }
 
 static DIR *shadow_copy2_opendir(vfs_handle_struct *handle,
-                                           const char *fname,
-                                           const char *mask,
-                                           uint32_t attr)
+                       const struct smb_filename *smb_fname,
+                       const char *mask,
+                       uint32_t attr)
 {
        time_t timestamp;
        char *stripped;
        DIR *ret;
        int saved_errno;
        char *conv;
+       struct smb_filename *conv_smb_fname = NULL;
 
-       if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, fname,
-                                        &timestamp, &stripped)) {
+       if (!shadow_copy2_strip_snapshot(talloc_tos(),
+                               handle,
+                               smb_fname->base_name,
+                               &timestamp,
+                               &stripped)) {
                return NULL;
        }
        if (timestamp == 0) {
-               return SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+               return SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
        }
        conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
        TALLOC_FREE(stripped);
        if (conv == NULL) {
                return NULL;
        }
-       ret = SMB_VFS_NEXT_OPENDIR(handle, conv, mask, attr);
+       conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       conv,
+                                       NULL,
+                                       NULL);
+       if (conv_smb_fname == NULL) {
+               TALLOC_FREE(conv);
+               return NULL;
+       }
+       ret = SMB_VFS_NEXT_OPENDIR(handle, conv_smb_fname, mask, attr);
        saved_errno = errno;
        TALLOC_FREE(conv);
+       TALLOC_FREE(conv_smb_fname);
        errno = saved_errno;
        return ret;
 }
@@ -1372,6 +1385,7 @@ static int shadow_copy2_get_shadow_copy_data(
 {
        DIR *p;
        const char *snapdir;
+       struct smb_filename *snapdir_smb_fname = NULL;


-- 
Samba Shared Repository

Reply via email to