1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

vfs_extd_audit.c: support real dirfsps in audit_unlinkat()

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Ralph Boehme 2021-01-20 15:01:23 +01:00 committed by Jeremy Allison
parent 2a51ed753e
commit f82e89c26e

View File

@ -309,8 +309,16 @@ static int audit_unlinkat(vfs_handle_struct *handle,
const struct smb_filename *smb_fname, const struct smb_filename *smb_fname,
int flags) int flags)
{ {
struct smb_filename *full_fname = NULL;
int result; 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, result = SMB_VFS_NEXT_UNLINKAT(handle,
dirfsp, dirfsp,
smb_fname, smb_fname,
@ -318,15 +326,16 @@ static int audit_unlinkat(vfs_handle_struct *handle,
if (lp_syslog() > 0) { if (lp_syslog() > 0) {
syslog(audit_syslog_priority(handle), "unlinkat %s %s%s\n", syslog(audit_syslog_priority(handle), "unlinkat %s %s%s\n",
smb_fname->base_name, full_fname->base_name,
(result < 0) ? "failed: " : "", (result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : ""); (result < 0) ? strerror(errno) : "");
} }
DBG_ERR("unlinkat %s %s %s\n", DBG_ERR("unlinkat %s %s %s\n",
smb_fname_str_dbg(smb_fname), smb_fname_str_dbg(full_fname),
(result < 0) ? "failed: " : "", (result < 0) ? "failed: " : "",
(result < 0) ? strerror(errno) : ""); (result < 0) ? strerror(errno) : "");
TALLOC_FREE(full_fname);
return result; return result;
} }