NTSTATUS result;
struct timespec ts1,ts2;
double timediff;
+ struct smb_filename *full_fname = NULL;
+
+ full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dirfsp,
+ smb_fname);
+ if (full_fname == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
clock_gettime_mono(&ts1);
result = SMB_VFS_NEXT_CREATE_DFS_PATHAT(handle,
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log("get_dfs_referrals", timediff);
+ smb_time_audit_log_smb_fname("create_dfs_pathat",
+ timediff,
+ full_fname);
}
-
+ TALLOC_FREE(full_fname);
return result;
}
static NTSTATUS smb_time_audit_read_dfs_pathat(struct vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx,
struct files_struct *dirfsp,
- const struct smb_filename *smb_fname,
+ struct smb_filename *smb_fname,
struct referral **ppreflist,
size_t *preferral_count)
{
NTSTATUS result;
struct timespec ts1,ts2;
double timediff;
+ struct smb_filename *full_fname = NULL;
+
+ full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dirfsp,
+ smb_fname);
+ if (full_fname == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
clock_gettime_mono(&ts1);
result = SMB_VFS_NEXT_READ_DFS_PATHAT(handle,
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log("read_dfs_pathat", timediff);
+ smb_time_audit_log_smb_fname("read_dfs_pathat",
+ timediff,
+ full_fname);
}
+ TALLOC_FREE(full_fname);
return result;
}
}
static struct dirent *smb_time_audit_readdir(vfs_handle_struct *handle,
- DIR *dirp,
- SMB_STRUCT_STAT *sbuf)
+ struct files_struct *dirfsp,
+ DIR *dirp)
{
struct dirent *result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_READDIR(handle, dirp, sbuf);
+ result = SMB_VFS_NEXT_READDIR(handle, dirfsp, dirp);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
return result;
}
-static void smb_time_audit_seekdir(vfs_handle_struct *handle,
- DIR *dirp, long offset)
-{
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- SMB_VFS_NEXT_SEEKDIR(handle, dirp, offset);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log("seekdir", timediff);
- }
-
-}
-
-static long smb_time_audit_telldir(vfs_handle_struct *handle,
- DIR *dirp)
-{
- long result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_TELLDIR(handle, dirp);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log("telldir", timediff);
- }
-
- return result;
-}
-
static void smb_time_audit_rewinddir(vfs_handle_struct *handle,
DIR *dirp)
{
const struct smb_filename *smb_fname,
mode_t mode)
{
+ struct smb_filename *full_fname = NULL;
int result;
struct timespec ts1,ts2;
double timediff;
+ full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dirfsp,
+ smb_fname);
+ if (full_fname == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+
clock_gettime_mono(&ts1);
result = SMB_VFS_NEXT_MKDIRAT(handle,
dirfsp,
if (timediff > audit_timeout) {
smb_time_audit_log_smb_fname("mkdirat",
timediff,
- smb_fname);
+ full_fname);
}
+ TALLOC_FREE(full_fname);
+
return result;
}
return result;
}
-static int smb_time_audit_open(vfs_handle_struct *handle,
- struct smb_filename *fname,
- files_struct *fsp,
- int flags, mode_t mode)
+static int smb_time_audit_openat(vfs_handle_struct *handle,
+ const struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname,
+ struct files_struct *fsp,
+ const struct vfs_open_how *how)
{
int result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_OPEN(handle, fname, fsp, flags, mode);
+ result = SMB_VFS_NEXT_OPENAT(handle,
+ dirfsp,
+ smb_fname,
+ fsp,
+ how);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_fsp("open", timediff, fsp);
+ smb_time_audit_log_fsp("openat", timediff, fsp);
}
return result;
static NTSTATUS smb_time_audit_create_file(vfs_handle_struct *handle,
struct smb_request *req,
+ struct files_struct *dirfsp,
struct smb_filename *fname,
uint32_t access_mask,
uint32_t share_access,
result = SMB_VFS_NEXT_CREATE_FILE(
handle, /* handle */
req, /* req */
+ dirfsp, /* dirfsp */
fname, /* fname */
access_mask, /* access_mask */
share_access, /* share_access */
files_struct *srcfsp,
const struct smb_filename *oldname,
files_struct *dstfsp,
- const struct smb_filename *newname)
+ const struct smb_filename *newname,
+ const struct vfs_rename_how *how)
{
int result;
struct timespec ts1,ts2;
double timediff;
+ struct smb_filename *new_full_fname = NULL;
+ new_full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dstfsp,
+ newname);
+ if (new_full_fname == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
clock_gettime_mono(&ts1);
result = SMB_VFS_NEXT_RENAMEAT(handle,
srcfsp,
oldname,
dstfsp,
- newname);
+ newname,
+ how);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_smb_fname("renameat", timediff, newname);
+ smb_time_audit_log_smb_fname("renameat",
+ timediff,
+ new_full_fname);
}
+ TALLOC_FREE(new_full_fname);
return result;
}
return result;
}
-static uint64_t smb_time_audit_get_alloc_size(vfs_handle_struct *handle,
- files_struct *fsp,
- const SMB_STRUCT_STAT *sbuf)
+static int smb_time_audit_fstatat(
+ struct vfs_handle_struct *handle,
+ const struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname,
+ SMB_STRUCT_STAT *sbuf,
+ int flags)
{
- uint64_t result;
+ int result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
+ result = SMB_VFS_NEXT_FSTATAT(handle, dirfsp, smb_fname, sbuf, flags);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_fsp("get_alloc_size", timediff, fsp);
+ smb_time_audit_log_smb_fname("fstatat", timediff, smb_fname);
}
return result;
}
-static int smb_time_audit_unlinkat(vfs_handle_struct *handle,
- struct files_struct *dirfsp,
- const struct smb_filename *path,
- int flags)
+static uint64_t smb_time_audit_get_alloc_size(vfs_handle_struct *handle,
+ files_struct *fsp,
+ const SMB_STRUCT_STAT *sbuf)
{
- int result;
+ uint64_t result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_UNLINKAT(handle,
- dirfsp,
- path,
- flags);
+ result = SMB_VFS_NEXT_GET_ALLOC_SIZE(handle, fsp, sbuf);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_smb_fname("unlinkat", timediff, path);
+ smb_time_audit_log_fsp("get_alloc_size", timediff, fsp);
}
return result;
}
-static int smb_time_audit_chmod(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- mode_t mode)
+static int smb_time_audit_unlinkat(vfs_handle_struct *handle,
+ struct files_struct *dirfsp,
+ const struct smb_filename *path,
+ int flags)
{
+ struct smb_filename *full_fname = NULL;
int result;
struct timespec ts1,ts2;
double timediff;
+ full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dirfsp,
+ path);
+ if (full_fname == NULL) {
+ return -1;
+ }
+
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
+ result = SMB_VFS_NEXT_UNLINKAT(handle,
+ dirfsp,
+ path,
+ flags);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_fname("chmod",
- timediff,
- smb_fname->base_name);
+ smb_time_audit_log_smb_fname("unlinkat", timediff, full_fname);
}
+ TALLOC_FREE(full_fname);
return result;
}
return result;
}
-static int smb_time_audit_ntimes(vfs_handle_struct *handle,
- const struct smb_filename *path,
- struct smb_file_time *ft)
+static int smb_time_audit_fntimes(vfs_handle_struct *handle,
+ files_struct *fsp,
+ struct smb_file_time *ft)
{
int result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_NTIMES(handle, path, ft);
+ result = SMB_VFS_NEXT_FNTIMES(handle, fsp, ft);
clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
+ timediff = nsec_time_diff(&ts2, &ts1) * 1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_smb_fname("ntimes", timediff, path);
+ smb_time_audit_log_fsp("fntimes", timediff, fsp);
}
return result;
return result;
}
-static int smb_time_audit_kernel_flock(struct vfs_handle_struct *handle,
- struct files_struct *fsp,
- uint32_t share_access,
- uint32_t access_mask)
+static int smb_time_audit_filesystem_sharemode(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ uint32_t share_access,
+ uint32_t access_mask)
{
int result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_KERNEL_FLOCK(handle, fsp, share_access,
- access_mask);
+ result = SMB_VFS_NEXT_FILESYSTEM_SHAREMODE(handle,
+ fsp,
+ share_access,
+ access_mask);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_fsp("kernel_flock", timediff, fsp);
+ smb_time_audit_log_fsp("filesystem_sharemode", timediff, fsp);
}
return result;
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_fsp("kernel_flock", timediff, fsp);
+ smb_time_audit_log_fsp("fcntl", timediff, fsp);
}
return result;
struct files_struct *dirfsp,
const struct smb_filename *new_smb_fname)
{
+ struct smb_filename *full_fname = NULL;
int result;
struct timespec ts1,ts2;
double timediff;
+ full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dirfsp,
+ new_smb_fname);
+ if (full_fname == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+
clock_gettime_mono(&ts1);
result = SMB_VFS_NEXT_SYMLINKAT(handle,
link_contents,
if (timediff > audit_timeout) {
smb_time_audit_log_fname("symlinkat", timediff,
- new_smb_fname->base_name);
+ full_fname->base_name);
}
+ TALLOC_FREE(full_fname);
return result;
}
static int smb_time_audit_readlinkat(vfs_handle_struct *handle,
- files_struct *dirfsp,
+ const struct files_struct *dirfsp,
const struct smb_filename *smb_fname,
char *buf,
size_t bufsiz)
{
+ struct smb_filename *full_fname = NULL;
int result;
struct timespec ts1,ts2;
double timediff;
+ full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dirfsp,
+ smb_fname);
+ if (full_fname == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+
clock_gettime_mono(&ts1);
result = SMB_VFS_NEXT_READLINKAT(handle,
dirfsp,
if (timediff > audit_timeout) {
smb_time_audit_log_fname("readlinkat", timediff,
- smb_fname->base_name);
+ full_fname->base_name);
}
+ TALLOC_FREE(full_fname);
return result;
}
const struct smb_filename *new_smb_fname,
int flags)
{
+ struct smb_filename *new_full_fname = NULL;
int result;
struct timespec ts1,ts2;
double timediff;
+ new_full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dstfsp,
+ new_smb_fname);
+ if (new_full_fname == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+
clock_gettime_mono(&ts1);
result = SMB_VFS_NEXT_LINKAT(handle,
srcfsp,
if (timediff > audit_timeout) {
smb_time_audit_log_fname("linkat", timediff,
- new_smb_fname->base_name);
+ new_full_fname->base_name);
}
+ TALLOC_FREE(new_full_fname);
return result;
}
mode_t mode,
SMB_DEV_T dev)
{
+ struct smb_filename *full_fname = NULL;
int result;
struct timespec ts1,ts2;
double timediff;
+ full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+ dirfsp,
+ smb_fname);
+ if (full_fname == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+
clock_gettime_mono(&ts1);
result = SMB_VFS_NEXT_MKNODAT(handle,
dirfsp,
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_smb_fname("mknodat", timediff, smb_fname);
+ smb_time_audit_log_smb_fname("mknodat", timediff, full_fname);
}
+ TALLOC_FREE(full_fname);
return result;
}
return result_fname;
}
-static int smb_time_audit_chflags(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
+static int smb_time_audit_fchflags(vfs_handle_struct *handle,
+ struct files_struct *fsp,
unsigned int flags)
{
int result;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_CHFLAGS(handle, smb_fname, flags);
+ result = SMB_VFS_NEXT_FCHFLAGS(handle, fsp, flags);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_smb_fname("chflags", timediff, smb_fname);
+ smb_time_audit_log_smb_fname("chflags",
+ timediff,
+ fsp->fsp_name);
}
return result;
return result;
}
-static NTSTATUS smb_time_audit_streaminfo(vfs_handle_struct *handle,
+static NTSTATUS smb_time_audit_fstreaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
- const struct smb_filename *smb_fname,
TALLOC_CTX *mem_ctx,
unsigned int *pnum_streams,
struct stream_struct **pstreams)
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx,
+ result = SMB_VFS_NEXT_FSTREAMINFO(handle, fsp, mem_ctx,
pnum_streams, pstreams);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_fsp("streaminfo", timediff, fsp);
+ smb_time_audit_log_fsp("fstreaminfo", timediff, fsp);
}
return result;
}
-static int smb_time_audit_get_real_filename(struct vfs_handle_struct *handle,
- const struct smb_filename *path,
- const char *name,
- TALLOC_CTX *mem_ctx,
- char **found_name)
+static NTSTATUS smb_time_audit_get_real_filename_at(
+ struct vfs_handle_struct *handle,
+ struct files_struct *dirfsp,
+ const char *name,
+ TALLOC_CTX *mem_ctx,
+ char **found_name)
{
- int result;
+ NTSTATUS result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx,
- found_name);
+ result = SMB_VFS_NEXT_GET_REAL_FILENAME_AT(
+ handle, dirfsp, name, mem_ctx, found_name);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_fname("get_real_filename",
- timediff, path->base_name);
+ smb_time_audit_log_fname("get_real_filename_at",
+ timediff,
+ fsp_str_dbg(dirfsp));
}
return result;
}
-static const char *smb_time_audit_connectpath(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname)
+static const char *smb_time_audit_connectpath(
+ vfs_handle_struct *handle,
+ const struct files_struct *dirfsp,
+ const struct smb_filename *smb_fname)
{
const char *result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_CONNECTPATH(handle, smb_fname);
+ result = SMB_VFS_NEXT_CONNECTPATH(handle, dirfsp, smb_fname);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
return result;
}
+static NTSTATUS smb_time_audit_parent_pathname(struct vfs_handle_struct *handle,
+ TALLOC_CTX *mem_ctx,
+ const struct smb_filename *smb_fname_in,
+ struct smb_filename **parent_dir_out,
+ struct smb_filename **atname_out)
+{
+ NTSTATUS result;
+ struct timespec ts1,ts2;
+ double timediff;
+
+ clock_gettime_mono(&ts1);
+ result = SMB_VFS_NEXT_PARENT_PATHNAME(handle,
+ mem_ctx,
+ smb_fname_in,
+ parent_dir_out,
+ atname_out);
+ clock_gettime_mono(&ts2);
+ timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
+
+ if (timediff > audit_timeout) {
+ smb_time_audit_log_fname("parent_pathname",
+ timediff,
+ smb_fname_in->base_name);
+ }
+
+ return result;
+}
+
static NTSTATUS smb_time_audit_fsctl(struct vfs_handle_struct *handle,
struct files_struct *fsp,
TALLOC_CTX *ctx,
return result;
}
-static NTSTATUS smb_time_get_dos_attributes(struct vfs_handle_struct *handle,
- struct smb_filename *smb_fname,
- uint32_t *dosmode)
-{
- NTSTATUS result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_GET_DOS_ATTRIBUTES(handle,
- smb_fname,
- dosmode);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log_fname("get_dos_attributes",
- timediff,
- smb_fname->base_name);
- }
-
- return result;
-}
-
struct smb_time_audit_get_dos_attributes_state {
struct vfs_aio_state aio_state;
files_struct *dir_fsp;
return result;
}
-static NTSTATUS smb_time_set_dos_attributes(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- uint32_t dosmode)
-{
- NTSTATUS result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SET_DOS_ATTRIBUTES(handle,
- smb_fname,
- dosmode);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log_fname("set_dos_attributes",
- timediff,
- smb_fname->base_name);
- }
-
- return result;
-}
-
static NTSTATUS smb_time_fset_dos_attributes(struct vfs_handle_struct *handle,
struct files_struct *fsp,
uint32_t dosmode)
struct time_audit_offload_read_state {
struct vfs_handle_struct *handle;
struct timespec ts_send;
+ uint32_t flags;
+ uint64_t xferlen;
DATA_BLOB token_blob;
};
status = SMB_VFS_NEXT_OFFLOAD_READ_RECV(subreq,
state->handle,
state,
+ &state->flags,
+ &state->xferlen,
&state->token_blob);
TALLOC_FREE(subreq);
if (tevent_req_nterror(req, status)) {
struct tevent_req *req,
struct vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx,
+ uint32_t *flags,
+ uint64_t *xferlen,
DATA_BLOB *token_blob)
{
struct time_audit_offload_read_state *state = tevent_req_data(
return status;
}
+ *flags = state->flags;
+ *xferlen = state->xferlen;
token_blob->length = state->token_blob.length;
token_blob->data = talloc_move(mem_ctx, &state->token_blob.data);
return NT_STATUS_OK;
}
-static NTSTATUS smb_time_audit_get_compression(vfs_handle_struct *handle,
+static NTSTATUS smb_time_audit_fget_compression(vfs_handle_struct *handle,
TALLOC_CTX *mem_ctx,
struct files_struct *fsp,
- struct smb_filename *smb_fname,
uint16_t *_compression_fmt)
{
NTSTATUS result;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_GET_COMPRESSION(handle, mem_ctx, fsp, smb_fname,
+ result = SMB_VFS_NEXT_FGET_COMPRESSION(handle, mem_ctx, fsp,
_compression_fmt);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- if (fsp != NULL) {
- smb_time_audit_log_fsp("get_compression",
- timediff, fsp);
- } else {
- smb_time_audit_log_smb_fname("get_compression",
- timediff, smb_fname);
- }
+ smb_time_audit_log_fsp("get_compression",
+ timediff, fsp);
}
return result;
return result;
}
-static NTSTATUS smb_time_audit_readdir_attr(struct vfs_handle_struct *handle,
- const struct smb_filename *fname,
- TALLOC_CTX *mem_ctx,
- struct readdir_attr_data **pattr_data)
+static NTSTATUS smb_time_audit_freaddir_attr(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ TALLOC_CTX *mem_ctx,
+ struct readdir_attr_data **pattr_data)
{
NTSTATUS status;
- struct timespec ts1,ts2;
+ struct timespec ts1, ts2;
double timediff;
clock_gettime_mono(&ts1);
- status = SMB_VFS_NEXT_READDIR_ATTR(handle, fname, mem_ctx, pattr_data);
+ status = SMB_VFS_NEXT_FREADDIR_ATTR(handle, fsp, mem_ctx, pattr_data);
clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
+ timediff = nsec_time_diff(&ts2, &ts1) * 1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_smb_fname("readdir_attr", timediff, fname);
+ smb_time_audit_log_fsp("freaddir_attr", timediff, fsp);
}
return status;
return result;
}
-static NTSTATUS smb_time_audit_get_nt_acl_at(vfs_handle_struct *handle,
- struct files_struct *dirfsp,
- const struct smb_filename *smb_fname,
- uint32_t security_info,
- TALLOC_CTX *mem_ctx,
- struct security_descriptor **ppdesc)
-{
- NTSTATUS result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_GET_NT_ACL_AT(handle,
- dirfsp,
- smb_fname,
- security_info,
- mem_ctx,
- ppdesc);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log_fname("get_nt_acl",
- timediff,
- smb_fname->base_name);
- }
-
- return result;
-}
-
static NTSTATUS smb_time_audit_fset_nt_acl(vfs_handle_struct *handle,
files_struct *fsp,
uint32_t security_info_sent,
return result;
}
-static SMB_ACL_T smb_time_audit_sys_acl_get_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T type,
- TALLOC_CTX *mem_ctx)
-{
- SMB_ACL_T result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SYS_ACL_GET_FILE(handle, smb_fname,
- type, mem_ctx);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log_fname("sys_acl_get_file", timediff,
- smb_fname->base_name);
- }
-
- return result;
-}
-
static SMB_ACL_T smb_time_audit_sys_acl_get_fd(vfs_handle_struct *handle,
files_struct *fsp,
+ SMB_ACL_TYPE_T type,
TALLOC_CTX *mem_ctx)
{
SMB_ACL_T result;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, mem_ctx);
+ result = SMB_VFS_NEXT_SYS_ACL_GET_FD(handle, fsp, type, mem_ctx);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
return result;
}
-
-static int smb_time_audit_sys_acl_blob_get_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- TALLOC_CTX *mem_ctx,
- char **blob_description,
- DATA_BLOB *blob)
-{
- int result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SYS_ACL_BLOB_GET_FILE(handle, smb_fname,
- mem_ctx, blob_description, blob);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log("sys_acl_blob_get_file", timediff);
- }
-
- return result;
-}
-
static int smb_time_audit_sys_acl_blob_get_fd(vfs_handle_struct *handle,
files_struct *fsp,
TALLOC_CTX *mem_ctx,
return result;
}
-static int smb_time_audit_sys_acl_set_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- SMB_ACL_TYPE_T acltype,
- SMB_ACL_T theacl)
-{
- int result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SYS_ACL_SET_FILE(handle, smb_fname, acltype,
- theacl);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log_fname("sys_acl_set_file", timediff,
- smb_fname->base_name);
- }
-
- return result;
-}
-
static int smb_time_audit_sys_acl_set_fd(vfs_handle_struct *handle,
files_struct *fsp,
+ SMB_ACL_TYPE_T type,
SMB_ACL_T theacl)
{
int result;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, theacl);
+ result = SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
return result;
}
-static int smb_time_audit_sys_acl_delete_def_file(vfs_handle_struct *handle,
- const struct smb_filename *smb_fname)
+static int smb_time_audit_sys_acl_delete_def_fd(vfs_handle_struct *handle,
+ files_struct *fsp)
{
int result;
struct timespec ts1,ts2;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FILE(handle, smb_fname);
+ result = SMB_VFS_NEXT_SYS_ACL_DELETE_DEF_FD(handle, fsp);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
if (timediff > audit_timeout) {
- smb_time_audit_log_fname("sys_acl_delete_def_file", timediff,
- smb_fname->base_name);
- }
-
- return result;
-}
-
-static ssize_t smb_time_audit_getxattr(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- const char *name,
- void *value,
- size_t size)
-{
- ssize_t result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_GETXATTR(handle, smb_fname, name, value, size);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log_fname("getxattr", timediff,
- smb_fname->base_name);
+ smb_time_audit_log_fsp("sys_acl_delete_def_fd", timediff, fsp);
}
return result;
return result;
}
-static ssize_t smb_time_audit_listxattr(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- char *list,
- size_t size)
-{
- ssize_t result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_LISTXATTR(handle, smb_fname, list, size);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log_fname("listxattr", timediff,
- smb_fname->base_name);
- }
-
- return result;
-}
-
static ssize_t smb_time_audit_flistxattr(struct vfs_handle_struct *handle,
struct files_struct *fsp, char *list,
size_t size)
return result;
}
-static int smb_time_audit_removexattr(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- const char *name)
-{
- int result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_REMOVEXATTR(handle, smb_fname, name);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log_fname("removexattr", timediff,
- smb_fname->base_name);
- }
-
- return result;
-}
-
static int smb_time_audit_fremovexattr(struct vfs_handle_struct *handle,
struct files_struct *fsp,
const char *name)
return result;
}
-static int smb_time_audit_setxattr(struct vfs_handle_struct *handle,
- const struct smb_filename *smb_fname,
- const char *name,
- const void *value,
- size_t size,
- int flags)
-{
- int result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SETXATTR(handle, smb_fname, name, value, size,
- flags);
- clock_gettime_mono(&ts2);
- timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
- if (timediff > audit_timeout) {
- smb_time_audit_log_fname("setxattr", timediff,
- smb_fname->base_name);
- }
-
- return result;
-}
-
static int smb_time_audit_fsetxattr(struct vfs_handle_struct *handle,
struct files_struct *fsp, const char *name,
const void *value, size_t size, int flags)
.read_dfs_pathat_fn = smb_time_audit_read_dfs_pathat,
.fdopendir_fn = smb_time_audit_fdopendir,
.readdir_fn = smb_time_audit_readdir,
- .seekdir_fn = smb_time_audit_seekdir,
- .telldir_fn = smb_time_audit_telldir,
.rewind_dir_fn = smb_time_audit_rewinddir,
.mkdirat_fn = smb_time_audit_mkdirat,
.closedir_fn = smb_time_audit_closedir,
- .open_fn = smb_time_audit_open,
+ .openat_fn = smb_time_audit_openat,
.create_file_fn = smb_time_audit_create_file,
.close_fn = smb_time_audit_close,
.pread_fn = smb_time_audit_pread,
.stat_fn = smb_time_audit_stat,
.fstat_fn = smb_time_audit_fstat,
.lstat_fn = smb_time_audit_lstat,
+ .fstatat_fn = smb_time_audit_fstatat,
.get_alloc_size_fn = smb_time_audit_get_alloc_size,
.unlinkat_fn = smb_time_audit_unlinkat,
- .chmod_fn = smb_time_audit_chmod,
.fchmod_fn = smb_time_audit_fchmod,
.fchown_fn = smb_time_audit_fchown,
.lchown_fn = smb_time_audit_lchown,
.chdir_fn = smb_time_audit_chdir,
.getwd_fn = smb_time_audit_getwd,
- .ntimes_fn = smb_time_audit_ntimes,
+ .fntimes_fn = smb_time_audit_fntimes,
.ftruncate_fn = smb_time_audit_ftruncate,
.fallocate_fn = smb_time_audit_fallocate,
.lock_fn = smb_time_audit_lock,
- .kernel_flock_fn = smb_time_audit_kernel_flock,
+ .filesystem_sharemode_fn = smb_time_audit_filesystem_sharemode,
.fcntl_fn = smb_time_audit_fcntl,
.linux_setlease_fn = smb_time_audit_linux_setlease,
.getlock_fn = smb_time_audit_getlock,
.linkat_fn = smb_time_audit_linkat,
.mknodat_fn = smb_time_audit_mknodat,
.realpath_fn = smb_time_audit_realpath,
- .chflags_fn = smb_time_audit_chflags,
+ .fchflags_fn = smb_time_audit_fchflags,
.file_id_create_fn = smb_time_audit_file_id_create,
.fs_file_id_fn = smb_time_audit_fs_file_id,
.offload_read_send_fn = smb_time_audit_offload_read_send,
.offload_read_recv_fn = smb_time_audit_offload_read_recv,
.offload_write_send_fn = smb_time_audit_offload_write_send,
.offload_write_recv_fn = smb_time_audit_offload_write_recv,
- .get_compression_fn = smb_time_audit_get_compression,
+ .fget_compression_fn = smb_time_audit_fget_compression,
.set_compression_fn = smb_time_audit_set_compression,
.snap_check_path_fn = smb_time_audit_snap_check_path,
.snap_create_fn = smb_time_audit_snap_create,
.snap_delete_fn = smb_time_audit_snap_delete,
- .streaminfo_fn = smb_time_audit_streaminfo,
- .get_real_filename_fn = smb_time_audit_get_real_filename,
+ .fstreaminfo_fn = smb_time_audit_fstreaminfo,
+ .get_real_filename_at_fn = smb_time_audit_get_real_filename_at,
.connectpath_fn = smb_time_audit_connectpath,
.brl_lock_windows_fn = smb_time_audit_brl_lock_windows,
.brl_unlock_windows_fn = smb_time_audit_brl_unlock_windows,
.strict_lock_check_fn = smb_time_audit_strict_lock_check,
.translate_name_fn = smb_time_audit_translate_name,
+ .parent_pathname_fn = smb_time_audit_parent_pathname,
.fsctl_fn = smb_time_audit_fsctl,
- .get_dos_attributes_fn = smb_time_get_dos_attributes,
.get_dos_attributes_send_fn = smb_time_audit_get_dos_attributes_send,
.get_dos_attributes_recv_fn = smb_time_audit_get_dos_attributes_recv,
.fget_dos_attributes_fn = smb_time_fget_dos_attributes,
- .set_dos_attributes_fn = smb_time_set_dos_attributes,
.fset_dos_attributes_fn = smb_time_fset_dos_attributes,
.fget_nt_acl_fn = smb_time_audit_fget_nt_acl,
- .get_nt_acl_at_fn = smb_time_audit_get_nt_acl_at,
.fset_nt_acl_fn = smb_time_audit_fset_nt_acl,
.audit_file_fn = smb_time_audit_audit_file,
- .sys_acl_get_file_fn = smb_time_audit_sys_acl_get_file,
.sys_acl_get_fd_fn = smb_time_audit_sys_acl_get_fd,
- .sys_acl_blob_get_file_fn = smb_time_audit_sys_acl_blob_get_file,
.sys_acl_blob_get_fd_fn = smb_time_audit_sys_acl_blob_get_fd,
- .sys_acl_set_file_fn = smb_time_audit_sys_acl_set_file,
.sys_acl_set_fd_fn = smb_time_audit_sys_acl_set_fd,
- .sys_acl_delete_def_file_fn = smb_time_audit_sys_acl_delete_def_file,
- .getxattr_fn = smb_time_audit_getxattr,
+ .sys_acl_delete_def_fd_fn = smb_time_audit_sys_acl_delete_def_fd,
.getxattrat_send_fn = smb_time_audit_getxattrat_send,
.getxattrat_recv_fn = smb_time_audit_getxattrat_recv,
.fgetxattr_fn = smb_time_audit_fgetxattr,
- .listxattr_fn = smb_time_audit_listxattr,
.flistxattr_fn = smb_time_audit_flistxattr,
- .removexattr_fn = smb_time_audit_removexattr,
.fremovexattr_fn = smb_time_audit_fremovexattr,
- .setxattr_fn = smb_time_audit_setxattr,
.fsetxattr_fn = smb_time_audit_fsetxattr,
.aio_force_fn = smb_time_audit_aio_force,
.durable_cookie_fn = smb_time_audit_durable_cookie,
.durable_disconnect_fn = smb_time_audit_durable_disconnect,
.durable_reconnect_fn = smb_time_audit_durable_reconnect,
- .readdir_attr_fn = smb_time_audit_readdir_attr,
+ .freaddir_attr_fn = smb_time_audit_freaddir_attr,
};