return NT_STATUS_NOT_IMPLEMENTED;
}
+static NTSTATUS skel_fstreaminfo(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ TALLOC_CTX *mem_ctx,
+ unsigned int *num_streams,
+ struct stream_struct **streams)
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
static int skel_get_real_filename(struct vfs_handle_struct *handle,
const struct smb_filename *path,
const char *name,
.set_compression_fn = skel_set_compression,
.streaminfo_fn = skel_streaminfo,
+ .fstreaminfo_fn = skel_fstreaminfo,
.get_real_filename_fn = skel_get_real_filename,
.connectpath_fn = skel_connectpath,
.brl_lock_windows_fn = skel_brl_lock_windows,
streams);
}
+static NTSTATUS skel_fstreaminfo(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ TALLOC_CTX *mem_ctx,
+ unsigned int *num_streams,
+ struct stream_struct **streams)
+{
+ return SMB_VFS_NEXT_FSTREAMINFO(handle,
+ fsp,
+ mem_ctx,
+ num_streams,
+ streams);
+}
+
static int skel_get_real_filename(struct vfs_handle_struct *handle,
const struct smb_filename *path,
const char *name,
.set_compression_fn = skel_set_compression,
.streaminfo_fn = skel_streaminfo,
+ .fstreaminfo_fn = skel_fstreaminfo,
.get_real_filename_fn = skel_get_real_filename,
.connectpath_fn = skel_connectpath,
.brl_lock_windows_fn = skel_brl_lock_windows,
* Version 45 - Remove SMB_VFS_CHMOD
* Version 45 - Add SMB_VFS_FNTIMES
* Version 45 - Remove SMB_VFS_NTIMES
+ * Version 45 - ADD SMB_VFS_FSTREAMINFO
*/
#define SMB_VFS_INTERFACE_VERSION 45
unsigned int *num_streams,
struct stream_struct **streams);
+ NTSTATUS (*fstreaminfo_fn)(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ TALLOC_CTX *mem_ctx,
+ unsigned int *num_streams,
+ struct stream_struct **streams);
+
int (*get_real_filename_fn)(struct vfs_handle_struct *handle,
const struct smb_filename *path,
const char *name,
TALLOC_CTX *mem_ctx,
unsigned int *num_streams,
struct stream_struct **streams);
+NTSTATUS smb_vfs_call_fstreaminfo(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ TALLOC_CTX *mem_ctx,
+ unsigned int *num_streams,
+ struct stream_struct **streams);
int smb_vfs_call_get_real_filename(struct vfs_handle_struct *handle,
const struct smb_filename *path,
const char *name,
TALLOC_CTX *mem_ctx,
unsigned int *num_streams,
struct stream_struct **streams);
+NTSTATUS vfs_not_implemented_fstreaminfo(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ TALLOC_CTX *mem_ctx,
+ unsigned int *num_streams,
+ struct stream_struct **streams);
int vfs_not_implemented_get_real_filename(struct vfs_handle_struct *handle,
const struct smb_filename *path,
const char *name,
#define SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx, num_streams, streams) \
smb_vfs_call_streaminfo((handle)->next, (fsp), (smb_fname), (mem_ctx), (num_streams), (streams))
+#define SMB_VFS_FSTREAMINFO(fsp, mem_ctx, num_streams, streams) \
+ smb_vfs_call_fstreaminfo((fsp)->conn->vfs_handles, (fsp), (mem_ctx), (num_streams), (streams))
+#define SMB_VFS_NEXT_FSTREAMINFO(handle, fsp, mem_ctx, num_streams, streams) \
+ smb_vfs_call_fstreaminfo(handle->next, (fsp), (mem_ctx), (num_streams), (streams))
+
#define SMB_VFS_GET_REAL_FILENAME(conn, path, name, mem_ctx, found_name) \
smb_vfs_call_get_real_filename((conn)->vfs_handles, (path), (name), (mem_ctx), (found_name))
#define SMB_VFS_NEXT_GET_REAL_FILENAME(handle, path, name, mem_ctx, found_name) \
return NT_STATUS_OK;
}
+static NTSTATUS vfswrap_fstreaminfo(vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ TALLOC_CTX *mem_ctx,
+ unsigned int *pnum_streams,
+ struct stream_struct **pstreams)
+{
+ struct stream_struct *tmp_streams = NULL;
+ unsigned int num_streams = *pnum_streams;
+ struct stream_struct *streams = *pstreams;
+ NTSTATUS status;
+
+ if (fsp->fsp_flags.is_directory) {
+ /*
+ * No default streams on directories
+ */
+ goto done;
+ }
+ status = vfs_stat_fsp(fsp);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+
+ if (num_streams + 1 < 1) {
+ /* Integer wrap. */
+ return NT_STATUS_INVALID_PARAMETER;
+ }
+
+ tmp_streams = talloc_realloc(mem_ctx,
+ streams,
+ struct stream_struct,
+ num_streams + 1);
+ if (tmp_streams == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ tmp_streams[num_streams].name = talloc_strdup(tmp_streams, "::$DATA");
+ if (tmp_streams[num_streams].name == NULL) {
+ return NT_STATUS_NO_MEMORY;
+ }
+ tmp_streams[num_streams].size = fsp->fsp_name->st.st_ex_size;
+ tmp_streams[num_streams].alloc_size = SMB_VFS_GET_ALLOC_SIZE(
+ handle->conn,
+ fsp,
+ &fsp->fsp_name->st);
+ num_streams += 1;
+
+ *pnum_streams = num_streams;
+ *pstreams = tmp_streams;
+ done:
+ return NT_STATUS_OK;
+}
+
static int vfswrap_get_real_filename(struct vfs_handle_struct *handle,
const struct smb_filename *path,
const char *name,
.file_id_create_fn = vfswrap_file_id_create,
.fs_file_id_fn = vfswrap_fs_file_id,
.streaminfo_fn = vfswrap_streaminfo,
+ .fstreaminfo_fn = vfswrap_fstreaminfo,
.get_real_filename_fn = vfswrap_get_real_filename,
.connectpath_fn = vfswrap_connectpath,
.brl_lock_windows_fn = vfswrap_brl_lock_windows,
SMB_VFS_OP_FILE_ID_CREATE,
SMB_VFS_OP_FS_FILE_ID,
SMB_VFS_OP_STREAMINFO,
+ SMB_VFS_OP_FSTREAMINFO,
SMB_VFS_OP_GET_REAL_FILENAME,
SMB_VFS_OP_CONNECTPATH,
SMB_VFS_OP_BRL_LOCK_WINDOWS,
{ SMB_VFS_OP_FILE_ID_CREATE, "file_id_create" },
{ SMB_VFS_OP_FS_FILE_ID, "fs_file_id" },
{ SMB_VFS_OP_STREAMINFO, "streaminfo" },
+ { SMB_VFS_OP_FSTREAMINFO, "fstreaminfo" },
{ SMB_VFS_OP_GET_REAL_FILENAME, "get_real_filename" },
{ SMB_VFS_OP_CONNECTPATH, "connectpath" },
{ SMB_VFS_OP_BRL_LOCK_WINDOWS, "brl_lock_windows" },
return result;
}
-
static NTSTATUS smb_full_audit_streaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
const struct smb_filename *smb_fname,
return result;
}
+static NTSTATUS smb_full_audit_fstreaminfo(vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ TALLOC_CTX *mem_ctx,
+ unsigned int *pnum_streams,
+ struct stream_struct **pstreams)
+{
+ NTSTATUS result;
+
+ result = SMB_VFS_NEXT_FSTREAMINFO(handle, fsp, mem_ctx,
+ pnum_streams, pstreams);
+
+ do_log(SMB_VFS_OP_FSTREAMINFO,
+ NT_STATUS_IS_OK(result),
+ handle,
+ "%s",
+ smb_fname_str_do_log(handle->conn, fsp->fsp_name));
+
+ return result;
+}
+
static int smb_full_audit_get_real_filename(struct vfs_handle_struct *handle,
const struct smb_filename *path,
const char *name,
.snap_create_fn = smb_full_audit_snap_create,
.snap_delete_fn = smb_full_audit_snap_delete,
.streaminfo_fn = smb_full_audit_streaminfo,
+ .fstreaminfo_fn = smb_full_audit_fstreaminfo,
.get_real_filename_fn = smb_full_audit_get_real_filename,
.connectpath_fn = smb_full_audit_connectpath,
.brl_lock_windows_fn = smb_full_audit_brl_lock_windows,
return NT_STATUS_NOT_IMPLEMENTED;
}
+NTSTATUS vfs_not_implemented_fstreaminfo(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ TALLOC_CTX *mem_ctx,
+ unsigned int *num_streams,
+ struct stream_struct **streams)
+{
+ return NT_STATUS_NOT_IMPLEMENTED;
+}
+
int vfs_not_implemented_get_real_filename(struct vfs_handle_struct *handle,
const struct smb_filename *path,
const char *name,
.set_compression_fn = vfs_not_implemented_set_compression,
.streaminfo_fn = vfs_not_implemented_streaminfo,
+ .fstreaminfo_fn = vfs_not_implemented_fstreaminfo,
.get_real_filename_fn = vfs_not_implemented_get_real_filename,
.connectpath_fn = vfs_not_implemented_connectpath,
.brl_lock_windows_fn = vfs_not_implemented_brl_lock_windows,
return result;
}
+static NTSTATUS smb_time_audit_fstreaminfo(vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ TALLOC_CTX *mem_ctx,
+ unsigned int *pnum_streams,
+ struct stream_struct **pstreams)
+{
+ NTSTATUS result;
+ struct timespec ts1,ts2;
+ double timediff;
+
+ clock_gettime_mono(&ts1);
+ 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("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,
.snap_create_fn = smb_time_audit_snap_create,
.snap_delete_fn = smb_time_audit_snap_delete,
.streaminfo_fn = smb_time_audit_streaminfo,
+ .fstreaminfo_fn = smb_time_audit_fstreaminfo,
.get_real_filename_fn = smb_time_audit_get_real_filename,
.connectpath_fn = smb_time_audit_connectpath,
.brl_lock_windows_fn = smb_time_audit_brl_lock_windows,
num_streams, streams);
}
+NTSTATUS smb_vfs_call_fstreaminfo(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ TALLOC_CTX *mem_ctx,
+ unsigned int *num_streams,
+ struct stream_struct **streams)
+{
+ VFS_FIND(fstreaminfo);
+ return handle->fns->fstreaminfo_fn(handle, fsp, mem_ctx,
+ num_streams, streams);
+}
+
int smb_vfs_call_get_real_filename(struct vfs_handle_struct *handle,
const struct smb_filename *path,
const char *name,