From: Jeremy Allison Date: Mon, 1 Feb 2021 21:08:46 +0000 (-0800) Subject: s3: VFS: full_audit: Fix smb_full_audit_linkat() to cope with real directory fsps. X-Git-Tag: tevent-0.11.0~1793 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2952cfe0edaaec44ee1fbd1966fb9a50a9122399;p=thirdparty%2Fsamba.git s3: VFS: full_audit: Fix smb_full_audit_linkat() to cope with real directory fsps. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Böhme --- diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 71577c8aaeb..7d47871680d 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -1870,8 +1870,23 @@ static int smb_full_audit_linkat(vfs_handle_struct *handle, const struct smb_filename *new_smb_fname, int flags) { + struct smb_filename *old_full_fname = NULL; + struct smb_filename *new_full_fname = NULL; int result; + old_full_fname = full_path_from_dirfsp_atname(talloc_tos(), + srcfsp, + old_smb_fname); + if (old_full_fname == NULL) { + return -1; + } + new_full_fname = full_path_from_dirfsp_atname(talloc_tos(), + dstfsp, + new_smb_fname); + if (new_full_fname == NULL) { + TALLOC_FREE(old_full_fname); + return -1; + } result = SMB_VFS_NEXT_LINKAT(handle, srcfsp, old_smb_fname, @@ -1883,8 +1898,11 @@ static int smb_full_audit_linkat(vfs_handle_struct *handle, (result >= 0), handle, "%s|%s", - smb_fname_str_do_log(handle->conn, old_smb_fname), - smb_fname_str_do_log(handle->conn, new_smb_fname)); + smb_fname_str_do_log(handle->conn, old_full_fname), + smb_fname_str_do_log(handle->conn, new_full_fname)); + + TALLOC_FREE(old_full_fname); + TALLOC_FREE(new_full_fname); return result; }