From: Jeremy Allison Date: Thu, 22 Aug 2019 21:29:45 +0000 (-0700) Subject: s3: VFS: vfs_time_audit. Implement readlinkat(). X-Git-Tag: tevent-0.10.1~175 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=854320cd5df93f430cf8a51b1924aa9cd2d5e135;p=thirdparty%2Fsamba.git s3: VFS: vfs_time_audit. Implement readlinkat(). Currently identical to readlink(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Böhme --- diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 929e9b001de..b1eb0f979a2 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -1421,6 +1421,33 @@ static int smb_time_audit_readlink(vfs_handle_struct *handle, return result; } +static int smb_time_audit_readlinkat(vfs_handle_struct *handle, + files_struct *dirfsp, + const struct smb_filename *smb_fname, + char *buf, + size_t bufsiz) +{ + int result; + struct timespec ts1,ts2; + double timediff; + + clock_gettime_mono(&ts1); + result = SMB_VFS_NEXT_READLINKAT(handle, + dirfsp, + smb_fname, + buf, + bufsiz); + clock_gettime_mono(&ts2); + timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9; + + if (timediff > audit_timeout) { + smb_time_audit_log_fname("readlinkat", timediff, + smb_fname->base_name); + } + + return result; +} + static int smb_time_audit_linkat(vfs_handle_struct *handle, files_struct *srcfsp, const struct smb_filename *old_smb_fname, @@ -2853,6 +2880,7 @@ static struct vfs_fn_pointers vfs_time_audit_fns = { .getlock_fn = smb_time_audit_getlock, .symlink_fn = smb_time_audit_symlink, .readlink_fn = smb_time_audit_readlink, + .readlinkat_fn = smb_time_audit_readlinkat, .linkat_fn = smb_time_audit_linkat, .mknodat_fn = smb_time_audit_mknodat, .realpath_fn = smb_time_audit_realpath,