From ca298af67cebee4c3efebf24f4b9d0ef1e73b047 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 9 Aug 2019 14:19:09 -0700 Subject: [PATCH] s3: VFS: vfs_extd_audit. Implement renameat(). Currently identical to rename(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/modules/vfs_extd_audit.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/source3/modules/vfs_extd_audit.c b/source3/modules/vfs_extd_audit.c index 7bbf30e9efd..d8ed3f6fcd5 100644 --- a/source3/modules/vfs_extd_audit.c +++ b/source3/modules/vfs_extd_audit.c @@ -320,6 +320,36 @@ static int audit_rename(vfs_handle_struct *handle, return result; } +static int audit_renameat(vfs_handle_struct *handle, + files_struct *srcfsp, + const struct smb_filename *smb_fname_src, + files_struct *dstfsp, + const struct smb_filename *smb_fname_dst) +{ + int result; + + result = SMB_VFS_NEXT_RENAMEAT(handle, + srcfsp, + smb_fname_src, + dstfsp, + smb_fname_dst); + + if (lp_syslog() > 0) { + syslog(audit_syslog_priority(handle), "renameat %s -> %s %s%s\n", + smb_fname_src->base_name, + smb_fname_dst->base_name, + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : ""); + } + DEBUG(1, ("vfs_extd_audit: renameat old: %s newname: %s %s %s\n", + smb_fname_str_dbg(smb_fname_src), + smb_fname_str_dbg(smb_fname_dst), + (result < 0) ? "failed: " : "", + (result < 0) ? strerror(errno) : "")); + + return result; +} + static int audit_unlink(vfs_handle_struct *handle, const struct smb_filename *smb_fname) { @@ -392,6 +422,7 @@ static struct vfs_fn_pointers vfs_extd_audit_fns = { .open_fn = audit_open, .close_fn = audit_close, .rename_fn = audit_rename, + .renameat_fn = audit_renameat, .unlink_fn = audit_unlink, .chmod_fn = audit_chmod, .fchmod_fn = audit_fchmod, -- 2.34.1