s3: smbd: Change open_streams_for_delete() to take a struct smb_filename *.
[samba.git] / source3 / modules / vfs_streams_depot.c
index f6226e75abaf7ccc973d40daf951038dad7c03a4..ef5ef64dfa0a481ac0cfad8db04f7ec397383487 100644 (file)
@@ -420,6 +420,7 @@ static NTSTATUS walk_streams(vfs_handle_struct *handle,
                             void *private_data)
 {
        char *dirname;
+       struct smb_filename *dir_smb_fname = NULL;
        DIR *dirhandle = NULL;
        const char *dirent = NULL;
        char *talloced = NULL;
@@ -439,7 +440,18 @@ static NTSTATUS walk_streams(vfs_handle_struct *handle,
 
        DEBUG(10, ("walk_streams: dirname=%s\n", dirname));
 
-       dirhandle = SMB_VFS_NEXT_OPENDIR(handle, dirname, NULL, 0);
+       dir_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       dirname,
+                                       NULL,
+                                       NULL);
+       if (dir_smb_fname == NULL) {
+               TALLOC_FREE(dirname);
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       dirhandle = SMB_VFS_NEXT_OPENDIR(handle, dir_smb_fname, NULL, 0);
+
+       TALLOC_FREE(dir_smb_fname);
 
        if (dirhandle == NULL) {
                TALLOC_FREE(dirname);
@@ -899,17 +911,20 @@ static bool collect_one_stream(const char *dirname,
 
 static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle,
                                         struct files_struct *fsp,
-                                        const char *fname,
+                                        const struct smb_filename *smb_fname,
                                         TALLOC_CTX *mem_ctx,
                                         unsigned int *pnum_streams,
                                         struct stream_struct **pstreams)
 {
-       struct smb_filename *smb_fname_base;
+       struct smb_filename *smb_fname_base = NULL;
        int ret;
        NTSTATUS status;
        struct streaminfo_state state;
 
-       smb_fname_base = synthetic_smb_fname(talloc_tos(), fname, NULL, NULL);
+       smb_fname_base = synthetic_smb_fname(talloc_tos(),
+                                       smb_fname->base_name,
+                                       NULL,
+                                       NULL);
        if (smb_fname_base == NULL) {
                return NT_STATUS_NO_MEMORY;
        }
@@ -963,7 +978,12 @@ static NTSTATUS streams_depot_streaminfo(vfs_handle_struct *handle,
 
        *pnum_streams = state.num_streams;
        *pstreams = state.streams;
-       status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, pnum_streams, pstreams);
+       status = SMB_VFS_NEXT_STREAMINFO(handle,
+                               fsp,
+                               smb_fname_base,
+                               mem_ctx,
+                               pnum_streams,
+                               pstreams);
 
  out:
        TALLOC_FREE(smb_fname_base);