vfs_time_audit: support real dirfsps in smb_time_audit_unlinkat()
authorRalph Boehme <slow@samba.org>
Wed, 20 Jan 2021 14:19:59 +0000 (15:19 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 28 Jan 2021 08:11:49 +0000 (08:11 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_time_audit.c

index fe22197f429bacae02b9a49c838a123d8fa56a2d..a56839c77ad2423728d0e00d11dfefd10a4ab7d1 100644 (file)
@@ -1100,10 +1100,18 @@ static int smb_time_audit_unlinkat(vfs_handle_struct *handle,
                        const struct smb_filename *path,
                        int flags)
 {
+       struct smb_filename *full_fname = NULL;
        int result;
        struct timespec ts1,ts2;
        double timediff;
 
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                                 dirfsp,
+                                                 path);
+       if (full_fname == NULL) {
+               return -1;
+       }
+
        clock_gettime_mono(&ts1);
        result = SMB_VFS_NEXT_UNLINKAT(handle,
                                dirfsp,
@@ -1113,9 +1121,10 @@ static int smb_time_audit_unlinkat(vfs_handle_struct *handle,
        timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
 
        if (timediff > audit_timeout) {
-               smb_time_audit_log_smb_fname("unlinkat", timediff, path);
+               smb_time_audit_log_smb_fname("unlinkat", timediff, full_fname);
        }
 
+       TALLOC_FREE(full_fname);
        return result;
 }