vfs_audit: support real dirfsps in audit_unlinkat()
authorRalph Boehme <slow@samba.org>
Wed, 20 Jan 2021 13:56:50 +0000 (14:56 +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_audit.c

index f62591f7be0bb17f43aaadbce9648d7cd276a2f1..72d982b88ae391bef4b07be2703383df7118e0cd 100644 (file)
@@ -270,18 +270,27 @@ static int audit_unlinkat(vfs_handle_struct *handle,
                        const struct smb_filename *smb_fname,
                        int flags)
 {
+       struct smb_filename *full_fname = NULL;
        int result;
 
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                                 dirfsp,
+                                                 smb_fname);
+       if (full_fname == NULL) {
+               return -1;
+       }
+
        result = SMB_VFS_NEXT_UNLINKAT(handle,
                        dirfsp,
                        smb_fname,
                        flags);
 
        syslog(audit_syslog_priority(handle), "unlinkat %s %s%s\n",
-              smb_fname->base_name,
+              full_fname->base_name,
               (result < 0) ? "failed: " : "",
               (result < 0) ? strerror(errno) : "");
 
+       TALLOC_FREE(full_fname);
        return result;
 }