1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

s3: VFS: media_harmony: Use real dirfsp for SMB_VFS_RENAMEAT()

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
This commit is contained in:
Jeremy Allison 2021-06-17 10:47:42 -07:00 committed by Noel Power
parent 69f3858904
commit 2c5ead7fd6

View File

@ -1223,11 +1223,11 @@ static int mh_renameat(vfs_handle_struct *handle,
files_struct *dstfsp, files_struct *dstfsp,
const struct smb_filename *smb_fname_dst) const struct smb_filename *smb_fname_dst)
{ {
int status; int status = -1;
struct smb_filename *srcClientFname; struct smb_filename *full_fname_src = NULL;
struct smb_filename *dstClientFname; struct smb_filename *full_fname_dst = NULL;
TALLOC_CTX *ctx; struct smb_filename *srcClientFname = NULL;
struct smb_filename *dstClientFname = NULL;
DEBUG(MH_INFO_DEBUG, ("Entering with " DEBUG(MH_INFO_DEBUG, ("Entering with "
"smb_fname_src->base_name '%s', " "smb_fname_src->base_name '%s', "
@ -1247,30 +1247,45 @@ static int mh_renameat(vfs_handle_struct *handle,
goto out; goto out;
} }
srcClientFname = NULL; full_fname_src = full_path_from_dirfsp_atname(talloc_tos(),
dstClientFname = NULL; srcfsp,
ctx = talloc_tos(); smb_fname_src);
if (full_fname_src == NULL) {
errno = ENOMEM;
goto out;
}
full_fname_dst = full_path_from_dirfsp_atname(talloc_tos(),
dstfsp,
smb_fname_dst);
if (full_fname_dst == NULL) {
errno = ENOMEM;
goto out;
}
if ((status = alloc_get_client_smb_fname(handle, ctx, if ((status = alloc_get_client_smb_fname(handle,
smb_fname_src, talloc_tos(),
full_fname_src,
&srcClientFname))) &srcClientFname)))
{ {
goto err; goto err;
} }
if ((status = alloc_get_client_smb_fname(handle, ctx, if ((status = alloc_get_client_smb_fname(handle,
smb_fname_dst, talloc_tos(),
full_fname_dst,
&dstClientFname))) &dstClientFname)))
{ {
goto err; goto err;
} }
status = SMB_VFS_NEXT_RENAMEAT(handle, status = SMB_VFS_NEXT_RENAMEAT(handle,
srcfsp, srcfsp->conn->cwd_fsp,
srcClientFname, srcClientFname,
dstfsp, dstfsp->conn->cwd_fsp,
dstClientFname); dstClientFname);
err: err:
TALLOC_FREE(full_fname_src);
TALLOC_FREE(full_fname_dst);
TALLOC_FREE(dstClientFname); TALLOC_FREE(dstClientFname);
TALLOC_FREE(srcClientFname); TALLOC_FREE(srcClientFname);
out: out: