]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: vfs_time_audit. Implement readlinkat().
authorJeremy Allison <jra@samba.org>
Thu, 22 Aug 2019 21:29:45 +0000 (14:29 -0700)
committerJeremy Allison <jra@samba.org>
Fri, 23 Aug 2019 18:49:36 +0000 (18:49 +0000)
Currently identical to readlink().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
source3/modules/vfs_time_audit.c

index 929e9b001de9c1723fc4eabefe8b42ca381f6ae8..b1eb0f979a29a66072f7838e0c486e29dd73745b 100644 (file)
@@ -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,