]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: full_audit.c: Use real dirfsp for SMB_VFS_RENAMEAT()
authorJeremy Allison <jra@samba.org>
Thu, 17 Jun 2021 16:44:38 +0000 (09:44 -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_full_audit.c

index 5e1963c025fc51d46a466459a42b12b80e677020..bac60117eeafc08c43ccbf9c1f8541cf1606bd95 100644 (file)
@@ -1410,6 +1410,25 @@ static int smb_full_audit_renameat(vfs_handle_struct *handle,
                                const struct smb_filename *smb_fname_dst)
 {
        int result;
+       int saved_errno;
+       struct smb_filename *full_fname_src = NULL;
+       struct smb_filename *full_fname_dst = NULL;
+
+       full_fname_src = full_path_from_dirfsp_atname(talloc_tos(),
+                                                     srcfsp,
+                                                     smb_fname_src);
+       if (full_fname_src == NULL) {
+               errno = ENOMEM;
+               return -1;
+       }
+       full_fname_dst = full_path_from_dirfsp_atname(talloc_tos(),
+                                                     dstfsp,
+                                                     smb_fname_dst);
+       if (full_fname_dst == NULL) {
+               TALLOC_FREE(full_fname_src);
+               errno = ENOMEM;
+               return -1;
+       }
 
        result = SMB_VFS_NEXT_RENAMEAT(handle,
                                srcfsp,
@@ -1417,10 +1436,19 @@ static int smb_full_audit_renameat(vfs_handle_struct *handle,
                                dstfsp,
                                smb_fname_dst);
 
+       if (result == -1) {
+               saved_errno = errno;
+       }
        do_log(SMB_VFS_OP_RENAMEAT, (result >= 0), handle, "%s|%s",
-              smb_fname_str_do_log(handle->conn, smb_fname_src),
-              smb_fname_str_do_log(handle->conn, smb_fname_dst));
+              smb_fname_str_do_log(handle->conn, full_fname_src),
+              smb_fname_str_do_log(handle->conn, full_fname_dst));
 
+       TALLOC_FREE(full_fname_src);
+       TALLOC_FREE(full_fname_dst);
+
+       if (result == -1) {
+               errno = saved_errno;
+       }
        return result;
 }