mirror of
https://github.com/samba-team/samba.git
synced 2024-12-24 21:34:56 +03:00
vfs_full_audit: pass conn to smb_fname_str_do_log()
Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
c9b38eb79c
commit
b535f78897
@ -658,7 +658,7 @@ static void do_log(vfs_op_type op, bool success, vfs_handle_struct *handle,
|
||||
/**
|
||||
* Return a string using the do_log_ctx()
|
||||
*/
|
||||
static const char *smb_fname_str_do_log(const struct smb_filename *cwd,
|
||||
static const char *smb_fname_str_do_log(struct connection_struct *conn,
|
||||
const struct smb_filename *smb_fname)
|
||||
{
|
||||
char *fname = NULL;
|
||||
@ -680,11 +680,11 @@ static const char *smb_fname_str_do_log(const struct smb_filename *cwd,
|
||||
if (!ISDOT(smb_fname->base_name)) {
|
||||
abs_name = talloc_asprintf(do_log_ctx(),
|
||||
"%s/%s",
|
||||
cwd->base_name,
|
||||
conn->cwd_fname->base_name,
|
||||
smb_fname->base_name);
|
||||
} else {
|
||||
abs_name = talloc_strdup(do_log_ctx(),
|
||||
cwd->base_name);
|
||||
conn->cwd_fname->base_name);
|
||||
}
|
||||
if (abs_name == NULL) {
|
||||
return "";
|
||||
@ -705,7 +705,7 @@ static const char *smb_fname_str_do_log(const struct smb_filename *cwd,
|
||||
*/
|
||||
static const char *fsp_str_do_log(const struct files_struct *fsp)
|
||||
{
|
||||
return smb_fname_str_do_log(fsp->conn->cwd_fname, fsp->fsp_name);
|
||||
return smb_fname_str_do_log(fsp->conn, fsp->fsp_name);
|
||||
}
|
||||
|
||||
/* Implementation of vfs_ops. Pass everything on to the default
|
||||
@ -1044,7 +1044,7 @@ static int smb_full_audit_open(vfs_handle_struct *handle,
|
||||
|
||||
do_log(SMB_VFS_OP_OPEN, (result >= 0), handle, "%s|%s",
|
||||
((flags & O_WRONLY) || (flags & O_RDWR))?"w":"r",
|
||||
smb_fname_str_do_log(handle->conn->cwd_fname, smb_fname));
|
||||
smb_fname_str_do_log(handle->conn, smb_fname));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1119,7 +1119,7 @@ static NTSTATUS smb_full_audit_create_file(vfs_handle_struct *handle,
|
||||
"0x%x|%s|%s|%s", access_mask,
|
||||
create_options & FILE_DIRECTORY_FILE ? "dir" : "file",
|
||||
str_create_disposition,
|
||||
smb_fname_str_do_log(handle->conn->cwd_fname, smb_fname));
|
||||
smb_fname_str_do_log(handle->conn, smb_fname));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1358,8 +1358,8 @@ static int smb_full_audit_rename(vfs_handle_struct *handle,
|
||||
result = SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
|
||||
|
||||
do_log(SMB_VFS_OP_RENAME, (result >= 0), handle, "%s|%s",
|
||||
smb_fname_str_do_log(handle->conn->cwd_fname, smb_fname_src),
|
||||
smb_fname_str_do_log(handle->conn->cwd_fname, smb_fname_dst));
|
||||
smb_fname_str_do_log(handle->conn, smb_fname_src),
|
||||
smb_fname_str_do_log(handle->conn, smb_fname_dst));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1441,7 +1441,7 @@ static int smb_full_audit_stat(vfs_handle_struct *handle,
|
||||
result = SMB_VFS_NEXT_STAT(handle, smb_fname);
|
||||
|
||||
do_log(SMB_VFS_OP_STAT, (result >= 0), handle, "%s",
|
||||
smb_fname_str_do_log(handle->conn->cwd_fname, smb_fname));
|
||||
smb_fname_str_do_log(handle->conn, smb_fname));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1467,7 +1467,7 @@ static int smb_full_audit_lstat(vfs_handle_struct *handle,
|
||||
result = SMB_VFS_NEXT_LSTAT(handle, smb_fname);
|
||||
|
||||
do_log(SMB_VFS_OP_LSTAT, (result >= 0), handle, "%s",
|
||||
smb_fname_str_do_log(handle->conn->cwd_fname, smb_fname));
|
||||
smb_fname_str_do_log(handle->conn, smb_fname));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1493,7 +1493,7 @@ static int smb_full_audit_unlink(vfs_handle_struct *handle,
|
||||
result = SMB_VFS_NEXT_UNLINK(handle, smb_fname);
|
||||
|
||||
do_log(SMB_VFS_OP_UNLINK, (result >= 0), handle, "%s",
|
||||
smb_fname_str_do_log(handle->conn->cwd_fname, smb_fname));
|
||||
smb_fname_str_do_log(handle->conn, smb_fname));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -1629,7 +1629,7 @@ static int smb_full_audit_ntimes(vfs_handle_struct *handle,
|
||||
(result >= 0),
|
||||
handle,
|
||||
"%s|%s|%s|%s|%s",
|
||||
smb_fname_str_do_log(handle->conn->cwd_fname, smb_fname),
|
||||
smb_fname_str_do_log(handle->conn, smb_fname),
|
||||
create_time_str,
|
||||
atime_str,
|
||||
mtime_str,
|
||||
@ -2065,7 +2065,7 @@ static NTSTATUS smb_full_audit_get_compression(vfs_handle_struct *handle,
|
||||
do_log(SMB_VFS_OP_GET_COMPRESSION, NT_STATUS_IS_OK(result), handle,
|
||||
"%s",
|
||||
(fsp ? fsp_str_do_log(fsp) :
|
||||
smb_fname_str_do_log(handle->conn->cwd_fname, smb_fname)));
|
||||
smb_fname_str_do_log(handle->conn, smb_fname)));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -2096,7 +2096,7 @@ static NTSTATUS smb_full_audit_readdir_attr(struct vfs_handle_struct *handle,
|
||||
status = SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data);
|
||||
|
||||
do_log(SMB_VFS_OP_READDIR_ATTR, NT_STATUS_IS_OK(status), handle, "%s",
|
||||
smb_fname_str_do_log(handle->conn->cwd_fname, fname));
|
||||
smb_fname_str_do_log(handle->conn, fname));
|
||||
|
||||
return status;
|
||||
}
|
||||
@ -2116,7 +2116,7 @@ static NTSTATUS smb_full_audit_get_dos_attributes(
|
||||
NT_STATUS_IS_OK(status),
|
||||
handle,
|
||||
"%s",
|
||||
smb_fname_str_do_log(handle->conn->cwd_fname, smb_fname));
|
||||
smb_fname_str_do_log(handle->conn, smb_fname));
|
||||
|
||||
return status;
|
||||
}
|
||||
@ -2277,7 +2277,7 @@ static NTSTATUS smb_full_audit_set_dos_attributes(
|
||||
NT_STATUS_IS_OK(status),
|
||||
handle,
|
||||
"%s",
|
||||
smb_fname_str_do_log(handle->conn->cwd_fname, smb_fname));
|
||||
smb_fname_str_do_log(handle->conn, smb_fname));
|
||||
|
||||
return status;
|
||||
}
|
||||
@ -2330,7 +2330,7 @@ static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
|
||||
mem_ctx, ppdesc);
|
||||
|
||||
do_log(SMB_VFS_OP_GET_NT_ACL, NT_STATUS_IS_OK(result), handle,
|
||||
"%s", smb_fname_str_do_log(handle->conn->cwd_fname, smb_fname));
|
||||
"%s", smb_fname_str_do_log(handle->conn, smb_fname));
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -2377,7 +2377,7 @@ static NTSTATUS smb_full_audit_audit_file(struct vfs_handle_struct *handle,
|
||||
|
||||
do_log(SMB_VFS_OP_AUDIT_FILE, NT_STATUS_IS_OK(result), handle,
|
||||
"%s",
|
||||
smb_fname_str_do_log(handle->conn->cwd_fname, file));
|
||||
smb_fname_str_do_log(handle->conn, file));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user