summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_time_audit.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2011-02-08 15:07:48 -0800
committerJeremy Allison <jra@samba.org>2011-02-09 00:55:22 +0100
commita674a56a97c78a44bf43f1c175d106fbe70c7485 (patch)
tree78d6bab766e79d4e66de86d94d972cc96bb2a245 /source3/modules/vfs_time_audit.c
parent224fc03cb56b0d76f6ad7f18dd0528d6b0e57fb1 (diff)
downloadsamba-a674a56a97c78a44bf43f1c175d106fbe70c7485.tar.gz
samba-a674a56a97c78a44bf43f1c175d106fbe70c7485.tar.bz2
samba-a674a56a97c78a44bf43f1c175d106fbe70c7485.zip
Add fdopendir to the VFS. We will use this to reuse a directory fd already open by NtCreateX.
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Wed Feb 9 00:55:22 CET 2011 on sn-devel-104
Diffstat (limited to 'source3/modules/vfs_time_audit.c')
-rw-r--r--source3/modules/vfs_time_audit.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index 136807f067..d692529a34 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -221,6 +221,26 @@ static SMB_STRUCT_DIR *smb_time_audit_opendir(vfs_handle_struct *handle,
return result;
}
+static SMB_STRUCT_DIR *smb_time_audit_fdopendir(vfs_handle_struct *handle,
+ files_struct *fsp,
+ const char *mask, uint32 attr)
+{
+ SMB_STRUCT_DIR *result;
+ struct timespec ts1,ts2;
+ double timediff;
+
+ clock_gettime_mono(&ts1);
+ result = SMB_VFS_NEXT_FDOPENDIR(handle, fsp, mask, attr);
+ clock_gettime_mono(&ts2);
+ timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
+
+ if (timediff > audit_timeout) {
+ smb_time_audit_log("fdopendir", timediff);
+ }
+
+ return result;
+}
+
static SMB_STRUCT_DIRENT *smb_time_audit_readdir(vfs_handle_struct *handle,
SMB_STRUCT_DIR *dirp,
SMB_STRUCT_STAT *sbuf)
@@ -2324,6 +2344,7 @@ static struct vfs_fn_pointers vfs_time_audit_fns = {
.statvfs = smb_time_audit_statvfs,
.fs_capabilities = smb_time_audit_fs_capabilities,
.opendir = smb_time_audit_opendir,
+ .fdopendir = smb_time_audit_fdopendir,
.readdir = smb_time_audit_readdir,
.seekdir = smb_time_audit_seekdir,
.telldir = smb_time_audit_telldir,