diff options
author | Jeremy Allison <jra@samba.org> | 2019-08-09 15:34:52 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-08-16 19:52:34 +0000 |
commit | 16a455d3c3816a0a0fa82af8b04fa1c6fe6947a1 (patch) | |
tree | b844bc411c54d0875c2e2b942f1c8f41a5c33f53 | |
parent | 588e64ddd02cb6b63184d5edffe7b5f2432232d8 (diff) | |
download | samba-16a455d3c3816a0a0fa82af8b04fa1c6fe6947a1.tar.gz |
s3: VFS: vfs_time_audit. Implement renameat().
Currently identical to rename().
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
-rw-r--r-- | source3/modules/vfs_time_audit.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 1d82ffe454f..31350df5e91 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -916,6 +916,32 @@ static int smb_time_audit_rename(vfs_handle_struct *handle, return result; } +static int smb_time_audit_renameat(vfs_handle_struct *handle, + files_struct *srcfsp, + const struct smb_filename *oldname, + files_struct *dstfsp, + const struct smb_filename *newname) +{ + int result; + struct timespec ts1,ts2; + double timediff; + + clock_gettime_mono(&ts1); + result = SMB_VFS_NEXT_RENAMEAT(handle, + srcfsp, + oldname, + dstfsp, + newname); + clock_gettime_mono(&ts2); + timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9; + + if (timediff > audit_timeout) { + smb_time_audit_log_smb_fname("renameat", timediff, newname); + } + + return result; +} + struct smb_time_audit_fsync_state { struct files_struct *fsp; int ret; @@ -2811,6 +2837,7 @@ static struct vfs_fn_pointers vfs_time_audit_fns = { .sendfile_fn = smb_time_audit_sendfile, .recvfile_fn = smb_time_audit_recvfile, .rename_fn = smb_time_audit_rename, + .renameat_fn = smb_time_audit_renameat, .fsync_send_fn = smb_time_audit_fsync_send, .fsync_recv_fn = smb_time_audit_fsync_recv, .stat_fn = smb_time_audit_stat, |