]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: time_audit: Use real dirfsp for SMB_VFS_RENAMEAT()
authorJeremy Allison <jra@samba.org>
Fri, 18 Jun 2021 03:52:19 +0000 (20:52 -0700)
committerNoel Power <npower@samba.org>
Tue, 22 Jun 2021 13:44:34 +0000 (13:44 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/modules/vfs_time_audit.c

index 1e7b5c1b65feceb144bf2b5b42f09884f53792da..2f198c3c9673a10441007fdcd9755a87ef30a371 100644 (file)
@@ -949,7 +949,15 @@ static int smb_time_audit_renameat(vfs_handle_struct *handle,
        int result;
        struct timespec ts1,ts2;
        double timediff;
+       struct smb_filename *new_full_fname = NULL;
 
+       new_full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                                 dstfsp,
+                                                 newname);
+       if (new_full_fname == NULL) {
+               errno = ENOMEM;
+               return -1;
+       }
        clock_gettime_mono(&ts1);
        result = SMB_VFS_NEXT_RENAMEAT(handle,
                        srcfsp,
@@ -960,9 +968,12 @@ static int smb_time_audit_renameat(vfs_handle_struct *handle,
        timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
 
        if (timediff > audit_timeout) {
-               smb_time_audit_log_smb_fname("renameat", timediff, newname);
+               smb_time_audit_log_smb_fname("renameat",
+                                       timediff,
+                                       new_full_fname);
        }
 
+       TALLOC_FREE(new_full_fname);
        return result;
 }