SMB_VFS_OP_GET_SHADOW_COPY_DATA,
SMB_VFS_OP_STATVFS,
SMB_VFS_OP_FS_CAPABILITIES,
+ SMB_VFS_OP_SNAP_CHECK_PATH,
+ SMB_VFS_OP_SNAP_CREATE,
+ SMB_VFS_OP_SNAP_DELETE,
/* Directory operations */
SMB_VFS_OP_LINK,
SMB_VFS_OP_MKNOD,
SMB_VFS_OP_REALPATH,
- SMB_VFS_OP_NOTIFY_WATCH,
SMB_VFS_OP_CHFLAGS,
SMB_VFS_OP_FILE_ID_CREATE,
SMB_VFS_OP_STREAMINFO,
SMB_VFS_OP_COPY_CHUNK_RECV,
SMB_VFS_OP_GET_COMPRESSION,
SMB_VFS_OP_SET_COMPRESSION,
+ SMB_VFS_OP_READDIR_ATTR,
/* NT ACL operations. */
{ SMB_VFS_OP_GET_SHADOW_COPY_DATA, "get_shadow_copy_data" },
{ SMB_VFS_OP_STATVFS, "statvfs" },
{ SMB_VFS_OP_FS_CAPABILITIES, "fs_capabilities" },
+ { SMB_VFS_OP_SNAP_CHECK_PATH, "snap_check_path" },
+ { SMB_VFS_OP_SNAP_CREATE, "snap_create" },
+ { SMB_VFS_OP_SNAP_DELETE, "snap_delete" },
{ SMB_VFS_OP_OPENDIR, "opendir" },
{ SMB_VFS_OP_FDOPENDIR, "fdopendir" },
{ SMB_VFS_OP_READDIR, "readdir" },
{ SMB_VFS_OP_LINK, "link" },
{ SMB_VFS_OP_MKNOD, "mknod" },
{ SMB_VFS_OP_REALPATH, "realpath" },
- { SMB_VFS_OP_NOTIFY_WATCH, "notify_watch" },
{ SMB_VFS_OP_CHFLAGS, "chflags" },
{ SMB_VFS_OP_FILE_ID_CREATE, "file_id_create" },
{ SMB_VFS_OP_STREAMINFO, "streaminfo" },
{ SMB_VFS_OP_COPY_CHUNK_RECV, "copy_chunk_recv" },
{ SMB_VFS_OP_GET_COMPRESSION, "get_compression" },
{ SMB_VFS_OP_SET_COMPRESSION, "set_compression" },
+ { SMB_VFS_OP_READDIR_ATTR, "readdir_attr" },
{ 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" },
}
static uint64_t smb_full_audit_disk_free(vfs_handle_struct *handle,
- const char *path,
- bool small_query, uint64_t *bsize,
+ const char *path, uint64_t *bsize,
uint64_t *dfree, uint64_t *dsize)
{
uint64_t result;
- result = SMB_VFS_NEXT_DISK_FREE(handle, path, small_query, bsize,
- dfree, dsize);
+ result = SMB_VFS_NEXT_DISK_FREE(handle, path, bsize, dfree, dsize);
/* Don't have a reasonable notion of failure here */
}
static int smb_full_audit_get_quota(struct vfs_handle_struct *handle,
- enum SMB_QUOTA_TYPE qtype, unid_t id,
- SMB_DISK_QUOTA *qt)
+ const char *path, enum SMB_QUOTA_TYPE qtype,
+ unid_t id, SMB_DISK_QUOTA *qt)
{
int result;
- result = SMB_VFS_NEXT_GET_QUOTA(handle, qtype, id, qt);
+ result = SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, qt);
- do_log(SMB_VFS_OP_GET_QUOTA, (result >= 0), handle, "");
+ do_log(SMB_VFS_OP_GET_QUOTA, (result >= 0), handle, "%s", path);
return result;
}
-
static int smb_full_audit_set_quota(struct vfs_handle_struct *handle,
enum SMB_QUOTA_TYPE qtype, unid_t id,
SMB_DISK_QUOTA *qt)
return result;
}
+static NTSTATUS smb_full_audit_snap_check_path(struct vfs_handle_struct *handle,
+ TALLOC_CTX *mem_ctx,
+ const char *service_path,
+ char **base_volume)
+{
+ NTSTATUS status;
+
+ status = SMB_VFS_NEXT_SNAP_CHECK_PATH(handle, mem_ctx, service_path,
+ base_volume);
+ do_log(SMB_VFS_OP_SNAP_CHECK_PATH, NT_STATUS_IS_OK(status),
+ handle, "");
+
+ return status;
+}
+
+static NTSTATUS smb_full_audit_snap_create(struct vfs_handle_struct *handle,
+ TALLOC_CTX *mem_ctx,
+ const char *base_volume,
+ time_t *tstamp,
+ bool rw,
+ char **base_path,
+ char **snap_path)
+{
+ NTSTATUS status;
+
+ status = SMB_VFS_NEXT_SNAP_CREATE(handle, mem_ctx, base_volume, tstamp,
+ rw, base_path, snap_path);
+ do_log(SMB_VFS_OP_SNAP_CREATE, NT_STATUS_IS_OK(status), handle, "");
+
+ return status;
+}
+
+static NTSTATUS smb_full_audit_snap_delete(struct vfs_handle_struct *handle,
+ TALLOC_CTX *mem_ctx,
+ char *base_path,
+ char *snap_path)
+{
+ NTSTATUS status;
+
+ status = SMB_VFS_NEXT_SNAP_DELETE(handle, mem_ctx, base_path,
+ snap_path);
+ do_log(SMB_VFS_OP_SNAP_DELETE, NT_STATUS_IS_OK(status), handle, "");
+
+ return status;
+}
+
static DIR *smb_full_audit_opendir(vfs_handle_struct *handle,
- const char *fname, const char *mask, uint32 attr)
+ const struct smb_filename *smb_fname,
+ const char *mask,
+ uint32_t attr)
{
DIR *result;
- result = SMB_VFS_NEXT_OPENDIR(handle, fname, mask, attr);
+ result = SMB_VFS_NEXT_OPENDIR(handle, smb_fname, mask, attr);
- do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s", fname);
+ do_log(SMB_VFS_OP_OPENDIR, (result != NULL), handle, "%s",
+ smb_fname->base_name);
return result;
}
static DIR *smb_full_audit_fdopendir(vfs_handle_struct *handle,
- files_struct *fsp, const char *mask, uint32 attr)
+ files_struct *fsp, const char *mask, uint32_t attr)
{
DIR *result;
}
static int smb_full_audit_mkdir(vfs_handle_struct *handle,
- const char *path, mode_t mode)
+ const struct smb_filename *smb_fname, mode_t mode)
{
int result;
- result = SMB_VFS_NEXT_MKDIR(handle, path, mode);
+ result = SMB_VFS_NEXT_MKDIR(handle, smb_fname, mode);
- do_log(SMB_VFS_OP_MKDIR, (result >= 0), handle, "%s", path);
+ do_log(SMB_VFS_OP_MKDIR, (result >= 0), handle, "%s",
+ smb_fname->base_name);
return result;
}
static int smb_full_audit_rmdir(vfs_handle_struct *handle,
- const char *path)
+ const struct smb_filename *smb_fname)
{
int result;
- result = SMB_VFS_NEXT_RMDIR(handle, path);
+ result = SMB_VFS_NEXT_RMDIR(handle, smb_fname);
- do_log(SMB_VFS_OP_RMDIR, (result >= 0), handle, "%s", path);
+ do_log(SMB_VFS_OP_RMDIR, (result >= 0), handle, "%s",
+ smb_fname->base_name);
return result;
}
uint32_t create_options,
uint32_t file_attributes,
uint32_t oplock_request,
+ struct smb2_lease *lease,
uint64_t allocation_size,
uint32_t private_flags,
struct security_descriptor *sd,
struct ea_list *ea_list,
files_struct **result_fsp,
- int *pinfo)
+ int *pinfo,
+ const struct smb2_create_blobs *in_context_blobs,
+ struct smb2_create_blobs *out_context_blobs)
{
NTSTATUS result;
const char* str_create_disposition;
create_options, /* create_options */
file_attributes, /* file_attributes */
oplock_request, /* oplock_request */
+ lease, /* lease */
allocation_size, /* allocation_size */
private_flags,
sd, /* sd */
ea_list, /* ea_list */
result_fsp, /* result */
- pinfo); /* pinfo */
+ pinfo, /* pinfo */
+ in_context_blobs, out_context_blobs); /* create context */
do_log(SMB_VFS_OP_CREATE_FILE, (NT_STATUS_IS_OK(result)), handle,
"0x%x|%s|%s|%s", access_mask,
vfs_handle_struct *handle;
files_struct *fsp;
ssize_t ret;
- int err;
+ struct vfs_aio_state vfs_aio_state;
};
static void smb_full_audit_pread_done(struct tevent_req *subreq);
struct smb_full_audit_pread_state *state = tevent_req_data(
req, struct smb_full_audit_pread_state);
- state->ret = SMB_VFS_PREAD_RECV(subreq, &state->err);
+ state->ret = SMB_VFS_PREAD_RECV(subreq, &state->vfs_aio_state);
TALLOC_FREE(subreq);
tevent_req_done(req);
}
-static ssize_t smb_full_audit_pread_recv(struct tevent_req *req, int *err)
+static ssize_t smb_full_audit_pread_recv(struct tevent_req *req,
+ struct vfs_aio_state *vfs_aio_state)
{
struct smb_full_audit_pread_state *state = tevent_req_data(
req, struct smb_full_audit_pread_state);
- if (tevent_req_is_unix_error(req, err)) {
+ if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
do_log(SMB_VFS_OP_PREAD_RECV, false, state->handle, "%s",
fsp_str_do_log(state->fsp));
return -1;
do_log(SMB_VFS_OP_PREAD_RECV, (state->ret >= 0), state->handle, "%s",
fsp_str_do_log(state->fsp));
- *err = state->err;
+ *vfs_aio_state = state->vfs_aio_state;
return state->ret;
}
vfs_handle_struct *handle;
files_struct *fsp;
ssize_t ret;
- int err;
+ struct vfs_aio_state vfs_aio_state;
};
static void smb_full_audit_pwrite_done(struct tevent_req *subreq);
struct smb_full_audit_pwrite_state *state = tevent_req_data(
req, struct smb_full_audit_pwrite_state);
- state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->err);
+ state->ret = SMB_VFS_PWRITE_RECV(subreq, &state->vfs_aio_state);
TALLOC_FREE(subreq);
tevent_req_done(req);
}
-static ssize_t smb_full_audit_pwrite_recv(struct tevent_req *req, int *err)
+static ssize_t smb_full_audit_pwrite_recv(struct tevent_req *req,
+ struct vfs_aio_state *vfs_aio_state)
{
struct smb_full_audit_pwrite_state *state = tevent_req_data(
req, struct smb_full_audit_pwrite_state);
- if (tevent_req_is_unix_error(req, err)) {
+ if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
do_log(SMB_VFS_OP_PWRITE_RECV, false, state->handle, "%s",
fsp_str_do_log(state->fsp));
return -1;
do_log(SMB_VFS_OP_PWRITE_RECV, (state->ret >= 0), state->handle, "%s",
fsp_str_do_log(state->fsp));
- *err = state->err;
+ *vfs_aio_state = state->vfs_aio_state;
return state->ret;
}
vfs_handle_struct *handle;
files_struct *fsp;
int ret;
- int err;
+ struct vfs_aio_state vfs_aio_state;
};
static void smb_full_audit_fsync_done(struct tevent_req *subreq);
struct smb_full_audit_fsync_state *state = tevent_req_data(
req, struct smb_full_audit_fsync_state);
- state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->err);
+ state->ret = SMB_VFS_FSYNC_RECV(subreq, &state->vfs_aio_state);
TALLOC_FREE(subreq);
tevent_req_done(req);
}
-static int smb_full_audit_fsync_recv(struct tevent_req *req, int *err)
+static int smb_full_audit_fsync_recv(struct tevent_req *req,
+ struct vfs_aio_state *vfs_aio_state)
{
struct smb_full_audit_fsync_state *state = tevent_req_data(
req, struct smb_full_audit_fsync_state);
- if (tevent_req_is_unix_error(req, err)) {
+ if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
do_log(SMB_VFS_OP_FSYNC_RECV, false, state->handle, "%s",
fsp_str_do_log(state->fsp));
return -1;
do_log(SMB_VFS_OP_FSYNC_RECV, (state->ret >= 0), state->handle, "%s",
fsp_str_do_log(state->fsp));
- *err = state->err;
+ *vfs_aio_state = state->vfs_aio_state;
return state->ret;
}
}
static int smb_full_audit_chmod(vfs_handle_struct *handle,
- const char *path, mode_t mode)
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
int result;
- result = SMB_VFS_NEXT_CHMOD(handle, path, mode);
+ result = SMB_VFS_NEXT_CHMOD(handle, smb_fname, mode);
- do_log(SMB_VFS_OP_CHMOD, (result >= 0), handle, "%s|%o", path, mode);
+ do_log(SMB_VFS_OP_CHMOD, (result >= 0), handle, "%s|%o",
+ smb_fname->base_name,
+ mode);
return result;
}
}
static int smb_full_audit_chown(vfs_handle_struct *handle,
- const char *path, uid_t uid, gid_t gid)
+ const struct smb_filename *smb_fname,
+ uid_t uid,
+ gid_t gid)
{
int result;
- result = SMB_VFS_NEXT_CHOWN(handle, path, uid, gid);
+ result = SMB_VFS_NEXT_CHOWN(handle, smb_fname, uid, gid);
do_log(SMB_VFS_OP_CHOWN, (result >= 0), handle, "%s|%ld|%ld",
- path, (long int)uid, (long int)gid);
+ smb_fname->base_name, (long int)uid, (long int)gid);
return result;
}
}
static int smb_full_audit_fallocate(vfs_handle_struct *handle, files_struct *fsp,
- enum vfs_fallocate_mode mode,
+ uint32_t mode,
off_t offset,
off_t len)
{
static int smb_full_audit_kernel_flock(struct vfs_handle_struct *handle,
struct files_struct *fsp,
- uint32 share_mode, uint32 access_mask)
+ uint32_t share_mode, uint32_t access_mask)
{
int result;
return result;
}
-static NTSTATUS smb_full_audit_notify_watch(struct vfs_handle_struct *handle,
- struct sys_notify_context *ctx,
- const char *path,
- uint32_t *filter,
- uint32_t *subdir_filter,
- void (*callback)(struct sys_notify_context *ctx,
- void *private_data,
- struct notify_event *ev),
- void *private_data, void *handle_p)
-{
- NTSTATUS result;
-
- result = SMB_VFS_NEXT_NOTIFY_WATCH(handle, ctx, path,
- filter, subdir_filter, callback,
- private_data, handle_p);
-
- do_log(SMB_VFS_OP_NOTIFY_WATCH, NT_STATUS_IS_OK(result), handle, "");
-
- return result;
-}
-
static int smb_full_audit_chflags(vfs_handle_struct *handle,
const char *path, unsigned int flags)
{
return result;
}
+static NTSTATUS smb_full_audit_readdir_attr(struct vfs_handle_struct *handle,
+ const struct smb_filename *fname,
+ TALLOC_CTX *mem_ctx,
+ struct readdir_attr_data **pattr_data)
+{
+ NTSTATUS status;
+
+ 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(fname));
+
+ return status;
+}
+
static NTSTATUS smb_full_audit_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
- uint32 security_info,
+ uint32_t security_info,
TALLOC_CTX *mem_ctx,
struct security_descriptor **ppdesc)
{
}
static NTSTATUS smb_full_audit_get_nt_acl(vfs_handle_struct *handle,
- const char *name,
- uint32 security_info,
+ const struct smb_filename *smb_fname,
+ uint32_t security_info,
TALLOC_CTX *mem_ctx,
struct security_descriptor **ppdesc)
{
NTSTATUS result;
- result = SMB_VFS_NEXT_GET_NT_ACL(handle, name, security_info,
+ result = SMB_VFS_NEXT_GET_NT_ACL(handle, smb_fname, security_info,
mem_ctx, ppdesc);
do_log(SMB_VFS_OP_GET_NT_ACL, NT_STATUS_IS_OK(result), handle,
- "%s", name);
+ "%s", smb_fname_str_do_log(smb_fname));
return result;
}
static NTSTATUS smb_full_audit_fset_nt_acl(vfs_handle_struct *handle, files_struct *fsp,
- uint32 security_info_sent,
+ uint32_t security_info_sent,
const struct security_descriptor *psd)
{
struct vfs_full_audit_private_data *pd;
}
static int smb_full_audit_chmod_acl(vfs_handle_struct *handle,
- const char *path, mode_t mode)
+ const struct smb_filename *smb_fname,
+ mode_t mode)
{
int result;
- result = SMB_VFS_NEXT_CHMOD_ACL(handle, path, mode);
+ result = SMB_VFS_NEXT_CHMOD_ACL(handle, smb_fname, mode);
do_log(SMB_VFS_OP_CHMOD_ACL, (result >= 0), handle,
- "%s|%o", path, mode);
+ "%s|%o", smb_fname->base_name, mode);
return result;
}
.get_shadow_copy_data_fn = smb_full_audit_get_shadow_copy_data,
.statvfs_fn = smb_full_audit_statvfs,
.fs_capabilities_fn = smb_full_audit_fs_capabilities,
+ .snap_check_path_fn = smb_full_audit_snap_check_path,
+ .snap_create_fn = smb_full_audit_snap_create,
+ .snap_delete_fn = smb_full_audit_snap_delete,
.opendir_fn = smb_full_audit_opendir,
.fdopendir_fn = smb_full_audit_fdopendir,
.readdir_fn = smb_full_audit_readdir,
.link_fn = smb_full_audit_link,
.mknod_fn = smb_full_audit_mknod,
.realpath_fn = smb_full_audit_realpath,
- .notify_watch_fn = smb_full_audit_notify_watch,
.chflags_fn = smb_full_audit_chflags,
.file_id_create_fn = smb_full_audit_file_id_create,
.streaminfo_fn = smb_full_audit_streaminfo,
.copy_chunk_recv_fn = smb_full_audit_copy_chunk_recv,
.get_compression_fn = smb_full_audit_get_compression,
.set_compression_fn = smb_full_audit_set_compression,
+ .readdir_attr_fn = smb_full_audit_readdir_attr,
.fget_nt_acl_fn = smb_full_audit_fget_nt_acl,
.get_nt_acl_fn = smb_full_audit_get_nt_acl,
.fset_nt_acl_fn = smb_full_audit_fset_nt_acl,
.set_offline_fn = smb_full_audit_set_offline,
};
+static_decl_vfs;
NTSTATUS vfs_full_audit_init(void)
{
NTSTATUS ret = smb_register_vfs(SMB_VFS_INTERFACE_VERSION,