From: Jeremy Allison Date: Thu, 17 Jun 2021 16:44:38 +0000 (-0700) Subject: s3: VFS: full_audit.c: Use real dirfsp for SMB_VFS_RENAMEAT() X-Git-Tag: tevent-0.11.0~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f02f55e84d577a6712433a39aeca504b7411a4a4;p=thirdparty%2Fsamba.git s3: VFS: full_audit.c: Use real dirfsp for SMB_VFS_RENAMEAT() Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 5e1963c025f..bac60117eea 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -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; }