return map_nt_error_from_unix(errno);
}
- state.streams = NULL;
- state.num_streams = 0;
+ state.streams = *pstreams;
+ state.num_streams = *pnum_streams;
if (lp_parm_bool(SNUM(handle->conn), PARM_ONEFS_TYPE,
PARM_IGNORE_STREAMS, PARM_IGNORE_STREAMS_DEFAULT)) {
goto out;
}
- /* Add the default stream. */
- if (S_ISREG(sbuf.st_ex_mode)) {
- if (!add_one_stream(mem_ctx,
- &state.num_streams, &state.streams,
- "", sbuf.st_ex_size,
- SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp,
- &sbuf))) {
- return NT_STATUS_NO_MEMORY;
- }
- }
-
state.mem_ctx = mem_ctx;
state.handle = handle;
state.status = NT_STATUS_OK;
out:
*num_streams = state.num_streams;
*streams = state.streams;
- return NT_STATUS_OK;
+ return SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, pnum_streams, pstreams);
}
struct stream_struct **pstreams)
{
SMB_STRUCT_STAT sbuf;
- unsigned int num_streams = 0;
- struct stream_struct *streams = NULL;
+ struct stream_struct *tmp_streams = NULL;
int ret;
if ((fsp != NULL) && (fsp->is_directory)) {
goto done;
}
- streams = talloc(mem_ctx, struct stream_struct);
-
- if (streams == NULL) {
+ tmp_streams = talloc_realloc(mem_ctx, *pstreams, struct stream_struct,
+ (*pnum_streams) + 1);
+ if (tmp_streams == NULL) {
return NT_STATUS_NO_MEMORY;
}
-
- streams->size = sbuf.st_ex_size;
- streams->alloc_size = SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp, &sbuf);
-
- streams->name = talloc_strdup(streams, "::$DATA");
- if (streams->name == NULL) {
- TALLOC_FREE(streams);
+ 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);
- num_streams = 1;
+ *pnum_streams += 1;
+ *pstreams = tmp_streams;
done:
- *pnum_streams = num_streams;
- *pstreams = streams;
return NT_STATUS_OK;
}
goto out;
}
- state.streams = NULL;
- state.num_streams = 0;
-
- if (!S_ISDIR(smb_fname_base->st.st_ex_mode)) {
- if (!add_one_stream(mem_ctx,
- &state.num_streams, &state.streams,
- "::$DATA", smb_fname_base->st.st_ex_size,
- SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp,
- &smb_fname_base->st))) {
- status = NT_STATUS_NO_MEMORY;
- goto out;
- }
- }
-
+ state.streams = *pstreams;
+ state.num_streams = *pnum_streams;
state.mem_ctx = mem_ctx;
state.handle = handle;
state.status = NT_STATUS_OK;
*pnum_streams = state.num_streams;
*pstreams = state.streams;
- status = NT_STATUS_OK;
+ status = SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, pnum_streams, pstreams);
out:
TALLOC_FREE(smb_fname_base);
return map_nt_error_from_unix(errno);
}
- state.streams = NULL;
- state.num_streams = 0;
-
- if (!S_ISDIR(sbuf.st_ex_mode)) {
- if (!add_one_stream(mem_ctx,
- &state.num_streams, &state.streams,
- "::$DATA", sbuf.st_ex_size,
- SMB_VFS_GET_ALLOC_SIZE(handle->conn, fsp,
- &sbuf))) {
- return NT_STATUS_NO_MEMORY;
- }
- }
-
+ state.streams = *pstreams;
+ state.num_streams = *pnum_streams;
state.mem_ctx = mem_ctx;
state.handle = handle;
state.status = NT_STATUS_OK;
*pnum_streams = state.num_streams;
*pstreams = state.streams;
- return NT_STATUS_OK;
+
+ return SMB_VFS_NEXT_STREAMINFO(handle, fsp, fname, mem_ctx, pnum_streams, pstreams);
}
static uint32_t streams_xattr_fs_capabilities(struct vfs_handle_struct *handle,
NTSTATUS delete_all_streams(connection_struct *conn, const char *fname)
{
- struct stream_struct *stream_info;
+ struct stream_struct *stream_info = NULL;
int i;
- unsigned int num_streams;
+ unsigned int num_streams = 0;
TALLOC_CTX *frame = talloc_stackframe();
NTSTATUS status;
struct smb_filename *smb_fname)
{
NTSTATUS status;
- unsigned int i, num_streams;
+ unsigned int i, num_streams = 0;
struct stream_struct *streams = NULL;
if (SMB_VFS_STAT(conn, smb_fname) == 0) {
if (flags & EXTENDED_RESPONSE_REQUIRED) {
uint16_t file_status = (NO_EAS|NO_SUBSTREAMS|NO_REPARSETAG);
size_t num_names = 0;
- unsigned int num_streams;
+ unsigned int num_streams = 0;
struct stream_struct *streams = NULL;
/* Do we have any EA's ? */
if (flags & EXTENDED_RESPONSE_REQUIRED) {
uint16_t file_status = (NO_EAS|NO_SUBSTREAMS|NO_REPARSETAG);
size_t num_names = 0;
- unsigned int num_streams;
+ unsigned int num_streams = 0;
struct stream_struct *streams = NULL;
/* Do we have any EA's ? */
NTSTATUS open_streams_for_delete(connection_struct *conn,
const char *fname)
{
- struct stream_struct *stream_info;
- files_struct **streams;
+ struct stream_struct *stream_info = NULL;
+ files_struct **streams = NULL;
int i;
- unsigned int num_streams;
+ unsigned int num_streams = 0;
TALLOC_CTX *frame = talloc_stackframe();
NTSTATUS status;
*/
case SMB_QUERY_FILE_STREAM_INFO:
case SMB_FILE_STREAM_INFORMATION: {
- unsigned int num_streams;
- struct stream_struct *streams;
+ unsigned int num_streams = 0;
+ struct stream_struct *streams = NULL;
DEBUG(10,("smbd_do_qfilepathinfo: "
"SMB_FILE_STREAM_INFORMATION\n"));