vfs_streams_depot: pass dirname to walk_streams()/collect_one_stream() as struct...
authorRalph Boehme <slow@samba.org>
Thu, 30 Apr 2020 09:42:50 +0000 (11:42 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 5 May 2020 19:18:38 +0000 (19:18 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_streams_depot.c

index b4cd466dae04ecf35a7472350c4a527c2112275c..eb1cb60aaeaf71295c5e8d4a23e08b77337e6f40 100644 (file)
@@ -468,7 +468,7 @@ static NTSTATUS stream_smb_fname(vfs_handle_struct *handle,
 static NTSTATUS walk_streams(vfs_handle_struct *handle,
                             struct smb_filename *smb_fname_base,
                             char **pdirname,
-                            bool (*fn)(const char *dirname,
+                            bool (*fn)(const struct smb_filename *dirname,
                                        const char *dirent,
                                        void *private_data),
                             void *private_data)
@@ -506,8 +506,8 @@ static NTSTATUS walk_streams(vfs_handle_struct *handle,
        }
 
        dir_hnd = OpenDir(talloc_tos(), handle->conn, dir_smb_fname, NULL, 0);
-       TALLOC_FREE(dir_smb_fname);
        if (dir_hnd == NULL) {
+               TALLOC_FREE(dir_smb_fname);
                TALLOC_FREE(dirname);
                return map_nt_error_from_unix(errno);
        }
@@ -522,13 +522,14 @@ static NTSTATUS walk_streams(vfs_handle_struct *handle,
 
                DBG_DEBUG("dirent=%s\n", dname);
 
-               if (!fn(dirname, dname, private_data)) {
+               if (!fn(dir_smb_fname, dname, private_data)) {
                        TALLOC_FREE(talloced);
                        break;
                }
                TALLOC_FREE(talloced);
        }
 
+       TALLOC_FREE(dir_smb_fname);
        TALLOC_FREE(dir_hnd);
 
        if (pdirname != NULL) {
@@ -934,10 +935,11 @@ struct streaminfo_state {
        NTSTATUS status;
 };
 
-static bool collect_one_stream(const char *dirname,
+static bool collect_one_stream(const struct smb_filename *dirfname,
                               const char *dirent,
                               void *private_data)
 {
+       const char *dirname = dirfname->base_name;
        struct streaminfo_state *state =
                (struct streaminfo_state *)private_data;
        struct smb_filename *smb_fname = NULL;