]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_default: use cp_smb_filename_nostream() in vfswrap_streaminfo()
authorRalph Boehme <slow@samba.org>
Fri, 1 May 2020 14:30:57 +0000 (16:30 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 5 May 2020 19:18:41 +0000 (19:18 +0000)
Ensure twrp field and whatever else may be added in the future is correctly
copied over to smb_fname_cp.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_default.c

index 2ac2a9953b1129811ddc0f67abf14b5766505e57..69e9c5b13edc9a56f6ee17d4d478a2155610ade9 100644 (file)
@@ -3012,19 +3012,20 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle,
                ret = SMB_VFS_FSTAT(fsp, &sbuf);
        }
        else {
-               struct smb_filename smb_fname_cp;
+               struct smb_filename *smb_fname_cp = NULL;
 
-               ZERO_STRUCT(smb_fname_cp);
-               smb_fname_cp.base_name = discard_const_p(char,
-                                       smb_fname->base_name);
-               smb_fname_cp.flags = smb_fname->flags;
+               smb_fname_cp = cp_smb_filename_nostream(talloc_tos(), smb_fname);
+               if (smb_fname_cp == NULL) {
+                       return NT_STATUS_NO_MEMORY;
+               }
 
-               if (smb_fname_cp.flags & SMB_FILENAME_POSIX_PATH) {
-                       ret = SMB_VFS_LSTAT(handle->conn, &smb_fname_cp);
+               if (smb_fname_cp->flags & SMB_FILENAME_POSIX_PATH) {
+                       ret = SMB_VFS_LSTAT(handle->conn, smb_fname_cp);
                } else {
-                       ret = SMB_VFS_STAT(handle->conn, &smb_fname_cp);
+                       ret = SMB_VFS_STAT(handle->conn, smb_fname_cp);
                }
-               sbuf = smb_fname_cp.st;
+               sbuf = smb_fname_cp->st;
+               TALLOC_FREE(smb_fname_cp);
        }
 
        if (ret == -1) {