1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-03 13:47:25 +03:00

s3: VFS: full_audit.c: 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 09:44:38 -07:00 committed by Noel Power
parent 770357f666
commit f02f55e84d

View File

@ -1410,6 +1410,25 @@ static int smb_full_audit_renameat(vfs_handle_struct *handle,
const struct smb_filename *smb_fname_dst)
{
int result;
int saved_errno;
struct smb_filename *full_fname_src = NULL;
struct smb_filename *full_fname_dst = NULL;
full_fname_src = full_path_from_dirfsp_atname(talloc_tos(),
srcfsp,
smb_fname_src);
if (full_fname_src == NULL) {
errno = ENOMEM;
return -1;
}
full_fname_dst = full_path_from_dirfsp_atname(talloc_tos(),
dstfsp,
smb_fname_dst);
if (full_fname_dst == NULL) {
TALLOC_FREE(full_fname_src);
errno = ENOMEM;
return -1;
}
result = SMB_VFS_NEXT_RENAMEAT(handle,
srcfsp,
@ -1417,10 +1436,19 @@ static int smb_full_audit_renameat(vfs_handle_struct *handle,
dstfsp,
smb_fname_dst);
if (result == -1) {
saved_errno = errno;
}
do_log(SMB_VFS_OP_RENAMEAT, (result >= 0), handle, "%s|%s",
smb_fname_str_do_log(handle->conn, smb_fname_src),
smb_fname_str_do_log(handle->conn, smb_fname_dst));
smb_fname_str_do_log(handle->conn, full_fname_src),
smb_fname_str_do_log(handle->conn, full_fname_dst));
TALLOC_FREE(full_fname_src);
TALLOC_FREE(full_fname_dst);
if (result == -1) {
errno = saved_errno;
}
return result;
}