From 7a0b5d6fc51d5d212529e82e5ed8e21516bfbe27 Mon Sep 17 00:00:00 2001 From: Frank Lahm Date: Thu, 13 Oct 2011 15:41:53 -0700 Subject: Add support for VFS op streaminfo chaining in all relevant VFS modules. Autobuild-User: Jeremy Allison Autobuild-Date: Fri Oct 14 03:26:06 CEST 2011 on sn-devel-104 --- source3/modules/vfs_default.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) (limited to 'source3/modules/vfs_default.c') diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index 17200696b3..4fd844a104 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -1692,8 +1692,7 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle, 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)) { @@ -1728,25 +1727,21 @@ static NTSTATUS vfswrap_streaminfo(vfs_handle_struct *handle, 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; } -- cgit