From 34d0cb4f1707d8a16ca95c6db7ead79bae3e280c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 5 Jan 2009 12:58:23 +0100 Subject: Fix bug 6012: Add "get_real_filename" to full_audit Thanks to Hodur for testing! Volker --- source3/modules/vfs_full_audit.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'source3/modules/vfs_full_audit.c') diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 7970bf2644..3615c3978b 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -211,6 +211,11 @@ static NTSTATUS smb_full_audit_streaminfo(vfs_handle_struct *handle, TALLOC_CTX *mem_ctx, unsigned int *pnum_streams, struct stream_struct **pstreams); +static int smb_full_audit_get_real_filename(struct vfs_handle_struct *handle, + const char *path, + const char *name, + TALLOC_CTX *mem_ctx, + char **found_name); static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc); @@ -444,6 +449,8 @@ static vfs_op_tuple audit_op_tuples[] = { SMB_VFS_LAYER_LOGGER}, {SMB_VFS_OP(smb_full_audit_streaminfo), SMB_VFS_OP_STREAMINFO, SMB_VFS_LAYER_LOGGER}, + {SMB_VFS_OP(smb_full_audit_get_real_filename), SMB_VFS_OP_GET_REAL_FILENAME, + SMB_VFS_LAYER_LOGGER}, /* NT ACL operations. */ @@ -612,6 +619,7 @@ static struct { { SMB_VFS_OP_CHFLAGS, "chflags" }, { SMB_VFS_OP_FILE_ID_CREATE, "file_id_create" }, { SMB_VFS_OP_STREAMINFO, "streaminfo" }, + { SMB_VFS_OP_GET_REAL_FILENAME, "get_real_filename" }, { SMB_VFS_OP_FGET_NT_ACL, "fget_nt_acl" }, { SMB_VFS_OP_GET_NT_ACL, "get_nt_acl" }, { SMB_VFS_OP_FSET_NT_ACL, "fset_nt_acl" }, @@ -1615,6 +1623,23 @@ static NTSTATUS smb_full_audit_streaminfo(vfs_handle_struct *handle, return result; } +static int smb_full_audit_get_real_filename(struct vfs_handle_struct *handle, + const char *path, + const char *name, + TALLOC_CTX *mem_ctx, + char **found_name) +{ + int result; + + result = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx, + found_name); + + do_log(SMB_VFS_OP_GET_REAL_FILENAME, (result == 0), handle, + "%s/%s->%s", path, name, (result == 0) ? "" : *found_name); + + return result; +} + static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32 security_info, SEC_DESC **ppdesc) -- cgit From 6d4fd789f65ea770a33abfcba42665cf6a0efb10 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 5 Jan 2009 13:08:07 +0100 Subject: Add create_file to vfs_op_names --- source3/modules/vfs_full_audit.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source3/modules/vfs_full_audit.c') diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 3615c3978b..e4bda09130 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -583,6 +583,7 @@ static struct { { SMB_VFS_OP_RMDIR, "rmdir" }, { SMB_VFS_OP_CLOSEDIR, "closedir" }, { SMB_VFS_OP_OPEN, "open" }, + { SMB_VFS_OP_CREATE_FILE, "create_file" }, { SMB_VFS_OP_CLOSE, "close" }, { SMB_VFS_OP_READ, "read" }, { SMB_VFS_OP_PREAD, "pread" }, -- cgit From 3305fa27987d250fe963ae24672dbd8a5b746b7d Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 5 Jan 2009 13:32:53 +0100 Subject: Fix a bad memleak in vfs_full_audit --- source3/modules/vfs_full_audit.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source3/modules/vfs_full_audit.c') diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index e4bda09130..666dd59574 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -721,6 +721,7 @@ static int audit_syslog_priority(vfs_handle_struct *handle) static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn) { char *prefix = NULL; + char *result; prefix = talloc_strdup(ctx, lp_parm_const_string(SNUM(conn), "full_audit", @@ -728,7 +729,7 @@ static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn) if (!prefix) { return NULL; } - return talloc_sub_advanced(ctx, + result = talloc_sub_advanced(ctx, lp_servicename(SNUM(conn)), conn->server_info->unix_name, conn->connectpath, @@ -736,6 +737,8 @@ static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn) conn->server_info->sanitized_username, pdb_get_domain(conn->server_info->sam_account), prefix); + TALLOC_FREE(prefix); + return result; } static bool log_success(vfs_handle_struct *handle, vfs_op_type op) -- cgit From 21b7b000fb53ac3025d0038cc551a47f9d4a743b Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 5 Jan 2009 13:33:20 +0100 Subject: Use talloc_tos in vfs_full_audit.c:do_log --- source3/modules/vfs_full_audit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source3/modules/vfs_full_audit.c') diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 666dd59574..1d9983a753 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -852,14 +852,14 @@ static void do_log(vfs_op_type op, bool success, vfs_handle_struct *handle, fstr_sprintf(err_msg, "fail (%s)", strerror(errno)); va_start(ap, format); - op_msg = talloc_vasprintf(NULL, format, ap); + op_msg = talloc_vasprintf(talloc_tos(), format, ap); va_end(ap); if (!op_msg) { return; } - audit_pre = audit_prefix(NULL, handle->conn); + audit_pre = audit_prefix(talloc_tos(), handle->conn); syslog(audit_syslog_priority(handle), "%s|%s|%s|%s\n", audit_pre ? audit_pre : "", audit_opname(op), err_msg, op_msg); -- cgit