return NT_STATUS_INVALID_DEVICE_REQUEST;
}
-static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
- struct files_struct *fsp,
- const struct smb_filename *smb_fname,
- TALLOC_CTX *mem_ctx,
- unsigned int *num_streams,
- struct stream_struct **streams)
-{
- return NT_STATUS_NOT_IMPLEMENTED;
-}
-
static NTSTATUS skel_fstreaminfo(struct vfs_handle_struct *handle,
struct files_struct *fsp,
TALLOC_CTX *mem_ctx,
.fget_compression_fn = skel_fget_compression,
.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,
compression_fmt);
}
-static NTSTATUS skel_streaminfo(struct vfs_handle_struct *handle,
- struct files_struct *fsp,
- const struct smb_filename *smb_fname,
- TALLOC_CTX *mem_ctx,
- unsigned int *num_streams,
- struct stream_struct **streams)
-{
- return SMB_VFS_NEXT_STREAMINFO(handle,
- fsp,
- smb_fname,
- mem_ctx,
- num_streams,
- streams);
-}
-
static NTSTATUS skel_fstreaminfo(struct vfs_handle_struct *handle,
struct files_struct *fsp,
TALLOC_CTX *mem_ctx,
.fget_compression_fn = skel_fget_compression,
.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,
char *base_path,
char *snap_path);
- NTSTATUS (*streaminfo_fn)(struct vfs_handle_struct *handle,
- struct files_struct *fsp,
- const struct smb_filename *smb_fname,
- TALLOC_CTX *mem_ctx,
- unsigned int *num_streams,
- struct stream_struct **streams);
-
NTSTATUS (*fstreaminfo_fn)(struct vfs_handle_struct *handle,
struct files_struct *fsp,
TALLOC_CTX *mem_ctx,
const SMB_STRUCT_STAT *sbuf);
uint64_t smb_vfs_call_fs_file_id(struct vfs_handle_struct *handle,
const SMB_STRUCT_STAT *sbuf);
-NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle,
- struct files_struct *fsp,
- const struct smb_filename *smb_fname,
- 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,
TALLOC_CTX *mem_ctx,
struct files_struct *fsp,
uint16_t compression_fmt);
-NTSTATUS vfs_not_implemented_streaminfo(struct vfs_handle_struct *handle,
- struct files_struct *fsp,
- const struct smb_filename *smb_fname,
- 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,
return file_id;
}
-static NTSTATUS vfswrap_streaminfo(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)
-{
- SMB_STRUCT_STAT sbuf;
- struct stream_struct *tmp_streams = NULL;
- int ret;
-
- if ((fsp != NULL) && (fsp->fsp_flags.is_directory)) {
- /*
- * No default streams on directories
- */
- goto done;
- }
-
- if ((fsp != NULL) && (fsp_get_pathref_fd(fsp) != -1)) {
- ret = SMB_VFS_FSTAT(fsp, &sbuf);
- }
- else {
- struct smb_filename *smb_fname_cp = NULL;
-
- smb_fname_cp = cp_smb_filename_nostream(talloc_tos(), smb_fname);
- if (smb_fname_cp == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
-
- ret = vfs_stat(handle->conn, smb_fname_cp);
- sbuf = smb_fname_cp->st;
- TALLOC_FREE(smb_fname_cp);
- }
-
- if (ret == -1) {
- return map_nt_error_from_unix(errno);
- }
-
- if (S_ISDIR(sbuf.st_ex_mode)) {
- goto done;
- }
-
- tmp_streams = talloc_realloc(mem_ctx, *pstreams, struct stream_struct,
- (*pnum_streams) + 1);
- if (tmp_streams == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
- tmp_streams[*pnum_streams].name = talloc_strdup(tmp_streams, "::$DATA");
- if (tmp_streams[*pnum_streams].name == NULL) {
- return NT_STATUS_NO_MEMORY;
- }
- tmp_streams[*pnum_streams].size = sbuf.st_ex_size;
- tmp_streams[*pnum_streams].alloc_size = SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp, &sbuf);
-
- *pnum_streams += 1;
- *pstreams = tmp_streams;
- done:
- return NT_STATUS_OK;
-}
-
static NTSTATUS vfswrap_fstreaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
TALLOC_CTX *mem_ctx,
.chflags_fn = vfswrap_chflags,
.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,
SMB_VFS_OP_CHFLAGS,
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_CHFLAGS, "chflags" },
{ 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" },
return result;
}
-static NTSTATUS smb_full_audit_streaminfo(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)
-{
- NTSTATUS result;
-
- result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, mem_ctx,
- pnum_streams, pstreams);
-
- do_log(SMB_VFS_OP_STREAMINFO,
- NT_STATUS_IS_OK(result),
- handle,
- "%s",
- smb_fname_str_do_log(handle->conn, smb_fname));
-
- return result;
-}
static NTSTATUS smb_full_audit_fstreaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
.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,
- .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,
return NT_STATUS_INVALID_DEVICE_REQUEST;
}
-NTSTATUS vfs_not_implemented_streaminfo(struct vfs_handle_struct *handle,
- struct files_struct *fsp,
- const struct smb_filename *smb_fname,
- TALLOC_CTX *mem_ctx,
- unsigned int *num_streams,
- struct stream_struct **streams)
-{
- return NT_STATUS_NOT_IMPLEMENTED;
-}
-
NTSTATUS vfs_not_implemented_fstreaminfo(struct vfs_handle_struct *handle,
struct files_struct *fsp,
TALLOC_CTX *mem_ctx,
.fget_compression_fn = vfs_not_implemented_fget_compression,
.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,
return result;
}
-static NTSTATUS smb_time_audit_streaminfo(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)
-{
- NTSTATUS result;
- struct timespec ts1,ts2;
- double timediff;
-
- clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_STREAMINFO(handle, fsp, smb_fname, 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);
- }
-
- return result;
-}
-
static NTSTATUS smb_time_audit_fstreaminfo(vfs_handle_struct *handle,
struct files_struct *fsp,
TALLOC_CTX *mem_ctx,
.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,
.fstreaminfo_fn = smb_time_audit_fstreaminfo,
.get_real_filename_fn = smb_time_audit_get_real_filename,
.connectpath_fn = smb_time_audit_connectpath,
return handle->fns->fs_file_id_fn(handle, sbuf);
}
-NTSTATUS smb_vfs_call_streaminfo(struct vfs_handle_struct *handle,
- struct files_struct *fsp,
- const struct smb_filename *smb_fname,
- TALLOC_CTX *mem_ctx,
- unsigned int *num_streams,
- struct stream_struct **streams)
-{
- VFS_FIND(streaminfo);
- return handle->fns->streaminfo_fn(handle, fsp, smb_fname, mem_ctx,
- num_streams, streams);
-}
-
NTSTATUS smb_vfs_call_fstreaminfo(struct vfs_handle_struct *handle,
struct files_struct *fsp,
TALLOC_CTX *mem_ctx,