summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_full_audit.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2021-06-17 09:44:38 -0700
committerNoel Power <npower@samba.org>2021-06-22 13:44:34 +0000
commitf02f55e84d577a6712433a39aeca504b7411a4a4 (patch)
tree64f948496304294501bd9061787ee46a679b4ee9 /source3/modules/vfs_full_audit.c
parent770357f666fe1f6a18742cbad45ce0058fa85063 (diff)
downloadsamba-f02f55e84d577a6712433a39aeca504b7411a4a4.tar.gz
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>
Diffstat (limited to 'source3/modules/vfs_full_audit.c')
-rw-r--r--source3/modules/vfs_full_audit.c32
1 files changed, 30 insertions, 2 deletions
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;
}