[PATCH] vfs_full_audit: ntimes: log a-, m-, c- and creation-time
Björn Baumbach
bb at sernet.de
Mon Oct 8 13:45:40 UTC 2018
Hi!
I've extended the logging of the ntimes call in the full_audit vfs
module. With this extensions the times are also logged.
As this changes the log output, I would add this information to the
WHATSNEW.
Best regards,
Björn
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
-------------- next part --------------
From e40e2f376ddea5e50b262839f9049273a8fb5976 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Baumbach?= <bb at sernet.de>
Date: Thu, 27 Sep 2018 10:32:37 +0200
Subject: [PATCH] vfs_full_audit: ntimes: log a-, m-, c- and creation-time
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Björn Baumbach <bb at sernet.de>
Reviewed-by: Ralph Boehme <slow at samba.org>
---
source3/modules/vfs_full_audit.c | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index e7ca89f9fbe..bae08102b0e 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -1600,11 +1600,42 @@ static int smb_full_audit_ntimes(vfs_handle_struct *handle,
struct smb_file_time *ft)
{
int result;
+ time_t create_time = convert_timespec_to_time_t(ft->create_time);
+ time_t atime = convert_timespec_to_time_t(ft->atime);
+ time_t mtime = convert_timespec_to_time_t(ft->mtime);
+ time_t ctime = convert_timespec_to_time_t(ft->ctime);
+ const char *create_time_str = "";
+ const char *atime_str = "";
+ const char *mtime_str = "";
+ const char *ctime_str = "";
+ TALLOC_CTX *frame = talloc_stackframe();
result = SMB_VFS_NEXT_NTIMES(handle, smb_fname, ft);
- do_log(SMB_VFS_OP_NTIMES, (result >= 0), handle, "%s",
- smb_fname_str_do_log(handle->conn->cwd_fname, smb_fname));
+ if (create_time > 0) {
+ create_time_str = timestring(frame, create_time);
+ }
+ if (atime > 0) {
+ atime_str = timestring(frame, atime);
+ }
+ if (mtime > 0) {
+ mtime_str = timestring(frame, mtime);
+ }
+ if (ctime > 0) {
+ ctime_str = timestring(frame, ctime);
+ }
+
+ do_log(SMB_VFS_OP_NTIMES,
+ (result >= 0),
+ handle,
+ "%s|%s|%s|%s|%s",
+ smb_fname_str_do_log(handle->conn->cwd_fname, smb_fname),
+ create_time_str,
+ atime_str,
+ mtime_str,
+ ctime_str);
+
+ TALLOC_FREE(frame);
return result;
}
--
2.16.4
More information about the samba-technical
mailing list