From a2f3c4f5ed2d16e34e034a92b5fabb769ad46c04 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 17 Jun 2021 20:52:19 -0700 Subject: [PATCH] s3: VFS: time_audit: Use real dirfsp for SMB_VFS_RENAMEAT() Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- source3/modules/vfs_time_audit.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 1e7b5c1b65f..2f198c3c967 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -949,7 +949,15 @@ static int smb_time_audit_renameat(vfs_handle_struct *handle, int result; struct timespec ts1,ts2; double timediff; + struct smb_filename *new_full_fname = NULL; + new_full_fname = full_path_from_dirfsp_atname(talloc_tos(), + dstfsp, + newname); + if (new_full_fname == NULL) { + errno = ENOMEM; + return -1; + } clock_gettime_mono(&ts1); result = SMB_VFS_NEXT_RENAMEAT(handle, srcfsp, @@ -960,9 +968,12 @@ static int smb_time_audit_renameat(vfs_handle_struct *handle, timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9; if (timediff > audit_timeout) { - smb_time_audit_log_smb_fname("renameat", timediff, newname); + smb_time_audit_log_smb_fname("renameat", + timediff, + new_full_fname); } + TALLOC_FREE(new_full_fname); return result; }