summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2019-08-16 16:05:55 -0700
committerJeremy Allison <jra@samba.org>2019-08-20 21:09:28 +0000
commita14d825a2507726f54ac3b4249e10968a2e35bd0 (patch)
treeb78ed49fbd8c709f8f41cfdf53e03dc3f2d276af /source3
parent571624b866d82bb1e9317c1f099049e0483bd1cc (diff)
downloadsamba-a14d825a2507726f54ac3b4249e10968a2e35bd0.tar.gz
s3: VFS: vfs_time_audit. Implement linkat().
Currently identical to link(). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/modules/vfs_time_audit.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index 2a2a8eea584..5342438eb32 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -1442,6 +1442,36 @@ static int smb_time_audit_link(vfs_handle_struct *handle,
return result;
}
+static int smb_time_audit_linkat(vfs_handle_struct *handle,
+ files_struct *srcfsp,
+ const struct smb_filename *old_smb_fname,
+ files_struct *dstfsp,
+ const struct smb_filename *new_smb_fname,
+ int flags)
+{
+ int result;
+ struct timespec ts1,ts2;
+ double timediff;
+
+ clock_gettime_mono(&ts1);
+ result = SMB_VFS_NEXT_LINKAT(handle,
+ srcfsp,
+ old_smb_fname,
+ dstfsp,
+ new_smb_fname,
+ flags);
+ clock_gettime_mono(&ts2);
+ timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
+
+ if (timediff > audit_timeout) {
+ smb_time_audit_log_fname("linkat", timediff,
+ new_smb_fname->base_name);
+ }
+
+ return result;
+}
+
+
static int smb_time_audit_mknod(vfs_handle_struct *handle,
const struct smb_filename *smb_fname,
mode_t mode,
@@ -2841,6 +2871,7 @@ static struct vfs_fn_pointers vfs_time_audit_fns = {
.symlink_fn = smb_time_audit_symlink,
.readlink_fn = smb_time_audit_readlink,
.link_fn = smb_time_audit_link,
+ .linkat_fn = smb_time_audit_linkat,
.mknod_fn = smb_time_audit_mknod,
.realpath_fn = smb_time_audit_realpath,
.chflags_fn = smb_time_audit_chflags,