From: Ralph Boehme Date: Fri, 1 May 2020 14:30:57 +0000 (+0200) Subject: vfs_default: use cp_smb_filename_nostream() in vfswrap_streaminfo() X-Git-Tag: ldb-2.2.0~681 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f109be3cacb305a06825f7f7e4db1d24ec08aa26;p=thirdparty%2Fsamba.git vfs_default: use cp_smb_filename_nostream() in vfswrap_streaminfo() 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 Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 2ac2a9953b1..69e9c5b13ed 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -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) {