VFS: time_audit: Fixup smb_time_audit_mknodat() to log the dirfsp path.
authorJeremy Allison <jra@samba.org>
Wed, 20 Jan 2021 20:22:29 +0000 (12:22 -0800)
committerJeremy Allison <jra@samba.org>
Thu, 21 Jan 2021 21:48:30 +0000 (21:48 +0000)
Missed in my original fixes.

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

index 05ba4865219989270b3194d811502a15b230b79c..cc5039fed7c7c03386da1c017858731c275b86a2 100644 (file)
@@ -1506,10 +1506,19 @@ static int smb_time_audit_mknodat(vfs_handle_struct *handle,
                                mode_t mode,
                                SMB_DEV_T dev)
 {
+       struct smb_filename *full_fname = NULL;
        int result;
        struct timespec ts1,ts2;
        double timediff;
 
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                                 dirfsp,
+                                                 smb_fname);
+       if (full_fname == NULL) {
+               errno = ENOMEM;
+               return -1;
+       }
+
        clock_gettime_mono(&ts1);
        result = SMB_VFS_NEXT_MKNODAT(handle,
                                dirfsp,
@@ -1520,9 +1529,10 @@ static int smb_time_audit_mknodat(vfs_handle_struct *handle,
        timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
 
        if (timediff > audit_timeout) {
-               smb_time_audit_log_smb_fname("mknodat", timediff, smb_fname);
+               smb_time_audit_log_smb_fname("mknodat", timediff, full_fname);
        }
 
+       TALLOC_FREE(full_fname);
        return result;
 }