From 005cbeae174a94d981c56b73ec616e9598a7efc5 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 3 Feb 2021 13:59:00 -0800 Subject: [PATCH] s3: VFS: time_audit: Fix smb_time_audit_linkat() to cope with real directory fsps. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jeremy Allison Reviewed-by: Ralph Böhme --- source3/modules/vfs_time_audit.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index a56839c77ad..db9e9d3cf12 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -1497,10 +1497,19 @@ static int smb_time_audit_linkat(vfs_handle_struct *handle, const struct smb_filename *new_smb_fname, int flags) { + struct smb_filename *new_full_fname = NULL; int result; struct timespec ts1,ts2; double timediff; + new_full_fname = full_path_from_dirfsp_atname(talloc_tos(), + dstfsp, + new_smb_fname); + if (new_full_fname == NULL) { + errno = ENOMEM; + return -1; + } + clock_gettime_mono(&ts1); result = SMB_VFS_NEXT_LINKAT(handle, srcfsp, @@ -1513,9 +1522,10 @@ static int smb_time_audit_linkat(vfs_handle_struct *handle, if (timediff > audit_timeout) { smb_time_audit_log_fname("linkat", timediff, - new_smb_fname->base_name); + new_full_fname->base_name); } + TALLOC_FREE(new_full_fname); return result; } -- 2.47.3